-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add commands for generating and comparing JSON schemas #90
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9b61803
feat: add schemas:generate command
mdonnalley d7315c0
fix: compilation errors
mdonnalley 5c07765
chore: cleanup
mdonnalley 5e576ff
feat: add schemas:compare
mdonnalley c03eef6
test: fix some tests
mdonnalley 689091a
fix: failing tests and compliation errors
mdonnalley 484ec78
test: add fancy tests for schema commands
mdonnalley 2d2034b
fix: normalize file paths
mdonnalley d10bda5
test: fix paths for windows tests
mdonnalley 1b70a30
test: increase timeout
mdonnalley 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
This file contains 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 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 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,41 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$ref": "#/definitions/SchemaComparison", | ||
"definitions": { | ||
"SchemaComparison": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"op": { | ||
"$ref": "#/definitions/Operation" | ||
}, | ||
"path": { | ||
"type": "array", | ||
"items": { | ||
"type": [ | ||
"string", | ||
"number" | ||
] | ||
} | ||
}, | ||
"value": {} | ||
}, | ||
"required": [ | ||
"op", | ||
"path", | ||
"value" | ||
], | ||
"additionalProperties": false | ||
} | ||
}, | ||
"Operation": { | ||
"type": "string", | ||
"enum": [ | ||
"add", | ||
"replace", | ||
"remove" | ||
] | ||
} | ||
} | ||
} |
This file contains 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,279 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$ref": "#/definitions/SchemasMap", | ||
"definitions": { | ||
"SchemasMap": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"$ref": "#/definitions/Schema" | ||
} | ||
}, | ||
"Schema": { | ||
"$ref": "#/definitions/JSONSchema7" | ||
}, | ||
"JSONSchema7": { | ||
"type": "object", | ||
"properties": { | ||
"$id": { | ||
"type": "string" | ||
}, | ||
"$ref": { | ||
"type": "string" | ||
}, | ||
"$schema": { | ||
"$ref": "#/definitions/JSONSchema7Version" | ||
}, | ||
"$comment": { | ||
"type": "string" | ||
}, | ||
"type": { | ||
"anyOf": [ | ||
{ | ||
"$ref": "#/definitions/JSONSchema7TypeName" | ||
}, | ||
{ | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/JSONSchema7TypeName" | ||
} | ||
} | ||
] | ||
}, | ||
"enum": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/JSONSchema7Type" | ||
} | ||
}, | ||
"const": { | ||
"$ref": "#/definitions/JSONSchema7Type" | ||
}, | ||
"multipleOf": { | ||
"type": "number" | ||
}, | ||
"maximum": { | ||
"type": "number" | ||
}, | ||
"exclusiveMaximum": { | ||
"type": "number" | ||
}, | ||
"minimum": { | ||
"type": "number" | ||
}, | ||
"exclusiveMinimum": { | ||
"type": "number" | ||
}, | ||
"maxLength": { | ||
"type": "number" | ||
}, | ||
"minLength": { | ||
"type": "number" | ||
}, | ||
"pattern": { | ||
"type": "string" | ||
}, | ||
"items": { | ||
"anyOf": [ | ||
{ | ||
"$ref": "#/definitions/JSONSchema7Definition" | ||
}, | ||
{ | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/JSONSchema7Definition" | ||
} | ||
} | ||
] | ||
}, | ||
"additionalItems": { | ||
"$ref": "#/definitions/JSONSchema7Definition" | ||
}, | ||
"maxItems": { | ||
"type": "number" | ||
}, | ||
"minItems": { | ||
"type": "number" | ||
}, | ||
"uniqueItems": { | ||
"type": "boolean" | ||
}, | ||
"contains": { | ||
"$ref": "#/definitions/JSONSchema7" | ||
}, | ||
"maxProperties": { | ||
"type": "number" | ||
}, | ||
"minProperties": { | ||
"type": "number" | ||
}, | ||
"required": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"properties": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"$ref": "#/definitions/JSONSchema7Definition" | ||
} | ||
}, | ||
"patternProperties": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"$ref": "#/definitions/JSONSchema7Definition" | ||
} | ||
}, | ||
"additionalProperties": { | ||
"$ref": "#/definitions/JSONSchema7Definition" | ||
}, | ||
"dependencies": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"anyOf": [ | ||
{ | ||
"$ref": "#/definitions/JSONSchema7Definition" | ||
}, | ||
{ | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"propertyNames": { | ||
"$ref": "#/definitions/JSONSchema7Definition" | ||
}, | ||
"if": { | ||
"$ref": "#/definitions/JSONSchema7Definition" | ||
}, | ||
"then": { | ||
"$ref": "#/definitions/JSONSchema7Definition" | ||
}, | ||
"else": { | ||
"$ref": "#/definitions/JSONSchema7Definition" | ||
}, | ||
"allOf": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/JSONSchema7Definition" | ||
} | ||
}, | ||
"anyOf": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/JSONSchema7Definition" | ||
} | ||
}, | ||
"oneOf": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/JSONSchema7Definition" | ||
} | ||
}, | ||
"not": { | ||
"$ref": "#/definitions/JSONSchema7Definition" | ||
}, | ||
"format": { | ||
"type": "string" | ||
}, | ||
"contentMediaType": { | ||
"type": "string" | ||
}, | ||
"contentEncoding": { | ||
"type": "string" | ||
}, | ||
"definitions": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"$ref": "#/definitions/JSONSchema7Definition" | ||
} | ||
}, | ||
"title": { | ||
"type": "string" | ||
}, | ||
"description": { | ||
"type": "string" | ||
}, | ||
"default": { | ||
"$ref": "#/definitions/JSONSchema7Type" | ||
}, | ||
"readOnly": { | ||
"type": "boolean" | ||
}, | ||
"writeOnly": { | ||
"type": "boolean" | ||
}, | ||
"examples": { | ||
"$ref": "#/definitions/JSONSchema7Type" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"JSONSchema7Version": { | ||
"type": "string", | ||
"description": "Meta schema\n\nRecommended values:\n- 'http://json-schema.org/schema#'\n- 'http://json-schema.org/hyper-schema#'\n- 'http://json-schema.org/draft-07/schema#'\n- 'http://json-schema.org/draft-07/hyper-schema#'" | ||
}, | ||
"JSONSchema7TypeName": { | ||
"type": "string", | ||
"enum": [ | ||
"string", | ||
"number", | ||
"integer", | ||
"boolean", | ||
"object", | ||
"array", | ||
"null" | ||
], | ||
"description": "Primitive type" | ||
}, | ||
"JSONSchema7Type": { | ||
"anyOf": [ | ||
{ | ||
"type": "string" | ||
}, | ||
{ | ||
"type": "number" | ||
}, | ||
{ | ||
"type": "boolean" | ||
}, | ||
{ | ||
"$ref": "#/definitions/JSONSchema7Object" | ||
}, | ||
{ | ||
"$ref": "#/definitions/JSONSchema7Array" | ||
}, | ||
{ | ||
"type": "null" | ||
} | ||
], | ||
"description": "Primitive type" | ||
}, | ||
"JSONSchema7Object": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"$ref": "#/definitions/JSONSchema7Type" | ||
} | ||
}, | ||
"JSONSchema7Array": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/JSONSchema7Type" | ||
} | ||
}, | ||
"JSONSchema7Definition": { | ||
"anyOf": [ | ||
{ | ||
"$ref": "#/definitions/JSONSchema7" | ||
}, | ||
{ | ||
"type": "boolean" | ||
} | ||
], | ||
"description": "JSON Schema v7" | ||
} | ||
} | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it useful to have this be the output? What if it was just an array of output files or something like that?