forked from usnistgov/OSCAL
-
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.
For usnistgov#452, modified copy-and-convert script to suppress chara…
…cter-level post-processing in generated JSON; added unit tests for URIs to detect issues with solidus characters '/'
- Loading branch information
1 parent
48fc8df
commit e623feb
Showing
6 changed files
with
133 additions
and
1 deletion.
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
File renamed without changes.
59 changes: 59 additions & 0 deletions
59
build/metaschema/unit-testing/datatypes/datatypes-uri_json-schema.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,59 @@ | ||
|
||
{ "$schema" : "http://json-schema.org/draft-07/schema#", | ||
"$id" : "http://csrc.nist.gov/ns/metaschema/unit-test/datatypes-uri-schema.json", | ||
"$comment" : "Metaschema Unit Test: URIs: JSON Schema", | ||
"type" : "object", | ||
"definitions" : | ||
{ "parent" : | ||
{ "title" : "parent", | ||
"description" : "parent assembly", | ||
"$id" : "#/definitions/parent", | ||
"type" : "object", | ||
"properties" : | ||
{ "uri-flag" : | ||
{ "title" : "Universal Resource Identifier Flag", | ||
"description" : "Per W3C", | ||
"type" : "string", | ||
"format" : "uri" }, | ||
"uri-reference-flag" : | ||
{ "title" : "Universal Resource Identifier Reference Flag", | ||
"description" : "Per W3C, can be a relative URI", | ||
"type" : "string", | ||
"format" : "uri-reference" }, | ||
"uri-fields" : | ||
{ "anyOf" : | ||
[ | ||
{ "$ref" : "#/definitions/uri-field" }, | ||
|
||
{ "type" : "array", | ||
"items" : | ||
{ "$ref" : "#/definitions/uri-field" }, | ||
"minItems" : 2 } ] }, | ||
"uri-reference-fields" : | ||
{ "anyOf" : | ||
[ | ||
{ "$ref" : "#/definitions/uri-reference-field" }, | ||
|
||
{ "type" : "array", | ||
"items" : | ||
{ "$ref" : "#/definitions/uri-reference-field" }, | ||
"minItems" : 2 } ] } }, | ||
"required" : | ||
[ "uri-flag", | ||
"uri-reference-flag" ], | ||
"additionalProperties" : false }, | ||
"uri-field" : | ||
{ "title" : "Universal Resource Identifier Flag", | ||
"description" : "Per W3C", | ||
"$id" : "#/definitions/uri-field", | ||
"type" : "string", | ||
"format" : "uri" }, | ||
"uri-reference-field" : | ||
{ "title" : "Universal Resource Identifier Flag", | ||
"description" : "Per W3C", | ||
"$id" : "#/definitions/uri-reference-field", | ||
"type" : "string", | ||
"format" : "uri-reference" } }, | ||
"properties" : | ||
{ "parent" : | ||
{ "$ref" : "#/definitions/parent" } } } |
48 changes: 48 additions & 0 deletions
48
build/metaschema/unit-testing/datatypes/datatypes-uri_metaschema.xml
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,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- OSCAL CATALOG METASCHEMA --> | ||
<!-- validate with XSD and Schematron (linked) --> | ||
<?xml-model href="../../lib/metaschema-check.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?> | ||
<?xml-stylesheet type="text/css" href="../../lib/metaschema-author.css"?> | ||
<METASCHEMA xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://csrc.nist.gov/ns/oscal/metaschema/1.0 ../../lib/metaschema.xsd" | ||
xmlns="http://csrc.nist.gov/ns/oscal/metaschema/1.0" | ||
xmlns:o="http://csrc.nist.gov/ns/oscal/example" | ||
root="parent"> | ||
<schema-name>Metaschema Unit Test: URIs</schema-name> | ||
<schema-version>1.0-milestone1</schema-version> | ||
<short-name>metaschema-datatypes-uri</short-name> | ||
<namespace>http://csrc.nist.gov/ns/metaschema/unit-test/datatypes-uri</namespace> | ||
|
||
<define-assembly name="parent"> | ||
<formal-name>parent</formal-name> | ||
<description>parent assembly</description> | ||
<flag name="uri-flag" as-type="uri" required="yes"> | ||
<formal-name>Universal Resource Identifier Flag</formal-name> | ||
<description>Per W3C</description> | ||
</flag> | ||
<flag name="uri-reference-flag" as-type="uri-reference" required="yes"> | ||
<formal-name>Universal Resource Identifier Reference Flag</formal-name> | ||
<description>Per W3C, can be a relative URI</description> | ||
</flag> | ||
<model> | ||
<field ref="uri-field" max-occurs="unbounded"> | ||
<group-as name="uri-fields"/> | ||
</field> | ||
<field ref="uri-reference-field" max-occurs="unbounded"> | ||
<group-as name="uri-reference-fields"/> | ||
</field> | ||
</model> | ||
</define-assembly> | ||
|
||
|
||
<define-field name="uri-field" as-type="uri"> | ||
<formal-name>Universal Resource Identifier Flag</formal-name> | ||
<description>Per W3C</description> | ||
</define-field> | ||
|
||
<define-field name="uri-reference-field" as-type="uri-reference"> | ||
<formal-name>Universal Resource Identifier Flag</formal-name> | ||
<description>Per W3C</description> | ||
</define-field> | ||
|
||
</METASCHEMA> |
13 changes: 13 additions & 0 deletions
13
build/metaschema/unit-testing/datatypes/datatypes-uri_test_broken_FAIL.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,13 @@ | ||
{ | ||
"parent": { | ||
"uri-flag": "//pages.nist.gov/OSCAL", | ||
"uri-reference-flag": "c:\\OSCAL", | ||
"uri-fields": [ | ||
"https://www.w3.org{}", | ||
"https://www.w3.org/%%%%", | ||
"http://www.nist.gov?x-y=z" | ||
], | ||
"uri-reference-fields": [ "(|)" ] | ||
|
||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
build/metaschema/unit-testing/datatypes/datatypes-uri_test_valid_PASS.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,12 @@ | ||
{ | ||
"parent": { | ||
"uri-flag": "http://pages.nist.gov/OSCAL", | ||
"uri-reference-flag": "OSCAL", | ||
"uri-fields": [ | ||
"gopher://loc.gov", | ||
"https://www.w3.org", | ||
"http://www.nist.gov" | ||
], | ||
"uri-reference-fields": "myhomepage.html" | ||
} | ||
} |