Skip to content

[WIP] Generate JSON schemas and C# POCO classes for configurations#172

Closed
Copilot wants to merge 1 commit intomasterfrom
copilot/create-json-schemas-configurations
Closed

[WIP] Generate JSON schemas and C# POCO classes for configurations#172
Copilot wants to merge 1 commit intomasterfrom
copilot/create-json-schemas-configurations

Conversation

Copy link
Contributor

Copilot AI commented Feb 5, 2026

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original prompt

This section details on the original issue you should resolve

<issue_title>[7] Create JSON Schemas for Top 5 Configurations</issue_title>
<issue_description>Estimate: 2 days
Sprint: Week 3
Assignee: [Developer]


Description

Generate JSON schemas and C# POCO classes for the top 5 most-used XML configurations identified in Ticket #6.

Context

AI Prompt

For each of the top 5 XML configuration schemas in ACAT:

1. Generate equivalent JSON schema with:
   - Validation rules (required fields, types, constraints)
   - Descriptions for each property
   - Default values where appropriate

2. Generate C# POCO classes with:
   - System.Text.Json attributes
   - XML documentation comments
   - Validation attributes (Required, Range, etc.)
   - Factory methods for common scenarios

3. Generate FluentValidation validators with:
   - Business rule validation
   - Cross-field validation
   - Custom validation messages

4. Create example JSON files showing usage

For example, for ActuatorSettings.xml, generate:
- actuator-settings.schema.json
- ActuatorSettings.cs (POCO)
- ActuatorSettingsValidator.cs
- actuator-settings.example.json

Tasks

  • AI generates schemas and POCOs
  • Review and adjust generated code
  • Add FluentValidation package if needed
  • Create validation classes
  • Generate example JSON files
  • Test deserialization works correctly
  • Document usage

Acceptance Criteria

  • ✅ JSON schemas created for top 5 config types
  • ✅ C# POCO classes generated and reviewed
  • ✅ FluentValidation validators created
  • ✅ Example JSON files created
  • ✅ Deserialization tested successfully
  • ✅ VS Code provides IntelliSense for JSON files
  • ✅ Validation rules working correctly

Example Output

// ActuatorSettings.cs
public class ActuatorSettings
{
    [JsonPropertyName("actuators")]
    public List<Actuator> Actuators { get; set; } = new();
    
    [JsonPropertyName("defaultActuator")]
    public string DefaultActuator { get; set; }
}

public class Actuator
{
    [JsonPropertyName("name")]
    [Required]
    public string Name { get; set; }
    
    [JsonPropertyName("enabled")]
    public bool Enabled { get; set; } = true;
    
    [JsonPropertyName("switches")]
    public List<Switch> Switches { get; set; } = new();
}

// ActuatorSettingsValidator.cs
public class ActuatorSettingsValidator : AbstractValidator<ActuatorSettings>
{
    public ActuatorSettingsValidator()
    {
        RuleFor(x => x.Actuators)
            .NotEmpty()
            .WithMessage("At least one actuator must be configured");
        
        RuleFor(x => x.DefaultActuator)
            .NotEmpty()
            .WithMessage("Default actuator must be specified");
        
        RuleForEach(x => x.Actuators)
            .SetValidator(new ActuatorValidator());
    }
}
// actuator-settings.schema.json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Actuator Settings",
  "type": "object",
  "required": ["actuators", "defaultActuator"],
  "properties": {
    "actuators": {
      "type": "array",
      "items": { "$ref": "#/definitions/actuator" },
      "minItems": 1
    },
    "defaultActuator": {
      "type": "string",
      "description": "Name of the default actuator to use"
    }
  },
  "definitions": {
    "actuator": {
      "type": "object",
      "required": ["name"],
      "properties": {
        "name": { "type": "string" },
        "enabled": { "type": "boolean", "default": true },
        "switches": { "type": "array", "items": { "$ref": "#/definitions/switch" } }
      }
    }
  }
}

Dependencies

Package Requirements

<PackageReference Include="System.Text.Json" Version="8.0.0" />
<PackageReference Include="FluentValidation" Version="11.9.0" />

🎫 Ticket #8: Create XML to JSON Migration Tool

Labels: phase-1-foundation, configuration, P1-High, ai-generated, tooling
Estimate: 2 days
Assignee: [Developer]
Sprint: Week 3-4

Description

Build a command-line tool to migrate existing XML configuration files to JSON format, using the schemas created in Ticket #7.

Context

  • Users have existing XML configurations
  • Need automated migration to avoid manual conversion
  • Should validate output against JSON schemas

AI Prompt

Create a ConfigMigrationTool console application that:

1. Discovers all XML configuration files in a directory
2. Identifies the schema type of each XML file
3. Converts to equivalent JSON using the POCOs from Ticket intel/acat#7
4. Validates converte...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes intel/acat#158

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants