-
Notifications
You must be signed in to change notification settings - Fork 6
[wip] bump gts-spec, implement op12 and op13 #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2b124d9
chore: bump gts-spec
mattgarmon d41ab52
feat: support combined anonymous instance identifiers
mattgarmon 9450934
feat: support x-gts-ref combinators (oneOf/anyOf/allOf)
mattgarmon 4c3ff92
feat: op12 and op13 - schema and entity validation
mattgarmon 172c2cd
fix: address review comments
mattgarmon b287a76
feat: unit tests for op12 and op13
mattgarmon e4465b1
fix: op12 and op13 implementation updates
mattgarmon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule .gts-spec
updated
53 files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /* | ||
| Copyright © 2025 Global Type System | ||
| Released under Apache License 2.0 | ||
| */ | ||
|
|
||
| package main | ||
|
|
||
| var cmdValidateEntity = &Command{ | ||
| UsageLine: "validate-entity -id <gts-id>", | ||
| Short: "validate any entity (schema or instance) including traits", | ||
| Long: ` | ||
| ValidateEntity validates any GTS entity by its ID. | ||
|
|
||
| For schemas: runs OP#12 chain validation and OP#13 traits validation. | ||
| For instances: validates the instance against its schema. | ||
|
|
||
| The -id flag specifies the GTS entity ID to validate. | ||
| Requires -path to be set to load entities. | ||
|
|
||
| Example: | ||
|
|
||
| gts -path ./examples validate-entity -id gts.vendor.pkg.ns.base.v1~derived.v1~ | ||
| gts -path ./examples validate-entity -id gts.vendor.pkg.ns.type.v1.0 | ||
| `, | ||
| } | ||
|
|
||
| var validateEntityID string | ||
|
|
||
| func init() { | ||
| cmdValidateEntity.Run = runValidateEntity | ||
| cmdValidateEntity.Flag.StringVar(&validateEntityID, "id", "", "GTS entity ID to validate") | ||
| } | ||
|
|
||
| func runValidateEntity(cmd *Command, args []string) { | ||
| if validateEntityID == "" { | ||
| cmd.Usage() | ||
| return | ||
| } | ||
|
|
||
| store := newStore() | ||
| result := store.ValidateEntity(validateEntityID) | ||
| writeJSON(result) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /* | ||
| Copyright © 2025 Global Type System | ||
| Released under Apache License 2.0 | ||
| */ | ||
|
|
||
| package main | ||
|
|
||
| var cmdValidateSchema = &Command{ | ||
| UsageLine: "validate-schema -id <gts-id>", | ||
| Short: "validate a derived schema against its chain", | ||
| Long: ` | ||
| ValidateSchema checks that a derived schema only tightens, never loosens, | ||
| the constraints defined by its base schema(s). | ||
|
|
||
| The -id flag specifies the chained GTS schema ID to validate. | ||
| Requires -path to be set to load entities. | ||
|
|
||
| Example: | ||
|
|
||
| gts -path ./examples validate-schema -id gts.vendor.pkg.ns.base.v1~derived.v1~ | ||
| `, | ||
| } | ||
|
|
||
| var validateSchemaID string | ||
|
|
||
| func init() { | ||
| cmdValidateSchema.Run = runValidateSchema | ||
| cmdValidateSchema.Flag.StringVar(&validateSchemaID, "id", "", "chained GTS schema ID to validate") | ||
| } | ||
|
|
||
| func runValidateSchema(cmd *Command, args []string) { | ||
| if validateSchemaID == "" { | ||
| cmd.Usage() | ||
| return | ||
| } | ||
|
|
||
| store := newStore() | ||
| result := store.ValidateSchemaChain(validateSchemaID) | ||
| writeJSON(result) | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.