Skip to content

Add schema versioning infrastructure with v1.0.0#4169

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/add-schema-versioning-infrastructure
Closed

Add schema versioning infrastructure with v1.0.0#4169
Copilot wants to merge 2 commits intomainfrom
copilot/add-schema-versioning-infrastructure

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 17, 2025

Adds semantic versioning to JSON schemas to enable programmatic compatibility tracking and automated migration tooling.

Changes

Schema Files

  • Added version: "1.0.0" and $id URI to all three schemas:
    • main_workflow_schema.jsonhttps://github.com/githubnext/gh-aw/schemas/workflow/v1.0.0
    • included_file_schema.jsonhttps://github.com/githubnext/gh-aw/schemas/included-file/v1.0.0
    • mcp_config_schema.jsonhttps://github.com/githubnext/gh-aw/schemas/mcp-config/v1.0.0

Parser API

  • Added SchemaVersion struct with Version and ID fields
  • Exposed public getters for each schema's version:
    • GetMainWorkflowSchemaVersion()
    • GetIncludedFileSchemaVersion()
    • GetMCPConfigSchemaVersion()

Tests

  • Created schema_version_test.go with 17 test cases covering:
    • Version retrieval from all schemas
    • Embedding verification
    • JSON parsing edge cases
    • Cross-schema consistency

Usage

version, err := parser.GetMainWorkflowSchemaVersion()
if err != nil {
    return err
}
fmt.Printf("Version: %s\n", version.Version) // "1.0.0"
fmt.Printf("ID: %s\n", version.ID)           // "https://github.com/..."

Enables future schema evolution tracking and automated migration tools.

Original prompt

This section details on the original issue you should resolve

<issue_title>[task] Add schema versioning infrastructure</issue_title>
<issue_description>## Objective
Add semantic versioning to the JSON schema to enable compatibility tracking and automated tooling.

Context

Related to #3915

Currently, the schema has no version field, making it impossible to:

  • Track compatibility programmatically
  • Build automated migration tools
  • Validate schema version requirements
  • Detect stale workflows

Approach

  1. Add version field to schema root in pkg/parser/schemas/main_workflow_schema.json:

    {
      "$schema": "(redacted)",
      "$id": "https://github.com/githubnext/gh-aw/schemas/workflow/v1.0.0",
      "version": "1.0.0",
      "type": "object",
      "properties": { ... }
    }
  2. Determine appropriate initial version (suggest 1.0.0)

  3. Update schema validation to read and track version

  4. Add version to embedded schema in Go code

Files to Modify

  • Create: pkg/parser/schemas/main_workflow_schema.json - Add version fields
  • Update: pkg/parser/schema_validation.go - Read and validate version
  • Update: Schema embedding code to include version

Acceptance Criteria

  • Schema contains version and $id fields
  • Parser can read schema version
  • Tests verify version is properly embedded
  • Documentation updated with versioning approach

AI generated by Plan Command for discussion #3915</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

- Added version and $id fields to all three schema files:
  - main_workflow_schema.json: v1.0.0
  - included_file_schema.json: v1.0.0
  - mcp_config_schema.json: v1.0.0
- Created SchemaVersion type to hold version information
- Added GetMainWorkflowSchemaVersion() function
- Added GetIncludedFileSchemaVersion() function
- Added GetMCPConfigSchemaVersion() function
- Added comprehensive tests in schema_version_test.go
- All tests pass, code is formatted and linted

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add semantic versioning to JSON schema Add schema versioning infrastructure with v1.0.0 Nov 17, 2025
Copilot AI requested a review from pelikhan November 17, 2025 00:21
@pelikhan pelikhan marked this pull request as ready for review November 17, 2025 00:37
Copilot AI review requested due to automatic review settings November 17, 2025 00:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds semantic versioning infrastructure to the JSON schemas, enabling programmatic compatibility tracking for the three schema files used by GitHub Agentic Workflows. The changes introduce version: "1.0.0" and $id URI fields to each schema, along with a Go API to retrieve version information.

Key changes:

  • Added schema versioning metadata (version and $id) to all three JSON schema files
  • Created a SchemaVersion struct and public getter functions for programmatic access
  • Implemented comprehensive test coverage with 17 test cases covering version retrieval, embedding verification, and cross-schema consistency

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/parser/schemas/main_workflow_schema.json Added version "1.0.0" and $id URI for main workflow schema
pkg/parser/schemas/included_file_schema.json Added version "1.0.0" and $id URI for included file schema
pkg/parser/schemas/mcp_config_schema.json Added version "1.0.0" and $id URI for MCP config schema
pkg/parser/schema.go Implemented SchemaVersion struct and public API functions (GetMainWorkflowSchemaVersion, GetIncludedFileSchemaVersion, GetMCPConfigSchemaVersion)
pkg/parser/schema_version_test.go Added comprehensive test suite with 17 test cases covering version retrieval, embedding verification, JSON parsing edge cases, and cross-schema consistency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +31 to +50
// SchemaVersion represents the version information for a schema
type SchemaVersion struct {
Version string `json:"version"`
ID string `json:"$id"`
}

// GetMainWorkflowSchemaVersion returns the version of the main workflow schema
func GetMainWorkflowSchemaVersion() (SchemaVersion, error) {
return getSchemaVersion(mainWorkflowSchema)
}

// GetIncludedFileSchemaVersion returns the version of the included file schema
func GetIncludedFileSchemaVersion() (SchemaVersion, error) {
return getSchemaVersion(includedFileSchema)
}

// GetMCPConfigSchemaVersion returns the version of the MCP config schema
func GetMCPConfigSchemaVersion() (SchemaVersion, error) {
return getSchemaVersion(mcpConfigSchema)
}
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new public API functions (GetMainWorkflowSchemaVersion(), GetIncludedFileSchemaVersion(), GetMCPConfigSchemaVersion()) lack documentation on their intended use cases and when developers should call them. Consider adding:

  1. A brief comment in schema.go explaining the purpose of schema versioning (e.g., "Schema versioning enables compatibility tracking and migration tooling")
  2. A new documentation page under docs/src/content/docs/reference/ explaining:
    • How to retrieve schema versions programmatically
    • Use cases for schema version checking (e.g., tool compatibility, migration detection)
    • Example usage scenarios

This would align with the documentation patterns found in other reference files and help external tool developers understand when and how to use these APIs.

Copilot uses AI. Check for mistakes.
@pelikhan pelikhan closed this Nov 17, 2025
@pelikhan pelikhan deleted the copilot/add-schema-versioning-infrastructure branch November 19, 2025 00:34
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.

[task] Add schema versioning infrastructure

3 participants