forked from usnistgov/metaschema
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct field and flag enumerations in JSON schemas.
Previously in usnistgov#360, @kylelaker reported a needed improvement to fix a regression for usnistgov/OSCAL#1773. While I had been completing testing in usnistgov#360 and properly expanding test coverage to address how we handle enumerations based on allow-other and target attributes for field and flag elements in Metaschema (both act similarly but subtly different with more scenarios for field), I observed my test data instances needed further correction in a way that cannot be address in the PR by Kyle. This merges the changes from the commit reffed by the URL below, adds my enhancement, tests, and all examples that helped me uncover missing code. usnistgov@6fb8a74 Co-authored-by: Kyle Laker <[email protected]>
- Loading branch information
1 parent
62ad378
commit a25c688
Showing
42 changed files
with
717 additions
and
368 deletions.
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
70 changes: 0 additions & 70 deletions
70
test-suite/metaschema-xspec/json-schema-gen/json-value_constrained-closed.json
This file was deleted.
Oops, something went wrong.
58 changes: 0 additions & 58 deletions
58
test-suite/metaschema-xspec/json-schema-gen/json-value_constrained-narrow.json
This file was deleted.
Oops, something went wrong.
70 changes: 0 additions & 70 deletions
70
test-suite/metaschema-xspec/json-schema-gen/json-value_constrained-open.json
This file was deleted.
Oops, something went wrong.
58 changes: 0 additions & 58 deletions
58
test-suite/metaschema-xspec/json-schema-gen/json-value_constrained-sortof.json
This file was deleted.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
test-suite/metaschema-xspec/json-schema-gen/json-value_field_constrained-closed.json
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,53 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "http://csrc.nist.gov/ns/metaschema-tests/0.1/json-value_field_constrained-closed-schema.json", | ||
"$comment": "JSON value testing mini metaschema: JSON Schema", | ||
"type": "object", | ||
"definitions": { | ||
"json-value_field_constrained-closed-json-value_field_constrained-closed:test-root": { | ||
"title": "Root", | ||
"description": "The root assembly of this example module.", | ||
"$id": "#assembly_json-value_field_constrained-closed_test-root", | ||
"type": "object", | ||
"properties": { | ||
"test-field": { | ||
"$ref": "#field_json-value_field_constrained-closed_test-field" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"json-value_field_constrained-closed-json-value_field_constrained-closed:test-field": { | ||
"title": "Test Field", | ||
"description": "A test field.", | ||
"$id": "#field_json-value_field_constrained-closed_test-field", | ||
"allOf": [ | ||
{ | ||
"$ref": "#/definitions/TokenDatatype" | ||
}, | ||
{ | ||
"enum": [ | ||
"one", | ||
"two", | ||
"three", | ||
"four" | ||
] | ||
} | ||
] | ||
}, | ||
"TokenDatatype": { | ||
"description": "A non-colonized name as defined by XML Schema Part 2: Datatypes Second Edition. https://www.w3.org/TR/xmlschema11-2/#NCName.", | ||
"type": "string", | ||
"pattern": "^(\\p{L}|_)(\\p{L}|\\p{N}|[.\\-_])*$" | ||
} | ||
}, | ||
"properties": { | ||
"test-root": { | ||
"$ref": "#assembly_json-value_field_constrained-closed_test-root" | ||
} | ||
}, | ||
"required": [ | ||
"test-root" | ||
], | ||
"additionalProperties": false, | ||
"maxProperties": 1 | ||
} |
Oops, something went wrong.