Skip to content

Commit

Permalink
Standardize module shape and add example data.
Browse files Browse the repository at this point in the history
  • Loading branch information
aj-stein-nist committed Jun 15, 2023
1 parent 11b4c98 commit da250ae
Show file tree
Hide file tree
Showing 36 changed files with 328 additions and 323 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,35 @@
"$comment": "JSON value testing mini metaschema: JSON Schema",
"type": "object",
"definitions": {
"json-value_field_constrained-closed-json-value_field_constrained-closed:root": {
"json-value_field_constrained-closed-json-value_field_constrained-closed:test-root": {
"title": "Root",
"description": "Root root root.",
"$id": "#assembly_json-value_field_constrained-closed_root",
"description": "The root assembly of this example module.",
"$id": "#assembly_json-value_field_constrained-closed_test-root",
"type": "object",
"properties": {
"constrained-closed": {
"$ref": "#field_json-value_field_constrained-closed_constrained-closed"
"test-field": {
"$ref": "#field_json-value_field_constrained-closed_test-field"
}
},
"additionalProperties": false
},
"json-value_field_constrained-closed-json-value_field_constrained-closed:constrained-closed": {
"title": "Constrained closed",
"description": "Because allow-other is 'no' an enumeration can be given in the JSON Schema.",
"$id": "#field_json-value_field_constrained-closed_constrained-closed",
"type": "object",
"properties": {
"some": {
"title": "Some Flag",
"description": "Some flag some flag some flag.",
"$ref": "#/definitions/StringDatatype"
"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"
},
"token-value": {
"allOf": [
{
"$ref": "#/definitions/TokenDatatype"
},
{
"enum": [
"one",
"two",
"three",
"four"
]
}
{
"enum": [
"one",
"two",
"three",
"four"
]
}
},
"required": [
"token-value"
],
"additionalProperties": false
},
"StringDatatype": {
"description": "A non-empty string with leading and trailing whitespace disallowed. Whitespace is: U+9, U+10, U+32 or [ \n\t]+",
"type": "string",
"pattern": "^\\S(.*\\S)?$"
]
},
"TokenDatatype": {
"description": "A non-colonized name as defined by XML Schema Part 2: Datatypes Second Edition. https://www.w3.org/TR/xmlschema11-2/#NCName.",
Expand All @@ -60,12 +41,12 @@
}
},
"properties": {
"root": {
"$ref": "#assembly_json-value_field_constrained-closed_root"
"test-root": {
"$ref": "#assembly_json-value_field_constrained-closed_test-root"
}
},
"required": [
"root"
"test-root"
],
"additionalProperties": false,
"maxProperties": 1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"test-root": {
"test-field": "anything"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"test-root": {
"test-field": "four"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,20 @@
<short-name>json-value_field_constrained-closed</short-name>
<namespace>http://csrc.nist.gov/ns/metaschema-tests/1.0</namespace>
<json-base-uri>http://csrc.nist.gov/ns/metaschema-tests</json-base-uri>
<define-assembly name="root">
<define-assembly name="test-root">
<formal-name>Root</formal-name>
<description>Root root root.</description>
<root-name>root</root-name>
<description>The root assembly of this example module.</description>
<root-name>test-root</root-name>
<model>
<field ref="constrained-closed"/>
<field ref="test-field"/>
</model>
</define-assembly>
<define-field
as-type="token"
name="constrained-closed">
<formal-name>Constrained closed</formal-name>
<description>Because allow-other is 'no' an enumeration can be given in the JSON Schema.</description>
<json-value-key>token-value</json-value-key>
<define-flag name="some">
<formal-name>Some Flag</formal-name>
<description>Some flag some flag some flag.</description>
</define-flag>
name="test-field">
<formal-name>Test Field</formal-name>
<description>A test field.</description>
<json-value-key>test-json-key-value</json-value-key>
<constraint>
<allowed-values target="." allow-other="no">
<enum value="one"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,23 @@
"$comment": "JSON value testing mini metaschema: JSON Schema",
"type": "object",
"definitions": {
"json-value_field_constrained-narrow-json-value_field_constrained-narrow:root": {
"json-value_field_constrained-narrow-json-value_field_constrained-narrow:test-root": {
"title": "Root",
"description": "Root root root.",
"$id": "#assembly_json-value_field_constrained-narrow_root",
"description": "The root assembly of this example module.",
"$id": "#assembly_json-value_field_constrained-narrow_test-root",
"type": "object",
"properties": {
"constrained-narrow": {
"$ref": "#field_json-value_field_constrained-narrow_constrained-narrow"
"test-field": {
"$ref": "#field_json-value_field_constrained-narrow_test-field"
}
},
"additionalProperties": false
},
"json-value_field_constrained-narrow-json-value_field_constrained-narrow: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_json-value_field_constrained-narrow_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
},
"StringDatatype": {
"description": "A non-empty string with leading and trailing whitespace disallowed. Whitespace is: U+9, U+10, U+32 or [ \n\t]+",
"type": "string",
"pattern": "^\\S(.*\\S)?$"
"json-value_field_constrained-narrow-json-value_field_constrained-narrow:test-field": {
"title": "Test Field",
"description": "A test field.",
"$id": "#field_json-value_field_constrained-narrow_test-field",
"$ref": "#/definitions/TokenDatatype"
},
"TokenDatatype": {
"description": "A non-colonized name as defined by XML Schema Part 2: Datatypes Second Edition. https://www.w3.org/TR/xmlschema11-2/#NCName.",
Expand All @@ -48,12 +29,12 @@
}
},
"properties": {
"root": {
"$ref": "#assembly_json-value_field_constrained-narrow_root"
"test-root": {
"$ref": "#assembly_json-value_field_constrained-narrow_test-root"
}
},
"required": [
"root"
"test-root"
],
"additionalProperties": false,
"maxProperties": 1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"test-root": {
"test-field": false
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"test-root": {
"test-field": "anything"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"test-root": {
"test-field": "three"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,20 @@
<short-name>json-value_field_constrained-narrow</short-name>
<namespace>http://csrc.nist.gov/ns/metaschema-tests/1.0</namespace>
<json-base-uri>http://csrc.nist.gov/ns/metaschema-tests</json-base-uri>
<define-assembly name="root">
<define-assembly name="test-root">
<formal-name>Root</formal-name>
<description>Root root root.</description>
<root-name>root</root-name>
<description>The root assembly of this example module.</description>
<root-name>test-root</root-name>
<model>
<field ref="constrained-narrow"/>
<field ref="test-field"/>
</model>
</define-assembly>

<define-field
as-type="token"
name="constrained-narrow">
<formal-name>Constrained narrow</formal-name>
<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.</description>
<json-value-key>token-value</json-value-key>
<define-flag name="some">
<formal-name>Some Flag</formal-name>
<description>Some flag some flag some flag.</description>
</define-flag>
name="test-field">
<formal-name>Test Field</formal-name>
<description>A test field.</description>
<json-value-key>test-json-key-value</json-value-key>
<constraint>
<allowed-values target=".[not(false())]" allow-other="no">
<enum value="one"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,35 @@
"$comment": "JSON value testing mini metaschema: JSON Schema",
"type": "object",
"definitions": {
"json-value_field_constrained-open-json-value_field_constrained-open:root": {
"json-value_field_constrained-open-json-value_field_constrained-open:test-root": {
"title": "Root",
"description": "Root root root.",
"$id": "#assembly_json-value_field_constrained-open_root",
"description": "The root assembly of this example module.",
"$id": "#assembly_json-value_field_constrained-open_test-root",
"type": "object",
"properties": {
"constrained-open": {
"$ref": "#field_json-value_field_constrained-open_constrained-open"
"test-field": {
"$ref": "#field_json-value_field_constrained-open_test-field"
}
},
"additionalProperties": false
},
"json-value_field_constrained-open-json-value_field_constrained-open:constrained-open": {
"title": "Constrained open",
"description": "Because allow-other is 'yes' no enumeration can be given in the JSON Schema.",
"$id": "#field_json-value_field_constrained-open_constrained-open",
"type": "object",
"properties": {
"some": {
"title": "Some Flag",
"description": "Some flag some flag some flag.",
"$ref": "#/definitions/StringDatatype"
"json-value_field_constrained-open-json-value_field_constrained-open:test-field": {
"title": "Test Field",
"description": "A test field.",
"$id": "#field_json-value_field_constrained-open_test-field",
"anyOf": [
{
"$ref": "#/definitions/TokenDatatype"
},
"token-value": {
"anyOf": [
{
"$ref": "#/definitions/TokenDatatype"
},
{
"enum": [
"one",
"two",
"three",
"four"
]
}
{
"enum": [
"one",
"two",
"three",
"four"
]
}
},
"required": [
"token-value"
],
"additionalProperties": false
},
"StringDatatype": {
"description": "A non-empty string with leading and trailing whitespace disallowed. Whitespace is: U+9, U+10, U+32 or [ \n\t]+",
"type": "string",
"pattern": "^\\S(.*\\S)?$"
]
},
"TokenDatatype": {
"description": "A non-colonized name as defined by XML Schema Part 2: Datatypes Second Edition. https://www.w3.org/TR/xmlschema11-2/#NCName.",
Expand All @@ -60,12 +41,12 @@
}
},
"properties": {
"root": {
"$ref": "#assembly_json-value_field_constrained-open_root"
"test-root": {
"$ref": "#assembly_json-value_field_constrained-open_test-root"
}
},
"required": [
"root"
"test-root"
],
"additionalProperties": false,
"maxProperties": 1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"test-root": {
"test-field": false
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"test-root": {
"test-field": "anything"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"test-root": {
"test-field": "two"
}
}
Loading

0 comments on commit da250ae

Please sign in to comment.