Add schema versioning infrastructure with v1.0.0#4169
Conversation
- 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>
There was a problem hiding this comment.
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 (
versionand$id) to all three JSON schema files - Created a
SchemaVersionstruct 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.
| // 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) | ||
| } |
There was a problem hiding this comment.
The new public API functions (GetMainWorkflowSchemaVersion(), GetIncludedFileSchemaVersion(), GetMCPConfigSchemaVersion()) lack documentation on their intended use cases and when developers should call them. Consider adding:
- A brief comment in
schema.goexplaining the purpose of schema versioning (e.g., "Schema versioning enables compatibility tracking and migration tooling") - 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.
Adds semantic versioning to JSON schemas to enable programmatic compatibility tracking and automated migration tooling.
Changes
Schema Files
version: "1.0.0"and$idURI to all three schemas:main_workflow_schema.json→https://github.com/githubnext/gh-aw/schemas/workflow/v1.0.0included_file_schema.json→https://github.com/githubnext/gh-aw/schemas/included-file/v1.0.0mcp_config_schema.json→https://github.com/githubnext/gh-aw/schemas/mcp-config/v1.0.0Parser API
SchemaVersionstruct withVersionandIDfieldsGetMainWorkflowSchemaVersion()GetIncludedFileSchemaVersion()GetMCPConfigSchemaVersion()Tests
schema_version_test.gowith 17 test cases covering:Usage
Enables future schema evolution tracking and automated migration tools.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.