forked from usnistgov/metaschema
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start at modeling out tests for JSON Schema provision of enumerated v…
…alue constraints (where possible) usnistgov#240
- Loading branch information
1 parent
c7b3733
commit 0c6d0fa
Showing
11 changed files
with
663 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
test-suite/metaschema-xspec/json-schema-gen/json-schema-gen.xspec
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,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- autogenerated 2021-12-14T16:02:57.305-05:00 following model in example-set.xspec--> | ||
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" | ||
xmlns="http://csrc.nist.gov/ns/oscal/metaschema/1.0" | ||
stylesheet="" | ||
run-as="external" | ||
xmlns:ov="http://csrc.nist.gov/ns/oscal/test/variable"> | ||
|
||
<!-- <x:helper stylesheet=" ... composer ... "/> --> | ||
<!-- old tests are out of whack need update to current functionality /spec --> | ||
<!-- but the XSpec provides a functional model --> | ||
|
||
<!--<x:scenario label="Base test"> | ||
<!-\- Alternative model for test scrubbing both the result and the expected | ||
result for comparison -\-> | ||
<x:context href="profile-resolution-examples/base-test_profile.xml"/> | ||
<x:variable name="ov:expected-output" | ||
href="profile-resolution-examples/output-expected/base-test_profile_RESOLVED.xml"/> | ||
<x:expect label="Base test - fully resolved" | ||
test="opr:scrub($x:result)" select="opr:scrub($ov:expected-output)"/> | ||
</x:scenario>--> | ||
|
||
</x:description> |
116 changes: 116 additions & 0 deletions
116
...-suite/metaschema-xspec/json-schema-gen/json-value-testing-mini-jsonschema-CORRECTED.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,116 @@ | ||
{ "$schema" : "http://json-schema.org/draft-07/schema#", | ||
"$id" : "http://csrc.nist.gov/ns/oscal/0.1/oscal-value-testing-mini-schema.json", | ||
"$comment" : "JSON value testing mini metaschema: JSON Schema", | ||
"type" : "object", | ||
"definitions" : | ||
{ "oscal-value-testing-mini-oscal-value-testing-mini:root" : | ||
{ "title" : "Root", | ||
"description" : "Root root root.", | ||
"$id" : "#assembly_oscal-value-testing-mini_root", | ||
"type" : "object", | ||
"properties" : | ||
{ "unconstrained" : | ||
{ "$ref" : "#field_oscal-value-testing-mini_unconstrained" }, | ||
"constrained-open" : | ||
{ "$ref" : "#field_oscal-value-testing-mini_constrained-open" }, | ||
"constrained-closed" : | ||
{ "$ref" : "#field_oscal-value-testing-mini_constrained-closed" }, | ||
"constrained-narrow" : | ||
{ "$ref" : "#field_oscal-value-testing-mini_constrained-narrow" }, | ||
"constrained-sortof" : | ||
{ "$ref" : "#field_oscal-value-testing-mini_constrained-sortof" } }, | ||
"additionalProperties" : false }, | ||
"oscal-value-testing-mini-oscal-value-testing-mini:unconstrained" : | ||
{ "title" : "Unconstrained", | ||
"description" : "A field whose value is constrained only by its nominal datatype, 'token'.", | ||
"$id" : "#field_oscal-value-testing-mini_unconstrained", | ||
"type" : "object", | ||
"properties" : | ||
{ "some" : | ||
{ "title" : "Some Flag", | ||
"description" : "Some flag some flag some flag.", | ||
"$ref" : "#/definitions/StringDatatype" }, | ||
"token-value" : | ||
{ "type" : "string" } }, | ||
"required" : | ||
[ "token-value" ], | ||
"additionalProperties" : false }, | ||
"oscal-value-testing-mini-oscal-value-testing-mini:constrained-open" : | ||
{ "title" : "Constrained open", | ||
"description" : "Because allow-other is 'yes' no enumeration can be given in the JSON Schema.", | ||
"$id" : "#field_oscal-value-testing-mini_constrained-open", | ||
"type" : "object", | ||
"properties" : | ||
{ "some" : | ||
{ "title" : "Some Flag", | ||
"description" : "Some flag some flag some flag.", | ||
"$ref" : "#/definitions/StringDatatype" }, | ||
"token-value" : | ||
{ "type" : "string" } }, | ||
"required" : | ||
[ "token-value" ], | ||
"additionalProperties" : false }, | ||
"oscal-value-testing-mini-oscal-value-testing-mini:constrained-closed" : | ||
{ "title" : "Constrained closed", | ||
"description" : "Because allow-other is 'no' an enumeration can be given in the JSON Schema.", | ||
"$id" : "#field_oscal-value-testing-mini_constrained-closed", | ||
"type" : "object", | ||
"properties" : | ||
{ "some" : | ||
{ "title" : "Some Flag", | ||
"description" : "Some flag some flag some flag.", | ||
"$ref" : "#/definitions/StringDatatype" }, | ||
"token-value" : | ||
{ "type" : "string", | ||
"enum" : | ||
[ "one", | ||
"two", | ||
"three", | ||
"four" ] } }, | ||
"required" : | ||
[ "token-value" ], | ||
"additionalProperties" : false | ||
}, | ||
"oscal-value-testing-mini-oscal-value-testing-mini:constrained-narrow" : | ||
{ "title" : "Constrained narrow", | ||
"description" : "Although allow-other is 'no' an enumeration can't be given in the JSON Schema since it targets a qualified set (only a subset) of the elements in scope.", | ||
"$id" : "#field_oscal-value-testing-mini_constrained-narrow", | ||
"type" : "object", | ||
"properties" : | ||
{ "some" : | ||
{ "title" : "Some Flag", | ||
"description" : "Some flag some flag some flag.", | ||
"$ref" : "#/definitions/StringDatatype" }, | ||
"token-value" : | ||
{ "type" : "string" } }, | ||
"required" : | ||
[ "token-value" ], | ||
"additionalProperties" : false }, | ||
"oscal-value-testing-mini-oscal-value-testing-mini:constrained-sortof" : | ||
{ "title" : "Constrained, sort of", | ||
"description" : "Although allow-other is 'no' an enumeration can't be given in the JSON Schema since it targets a qualified set (only a subset) of the elements in scope.", | ||
"$id" : "#field_oscal-value-testing-mini_constrained-sortof", | ||
"type" : "object", | ||
"properties" : | ||
{ "some" : | ||
{ "title" : "Some Flag", | ||
"description" : "Some flag some flag some flag.", | ||
"$ref" : "#/definitions/StringDatatype" }, | ||
"token-value" : | ||
{ "type" : "string" } }, | ||
"required" : | ||
[ "token-value" ], | ||
"additionalProperties" : false }, | ||
"StringDatatype" : | ||
{ "type" : "string", | ||
"pattern" : "^\\S(.*\\S)?$" }, | ||
"TokenDatatype" : | ||
{ "type" : "string", | ||
"pattern" : "^(\\p{L}|_)(\\p{L}|\\p{N}|[.\\-_])*$" } }, | ||
"properties" : | ||
{ "root" : | ||
{ "$ref" : "#assembly_oscal-value-testing-mini_root" } }, | ||
"required" : | ||
[ "root" ], | ||
"additionalProperties" : false, | ||
"maxProperties" : 1 } |
112 changes: 112 additions & 0 deletions
112
...suite/metaschema-xspec/json-schema-gen/json-value-testing-mini-jsonschema-CORRECTED2.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,112 @@ | ||
{ "$schema" : "http://json-schema.org/draft-07/schema#", | ||
"$id" : "http://csrc.nist.gov/ns/oscal/0.1/oscal-value-testing-mini-schema.json", | ||
"$comment" : "JSON value testing mini metaschema: JSON Schema", | ||
"type" : "object", | ||
"definitions" : | ||
{ "oscal-value-testing-mini-oscal-value-testing-mini:root" : | ||
{ "title" : "Root", | ||
"description" : "Root root root.", | ||
"$id" : "#assembly_oscal-value-testing-mini_root", | ||
"type" : "object", | ||
"properties" : | ||
{ "unconstrained" : | ||
{ "$ref" : "#field_oscal-value-testing-mini_unconstrained" }, | ||
"constrained-open" : | ||
{ "$ref" : "#field_oscal-value-testing-mini_constrained-open" }, | ||
"constrained-closed" : | ||
{ "$ref" : "#field_oscal-value-testing-mini_constrained-closed" }, | ||
"constrained-narrow" : | ||
{ "$ref" : "#field_oscal-value-testing-mini_constrained-narrow" }, | ||
"constrained-sortof" : | ||
{ "$ref" : "#field_oscal-value-testing-mini_constrained-sortof" } }, | ||
"additionalProperties" : false }, | ||
"oscal-value-testing-mini-oscal-value-testing-mini:unconstrained" : | ||
{ "title" : "Unconstrained", | ||
"description" : "A field whose value is constrained only by its nominal datatype, 'token'.", | ||
"$id" : "#field_oscal-value-testing-mini_unconstrained", | ||
"type" : "object", | ||
"properties" : | ||
{ "some" : | ||
{ "title" : "Some Flag", | ||
"description" : "Some flag some flag some flag.", | ||
"$ref" : "#/definitions/StringDatatype" }, | ||
"token-value" : | ||
{ "$ref" : "#/definitions/TokenDatatype" | ||
} }, | ||
"required" : | ||
[ "token-value" ], | ||
"additionalProperties" : false }, | ||
"oscal-value-testing-mini-oscal-value-testing-mini:constrained-open" : | ||
{ "title" : "Constrained open", | ||
"description" : "Because allow-other is 'yes' no enumeration can be given in the JSON Schema.", | ||
"$id" : "#field_oscal-value-testing-mini_constrained-open", | ||
"type" : "object", | ||
"properties" : | ||
{ "some" : | ||
{ "title" : "Some Flag", | ||
"description" : "Some flag some flag some flag.", | ||
"$ref" : "#/definitions/StringDatatype" }, | ||
"token-value" : | ||
{ "$ref" : "#/definitions/TokenDatatype" } }, | ||
"required" : | ||
[ "token-value" ], | ||
"additionalProperties" : false }, | ||
"oscal-value-testing-mini-oscal-value-testing-mini:constrained-closed" : | ||
{ "title" : "Constrained closed", | ||
"description" : "Because allow-other is 'no' an enumeration can be given in the JSON Schema.", | ||
"$id" : "#field_oscal-value-testing-mini_constrained-closed", | ||
"type" : "object", | ||
"properties" : | ||
{ "some" : | ||
{ "title" : "Some Flag", | ||
"description" : "Some flag some flag some flag.", | ||
"$ref" : "#/definitions/StringDatatype" }, | ||
"token-value" : | ||
{ "$ref" : "#/definitions/TokenDatatype" } }, | ||
"required" : | ||
[ "token-value" ], | ||
"additionalProperties" : false | ||
}, | ||
"oscal-value-testing-mini-oscal-value-testing-mini:constrained-narrow" : | ||
{ "title" : "Constrained narrow", | ||
"description" : "Although allow-other is 'no' an enumeration can't be given in the JSON Schema since it targets a qualified set (only a subset) of the elements in scope.", | ||
"$id" : "#field_oscal-value-testing-mini_constrained-narrow", | ||
"type" : "object", | ||
"properties" : | ||
{ "some" : | ||
{ "title" : "Some Flag", | ||
"description" : "Some flag some flag some flag.", | ||
"$ref" : "#/definitions/StringDatatype" }, | ||
"token-value" : | ||
{ "$ref" : "#/definitions/TokenDatatype" } }, | ||
"required" : | ||
[ "token-value" ], | ||
"additionalProperties" : false }, | ||
"oscal-value-testing-mini-oscal-value-testing-mini:constrained-sortof" : | ||
{ "title" : "Constrained, sort of", | ||
"description" : "Although allow-other is 'no' an enumeration can't be given in the JSON Schema since it targets a qualified set (only a subset) of the elements in scope.", | ||
"$id" : "#field_oscal-value-testing-mini_constrained-sortof", | ||
"type" : "object", | ||
"properties" : | ||
{ "some" : | ||
{ "title" : "Some Flag", | ||
"description" : "Some flag some flag some flag.", | ||
"$ref" : "#/definitions/StringDatatype" }, | ||
"token-value" : | ||
{ "type" : "string" } }, | ||
"required" : | ||
[ "token-value" ], | ||
"additionalProperties" : false }, | ||
"StringDatatype" : | ||
{ "type" : "string", | ||
"pattern" : "^\\S(.*\\S)?$" }, | ||
"TokenDatatype" : | ||
{ "type" : "string", | ||
"pattern" : "^(\\p{L}|_)(\\p{L}|\\p{N}|[.\\-_])*$" } }, | ||
"properties" : | ||
{ "root" : | ||
{ "$ref" : "#assembly_oscal-value-testing-mini_root" } }, | ||
"required" : | ||
[ "root" ], | ||
"additionalProperties" : false, | ||
"maxProperties" : 1 } |
126 changes: 126 additions & 0 deletions
126
test-suite/metaschema-xspec/json-schema-gen/json-value-testing-mini-jsonschema.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,126 @@ | ||
|
||
{ "$schema" : "http://json-schema.org/draft-07/schema#", | ||
"$id" : "http://csrc.nist.gov/ns/oscal/0.1/oscal-value-testing-mini-schema.json", | ||
"$comment" : "JSON value testing mini metaschema: JSON Schema", | ||
"type" : "object", | ||
"definitions" : | ||
{ "oscal-value-testing-mini-oscal-value-testing-mini:root" : | ||
{ "title" : "Root", | ||
"description" : "Root root root.", | ||
"$id" : "#assembly_oscal-value-testing-mini_root", | ||
"type" : "object", | ||
"properties" : | ||
{ "unconstrained" : | ||
{ "$ref" : "#field_oscal-value-testing-mini_unconstrained" }, | ||
"constrained-open" : | ||
{ "$ref" : "#field_oscal-value-testing-mini_constrained-open" }, | ||
"constrained-closed" : | ||
{ "$ref" : "#field_oscal-value-testing-mini_constrained-closed" }, | ||
"constrained-narrow" : | ||
{ "$ref" : "#field_oscal-value-testing-mini_constrained-narrow" }, | ||
"constrained-sortof" : | ||
{ "$ref" : "#field_oscal-value-testing-mini_constrained-sortof" } }, | ||
"additionalProperties" : false }, | ||
"oscal-value-testing-mini-oscal-value-testing-mini:unconstrained" : | ||
{ "title" : "Unconstrained", | ||
"description" : "A field whose value is constrained only by its nominal datatype, 'token'.", | ||
"$id" : "#field_oscal-value-testing-mini_unconstrained", | ||
"type" : "object", | ||
"properties" : | ||
{ "some" : | ||
{ "title" : "Some Flag", | ||
"description" : "Some flag some flag some flag.", | ||
"$ref" : "#/definitions/StringDatatype" }, | ||
"token-value" : | ||
{ "type" : "string" } }, | ||
"required" : | ||
[ "token-value" ], | ||
"additionalProperties" : false }, | ||
"oscal-value-testing-mini-oscal-value-testing-mini:constrained-open" : | ||
{ "title" : "Constrained open", | ||
"description" : "Because allow-other is 'yes' no enumeration can be given in the JSON Schema.", | ||
"$id" : "#field_oscal-value-testing-mini_constrained-open", | ||
"type" : "object", | ||
"properties" : | ||
{ "some" : | ||
{ "title" : "Some Flag", | ||
"description" : "Some flag some flag some flag.", | ||
"$ref" : "#/definitions/StringDatatype" }, | ||
"token-value" : | ||
{ "type" : "string" } }, | ||
"required" : | ||
[ "token-value" ], | ||
"additionalProperties" : false }, | ||
"oscal-value-testing-mini-oscal-value-testing-mini:constrained-closed" : | ||
{ "title" : "Constrained closed", | ||
"description" : "Because allow-other is 'no' an enumeration can be given in the JSON Schema.", | ||
"$id" : "#field_oscal-value-testing-mini_constrained-closed", | ||
"type" : "object", | ||
"properties" : | ||
{ "some" : | ||
{ "title" : "Some Flag", | ||
"description" : "Some flag some flag some flag.", | ||
"$ref" : "#/definitions/StringDatatype" }, | ||
"token-value" : | ||
{ "type" : "string" } }, | ||
"required" : | ||
[ "token-value" ], | ||
"additionalProperties" : false, | ||
"enum" : | ||
[ "one", | ||
"two", | ||
"three", | ||
"four" ] }, | ||
"oscal-value-testing-mini-oscal-value-testing-mini:constrained-narrow" : | ||
{ "title" : "Constrained narrow", | ||
"description" : "Although allow-other is 'no' an enumeration can't be given in the JSON Schema since it targets a qualified set (only a subset) of the elements in scope.", | ||
"$id" : "#field_oscal-value-testing-mini_constrained-narrow", | ||
"type" : "object", | ||
"properties" : | ||
{ "some" : | ||
{ "title" : "Some Flag", | ||
"description" : "Some flag some flag some flag.", | ||
"$ref" : "#/definitions/StringDatatype" }, | ||
"token-value" : | ||
{ "type" : "string" } }, | ||
"required" : | ||
[ "token-value" ], | ||
"additionalProperties" : false, | ||
"enum" : | ||
[ "one", | ||
"two", | ||
"three", | ||
"four" ] }, | ||
"oscal-value-testing-mini-oscal-value-testing-mini:constrained-sortof" : | ||
{ "title" : "Constrained, sort of", | ||
"description" : "Although allow-other is 'no' an enumeration can't be given in the JSON Schema since it targets a qualified set (only a subset) of the elements in scope.", | ||
"$id" : "#field_oscal-value-testing-mini_constrained-sortof", | ||
"type" : "object", | ||
"properties" : | ||
{ "some" : | ||
{ "title" : "Some Flag", | ||
"description" : "Some flag some flag some flag.", | ||
"$ref" : "#/definitions/StringDatatype" }, | ||
"token-value" : | ||
{ "type" : "string" } }, | ||
"required" : | ||
[ "token-value" ], | ||
"additionalProperties" : false, | ||
"enum" : | ||
[ "one", | ||
"two", | ||
"three", | ||
"four" ] }, | ||
"StringDatatype" : | ||
{ "type" : "string", | ||
"pattern" : "^\\S(.*\\S)?$" }, | ||
"TokenDatatype" : | ||
{ "type" : "string", | ||
"pattern" : "^(\\p{L}|_)(\\p{L}|\\p{N}|[.\\-_])*$" } }, | ||
"properties" : | ||
{ "root" : | ||
{ "$ref" : "#assembly_oscal-value-testing-mini_root" } }, | ||
"required" : | ||
[ "root" ], | ||
"additionalProperties" : false, | ||
"maxProperties" : 1 } |
Oops, something went wrong.