From 86cbeed096c7e0de044076d6c8093337d91f7861 Mon Sep 17 00:00:00 2001 From: Wendell Piez Date: Thu, 7 Mar 2024 17:28:57 -0500 Subject: [PATCH 01/19] Mainly planning, some scripting --- src/schema-gen/JSON-schema/Makefile | 52 ++++++++++++++++++++++++ src/schema-gen/JSON-schema/testing.md | 57 +++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 src/schema-gen/JSON-schema/Makefile create mode 100644 src/schema-gen/JSON-schema/testing.md diff --git a/src/schema-gen/JSON-schema/Makefile b/src/schema-gen/JSON-schema/Makefile new file mode 100644 index 00000000..fbb6fdb9 --- /dev/null +++ b/src/schema-gen/JSON-schema/Makefile @@ -0,0 +1,52 @@ +include ../../testing/make_common.mk + +# INCLUDES: +# unit-test - unit testing - XSLT production templates for InspectorXSLT +# spec-test - specification conformance testing - functional runtime tests of the generated XSLT +# xspec - run XSpec tests in designated folder +# clean - clean up designated output folder + +# for smoke testing see ../Makefile + +# tbd - 'field testing' applying result JSON Schema to known 'working and broken' instances + +module_path:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +output_folder:=$(module_path)/test_output +xspec_script=$(realpath $(module_path)/../../../support/xspec-dev/mvn-saxon-xspec-batch-quiet.sh) +xspec_ci_script=$(realpath $(module_path)/../../../support/xspec-dev/mvn-saxon-xspec-batch.sh) +folder=. + +.PHONY: test +test: unit-test spec-test ## Run all tests + + +.PHONY: spec-test +spec-test: ## Run all specification tests + LOGFILE="$(output_folder)/inspector-functional-tests.log" $(xspec_ci_script) \ + "folder=$(module_path)/testing/tests/jsonschemagen-mapping-xspec/" \ + "report-to=$(output_folder)/jsonschemagen-mapping_report.html" \ + "junit-to=$(output_folder)/jsonschemagen-mapping_junit-report.xml" \ + "stop-on-error=yes" \ + "recurse=yes" + +.PHONY: unit-test +unit-test: ## Run all unit tests + LOGFILE="$(output_folder)/inspector-generation-tests.log" $(xspec_ci_script) \ + "folder=$(module_path)/testing/tests/jsonschemagen-runtime-xspec" \ + "report-to=$(output_folder)/jsonschemagen-runtime_report.html" \ + "junit-to=$(output_folder)/jsonschemagen-runtime_junit-report.xml" \ + "stop-on-error=yes" \ + "recurse=yes" + +.PHONY: xspec +xspec: ## Run all *.xspec in a designated folder, quietly - use folder=[folder] + LOGFILE="$(output_folder)/$(folder)-xspec-tests.log" $(xspec_script) \ + "baseURI=file:$(module_path)/" \ + "folder=$(folder)" \ + "report-to=$(output_folder)/inspector-$(folder)-tests_report.html" \ + "stop-on-error=no" \ + "recurse=yes" + +.PHONY: clean +clean: ## Remove test output + rm -fr $(output_folder)/* \ No newline at end of file diff --git a/src/schema-gen/JSON-schema/testing.md b/src/schema-gen/JSON-schema/testing.md new file mode 100644 index 00000000..cef3efe2 --- /dev/null +++ b/src/schema-gen/JSON-schema/testing.md @@ -0,0 +1,57 @@ +# Testing Metaschema-XSLT JSON Schema production + +**Currently only JSON Schema v7 is supported.** + +At a future date we aim to support other forms. + +## Smoke testing + +A JSON Schema, with other schemas, is produced by a pipeline in the parent directory, ../METASCHEMA-ALL-SCHEMAS.xpl, which is also run as a smoke test. + +(from that directory) + +``` +make smoke-test +``` + +The smoke test outputs including a JSON Schema are found in the `test_output` folder (until/unless cleaned out). If a JSON instance cannot be produced, the process will fail. +The smoke test does *not* currently + +- test that the JSON functions as a JSON Schema +- test that it conforms to an idea of a JSON Schema ('the standard') + +It does, however, confirm that the process terminated successfully with a file output in the expected location. + +This implies near-term and long-term goals: + +## Near term goals + +Even without running the JSON Schema (a 'field-test' to demonstrate its adequacy for the purpose, i.e. validation), we can test a great deal since we know what that JSON Schema should look like. + +I.e., we can test the mapping of Metaschema semantics into JSON by sketching the transformation from Metaschema source to the JSON Schema in its XML precursor format. + +- [ ] XSpec the XSLT + - [ ] `make-json-schema-metamap.xsl` for unit testing + - [ ] `../nist-metaschema-MAKE-JSON-SCHEMA-as-xml.xsl` with @external='true' for end to end +- [ ] Flesh out with micro-examples of special cases +- [ ] Deal with `choice` https://github.com/usnistgov/metaschema-xslt/issues/105 + +cf https://github.com/usnistgov/OSCAL/issues/1989 + +This will give us something to show that we can generate correct outputs, for given inputs, in the general case. + +Note that in this repo, the OSCAL models will *not* be used. + +(But it can be used in parallel work in the oscal-xslt repository.) + +## Longer term goals + +"Field test" script able to distinguish between expected-valid and expected-invalid JSON, and report findings. + +Something that could be reused in oscal-xslt over OSCAL inputs, for example. + +## Punchlist + +- [ ] XSpec to test metamap XSLT +- [x] Makefile to run this XSpec using xspec-dev script cf ../InspectorXSLT/Makefile +- [ ] Show tests with proposed solution(s) via PR \ No newline at end of file From 9997f2b2d7d2d2f1d9a618f3286b1bc097dd999a Mon Sep 17 00:00:00 2001 From: Wendell Piez Date: Fri, 8 Mar 2024 11:34:54 -0500 Subject: [PATCH 02/19] Now with XSpecs running over JSON Schema generation - showing a successful run and framing for demonstrating any current functional lapses - --- src/schema-gen/JSON-schema/testing.md | 28 ++++++++--- .../metamap-test.xspec | 24 +++++++++ .../jsonschema-gen-test.xspec | 49 +++++++++++++++++++ 3 files changed, 95 insertions(+), 6 deletions(-) create mode 100644 src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/metamap-test.xspec create mode 100644 src/schema-gen/JSON-schema/testing/tests/jsonschemagen-runtime-xspec/jsonschema-gen-test.xspec diff --git a/src/schema-gen/JSON-schema/testing.md b/src/schema-gen/JSON-schema/testing.md index cef3efe2..9e90c370 100644 --- a/src/schema-gen/JSON-schema/testing.md +++ b/src/schema-gen/JSON-schema/testing.md @@ -8,23 +8,39 @@ At a future date we aim to support other forms. A JSON Schema, with other schemas, is produced by a pipeline in the parent directory, ../METASCHEMA-ALL-SCHEMAS.xpl, which is also run as a smoke test. -(from that directory) - ``` +pushd .. make smoke-test +popd ``` The smoke test outputs including a JSON Schema are found in the `test_output` folder (until/unless cleaned out). If a JSON instance cannot be produced, the process will fail. The smoke test does *not* currently - test that the JSON functions as a JSON Schema -- test that it conforms to an idea of a JSON Schema ('the standard') +- test that it conforms to an idea of a JSON Schema ('the standard') or JSON Schema usage patterns It does, however, confirm that the process terminated successfully with a file output in the expected location. -This implies near-term and long-term goals: -## Near term goals +## Spec testing + +In this case, 'spec testing' is testing to see whether the resulting JSON Schema looks like what we think it should look like, in detail. + +## Unit testing + +Unit tests here focus on end-to-end testing, i.e. per-metaschema mappings from single model input to single JSON Schema output. + +The unit testing here is *less* granular than the specification testing. + +Neither of these actually test the JSON Schema, only the way in which one is produced. + + +This implies near-term and longer-term goals: + +# JSON Schema generation - planning + +## Near-term Even without running the JSON Schema (a 'field-test' to demonstrate its adequacy for the purpose, i.e. validation), we can test a great deal since we know what that JSON Schema should look like. @@ -44,7 +60,7 @@ Note that in this repo, the OSCAL models will *not* be used. (But it can be used in parallel work in the oscal-xslt repository.) -## Longer term goals +## Longer-term "Field test" script able to distinguish between expected-valid and expected-invalid JSON, and report findings. diff --git a/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/metamap-test.xspec b/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/metamap-test.xspec new file mode 100644 index 00000000..7dce5483 --- /dev/null +++ b/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/metamap-test.xspec @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-runtime-xspec/jsonschema-gen-test.xspec b/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-runtime-xspec/jsonschema-gen-test.xspec new file mode 100644 index 00000000..809cd0b2 --- /dev/null +++ b/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-runtime-xspec/jsonschema-gen-test.xspec @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + ... + + + + + + + + From 7d91622df1666fe0260ad17835a63453f332ae6a Mon Sep 17 00:00:00 2001 From: Wendell Piez Date: Mon, 11 Mar 2024 16:55:48 -0400 Subject: [PATCH 03/19] Progress toward field testing of XSD and JSON Schema in application --- .../current/computer_metaschema-inspector.xsl | 3 +- .../current/computer_metaschema-schema.xsd | 169 ++++++------ .../current/tiny_metaschema-inspector.xsl | 261 +++++++++--------- .../current/tiny_metaschema-schema.xsd | 55 ++-- .../testing/refresh-computer-inspector.sh | 14 +- .../testing/refresh-test-inspectors.sh | 14 +- .../testing/smoketest-computer-inspector.sh | 12 +- .../metamap-test.xspec | 2 +- .../jsonschema-gen-test.xspec | 2 +- src/testing/issue105/XSD-VALIDATE-CHOICES.xpl | 197 +++++++++++++ .../issue105/choices-invalid/colors03.xml | 19 ++ .../issue105/choices-invalid/colors05.xml | 19 ++ .../issue105/choices-invalid/colors06.xml | 17 ++ .../issue105/choices-invalid/colors07.xml | 11 + .../issue105/choices-invalid/colors08.xml | 10 + .../issue105/choices-valid/colors01.xml | 10 + .../issue105/choices-valid/colors02.xml | 16 ++ .../issue105/choices-valid/colors04.xml | 28 ++ src/testing/issue105/choices_metaschema.xml | 94 +++++++ .../current/choices_schema-proposed.json | 194 +++++++++++++ .../issue105/current/choices_schema.json | 127 +++++++++ .../issue105/current/choices_schema.xsd | 223 +++++++++++++++ .../issue105/refresh-choices-schemas.sh | 75 +++++ .../issue105/xsd-crosscheck-choices.sh | 45 +++ 24 files changed, 1370 insertions(+), 247 deletions(-) create mode 100644 src/testing/issue105/XSD-VALIDATE-CHOICES.xpl create mode 100644 src/testing/issue105/choices-invalid/colors03.xml create mode 100644 src/testing/issue105/choices-invalid/colors05.xml create mode 100644 src/testing/issue105/choices-invalid/colors06.xml create mode 100644 src/testing/issue105/choices-invalid/colors07.xml create mode 100644 src/testing/issue105/choices-invalid/colors08.xml create mode 100644 src/testing/issue105/choices-valid/colors01.xml create mode 100644 src/testing/issue105/choices-valid/colors02.xml create mode 100644 src/testing/issue105/choices-valid/colors04.xml create mode 100644 src/testing/issue105/choices_metaschema.xml create mode 100644 src/testing/issue105/current/choices_schema-proposed.json create mode 100644 src/testing/issue105/current/choices_schema.json create mode 100644 src/testing/issue105/current/choices_schema.xsd create mode 100644 src/testing/issue105/refresh-choices-schemas.sh create mode 100644 src/testing/issue105/xsd-crosscheck-choices.sh diff --git a/src/schema-gen/InspectorXSLT/testing/current/computer_metaschema-inspector.xsl b/src/schema-gen/InspectorXSLT/testing/current/computer_metaschema-inspector.xsl index 4865e3aa..f38ee0f5 100644 --- a/src/schema-gen/InspectorXSLT/testing/current/computer_metaschema-inspector.xsl +++ b/src/schema-gen/InspectorXSLT/testing/current/computer_metaschema-inspector.xsl @@ -1,11 +1,10 @@ - + exclude-result-prefixes="#all"> diff --git a/src/schema-gen/InspectorXSLT/testing/current/computer_metaschema-schema.xsd b/src/schema-gen/InspectorXSLT/testing/current/computer_metaschema-schema.xsd index 4fa290d5..193337c0 100644 --- a/src/schema-gen/InspectorXSLT/testing/current/computer_metaschema-schema.xsd +++ b/src/schema-gen/InspectorXSLT/testing/current/computer_metaschema-schema.xsd @@ -1,11 +1,10 @@ - + xmlns:m="http://csrc.nist.gov/ns/oscal/metaschema/1.0" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + elementFormDefault="qualified" + targetNamespace="http://example.com/ns/computer" + version="0.0.5"> Computer Model @@ -64,7 +63,7 @@ - + Vendor Identifier @@ -74,6 +73,16 @@ Vendor Identifier: An identifier for classifying a unique computer parts vendor. + + + + Vendor Reference + Instead of an identifier, a reference to another vendor by its @id. + + + Vendor Reference: Instead of an identifier, a reference to another vendor by its @id. + + @@ -122,9 +131,9 @@ + type="computer-vendor-ASSEMBLY" + minOccurs="0" + maxOccurs="1"/> @@ -150,17 +159,17 @@ + type="computer-vendor-ASSEMBLY" + minOccurs="0" + maxOccurs="1"/> + type="computer-product-name-FIELD" + minOccurs="1" + maxOccurs="1"/> + type="computer-cost-FIELD" + minOccurs="0" + maxOccurs="1"/> @@ -188,9 +197,9 @@ + type="computer-property-ASSEMBLY" + minOccurs="0" + maxOccurs="1"/> @@ -207,17 +216,17 @@ + type="computer-vendor-ASSEMBLY" + minOccurs="0" + maxOccurs="1"/> + type="computer-product-name-FIELD" + minOccurs="1" + maxOccurs="1"/> + type="computer-cost-FIELD" + minOccurs="0" + maxOccurs="1"/> @@ -232,9 +241,9 @@ + type="computer-property-ASSEMBLY" + minOccurs="0" + maxOccurs="1"/> @@ -271,17 +280,17 @@ + type="computer-vendor-ASSEMBLY" + minOccurs="0" + maxOccurs="1"/> + type="computer-product-name-FIELD" + minOccurs="1" + maxOccurs="1"/> + type="computer-cost-FIELD" + minOccurs="0" + maxOccurs="1"/> @@ -296,9 +305,9 @@ + type="computer-property-ASSEMBLY" + minOccurs="0" + maxOccurs="1"/> @@ -314,9 +323,9 @@ + type="computer-cooling-ASSEMBLY" + minOccurs="0" + maxOccurs="1"/> @@ -329,17 +338,17 @@ + type="computer-vendor-ASSEMBLY" + minOccurs="0" + maxOccurs="1"/> + type="computer-product-name-FIELD" + minOccurs="1" + maxOccurs="1"/> + type="computer-cost-FIELD" + minOccurs="0" + maxOccurs="1"/> @@ -354,9 +363,9 @@ + type="computer-property-ASSEMBLY" + minOccurs="0" + maxOccurs="1"/> @@ -406,21 +415,21 @@ + type="computer-vendor-ASSEMBLY" + minOccurs="0" + maxOccurs="1"/> + type="computer-product-name-FIELD" + minOccurs="1" + maxOccurs="1"/> + type="computer-cost-FIELD" + minOccurs="0" + maxOccurs="1"/> + type="computer-property-ASSEMBLY" + minOccurs="0" + maxOccurs="1"/> @@ -436,9 +445,9 @@ + type="computer-property-ASSEMBLY" + minOccurs="0" + maxOccurs="1"/> @@ -689,9 +698,9 @@ + type="listItemType" + minOccurs="1" + maxOccurs="unbounded"/> diff --git a/src/schema-gen/InspectorXSLT/testing/current/tiny_metaschema-inspector.xsl b/src/schema-gen/InspectorXSLT/testing/current/tiny_metaschema-inspector.xsl index 44cb4883..79fffe88 100644 --- a/src/schema-gen/InspectorXSLT/testing/current/tiny_metaschema-inspector.xsl +++ b/src/schema-gen/InspectorXSLT/testing/current/tiny_metaschema-inspector.xsl @@ -1,11 +1,10 @@ - + xmlns:mx="http://csrc.nist.gov/ns/csd/metaschema-xslt" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="3.0" + xpath-default-namespace="http://example.com/ns/tinydata" + exclude-result-prefixes="#all"> @@ -21,29 +20,29 @@ + priority="100" + name="xsl:initial-template" + match="root()"> + priority="101" + match="root()[$format=('mx','mx-report')]"> + priority="101" + match="root()[$format=('html','webpage')]"> + priority="101" + match="root()[$format=('md','markdown')]"> + priority="101" + match="root()[$format=('plaintext','plain','text')]"> @@ -87,9 +86,9 @@ + tunnel="true" + as="xs:string" + select="codepoints-to-string(10)"/> @@ -100,8 +99,8 @@ + on-no-match="fail" + on-multiple-match="use-last"/> @@ -134,14 +133,14 @@ + match="a/@href | a/@title | img/@alt | img/@src | img/@title | code/@class | insert/@id-ref | insert/@type (: other legal attributes :)"/> + match="p/br | li/br | h1/br | h2/br | h3/br | h4/br | h5/br | h6/br | pre/br | tr/br | td/br"/> + match="p/text() | li/text() | h1/text() | h2/text() | h3/text() | h4/text() | h5/text() | h6/text() | pre/text() | blockquote/text() | th/text() | td/text()"/> + match="em/text() | i/text() | strong/text() | b/text() | u/text() | q/text() | code/text() | a/text() | sub/text() | sup/text()"/> @@ -151,7 +150,7 @@ + select=" 'p', 'pre', 'ul', 'ol', 'table', 'h1', 'h2', 'h3', 'h4', 'h5'"/> @@ -161,8 +160,8 @@ + mode="test" + match="@xsi:*"/> @@ -181,10 +180,10 @@ + test="{ $testing }" + class="{$class}" + xpath="{ $xpath }" + level="{ $level }"> @@ -208,7 +207,7 @@ /{ name() } + match="*[node-name() = (../* except current())/node-name()]"> /{ name() }[{ mx:element-position(.)[count($kin) gt 1] }] @@ -271,11 +270,11 @@ + priority="103" + mode="grab-mx"> + select="count(.//mx:report[@level = ('CRITICAL', 'ERROR')])"/> @@ -291,8 +290,8 @@ + priority="102" + mode="grab-mx"> File { replace(@src,'.*/','') } is reported VALID, no issues ... @@ -304,22 +303,22 @@ + select="count(descendant::* except .//mx:*/descendant-or-self::*)"/> + select="count(descendant::*/@* except .//mx:*/descendant-or-self::*/@*)"/> + select="count(.//mx:report[@level = ('CRITICAL', 'ERROR')])"/> + mode="grab-mx"> + mode="grab-mx"> @@ -437,109 +436,109 @@ details p { margin: 0.2em 0em } { codepoints-to-string(10) } + match="html" + xpath-default-namespace="http://www.w3.org/1999/xhtml"> + match="style" + xpath-default-namespace="http://www.w3.org/1999/xhtml"/> + match="body" + expand-text="true" + xpath-default-namespace="http://www.w3.org/1999/xhtml"> { $lf } + match="div | details" + expand-text="true" + xpath-default-namespace="http://www.w3.org/1999/xhtml"> { $lf2 }--- + match="body/*[1]/self::h1" + expand-text="true" + xpath-default-namespace="http://www.w3.org/1999/xhtml"> # + match="h1" + expand-text="true" + xpath-default-namespace="http://www.w3.org/1999/xhtml"> { $lf2 }# + match="h2" + expand-text="true" + xpath-default-namespace="http://www.w3.org/1999/xhtml"> { $lf2 }## + match="h3 | details/summary" + expand-text="true" + xpath-default-namespace="http://www.w3.org/1999/xhtml"> { $lf2 }### + match="p" + expand-text="true" + xpath-default-namespace="http://www.w3.org/1999/xhtml"> { $lf2 } + match="ul" + expand-text="true" + xpath-default-namespace="http://www.w3.org/1999/xhtml"> + match="li" + expand-text="true" + xpath-default-namespace="http://www.w3.org/1999/xhtml"> { $lf }- + match="b" + priority="2" + xpath-default-namespace="http://www.w3.org/1999/xhtml"> ** ** + match="i" + xpath-default-namespace="http://www.w3.org/1999/xhtml"> * * + match="code" + priority="2" + xpath-default-namespace="http://www.w3.org/1999/xhtml"> ` ` Computer Model + shortname="computer" + namespace="http://example.com/ns/tinydata">Computer Model @@ -594,7 +593,7 @@ details p { margin: 0.2em 0em } EOOO element-out-of-order exists(preceding-sibling::term | preceding-sibling::part | preceding-sibling::notes | preceding-sibling::h1 | preceding-sibling::h2 | preceding-sibling::h3 | preceding-sibling::h4 | preceding-sibling::h5 | preceding-sibling::h6 | preceding-sibling::table | preceding-sibling::img | preceding-sibling::pre | preceding-sibling::hr | preceding-sibling::blockquote | preceding-sibling::ul | preceding-sibling::ol | preceding-sibling::p) + select="exists(preceding-sibling::term | preceding-sibling::part | preceding-sibling::notes | preceding-sibling::h1 | preceding-sibling::h2 | preceding-sibling::h3 | preceding-sibling::h4 | preceding-sibling::h5 | preceding-sibling::h6 | preceding-sibling::table | preceding-sibling::img | preceding-sibling::pre | preceding-sibling::hr | preceding-sibling::blockquote | preceding-sibling::ul | preceding-sibling::ol | preceding-sibling::p)"/> Element title is unexpected following term, stuff, part, or notes/note. @@ -608,7 +607,7 @@ details p { margin: 0.2em 0em } EOOO element-out-of-order exists(preceding-sibling::part | preceding-sibling::notes | preceding-sibling::h1 | preceding-sibling::h2 | preceding-sibling::h3 | preceding-sibling::h4 | preceding-sibling::h5 | preceding-sibling::h6 | preceding-sibling::table | preceding-sibling::img | preceding-sibling::pre | preceding-sibling::hr | preceding-sibling::blockquote | preceding-sibling::ul | preceding-sibling::ol | preceding-sibling::p) + select="exists(preceding-sibling::part | preceding-sibling::notes | preceding-sibling::h1 | preceding-sibling::h2 | preceding-sibling::h3 | preceding-sibling::h4 | preceding-sibling::h5 | preceding-sibling::h6 | preceding-sibling::table | preceding-sibling::img | preceding-sibling::pre | preceding-sibling::hr | preceding-sibling::blockquote | preceding-sibling::ul | preceding-sibling::ol | preceding-sibling::p)"/> Element term is unexpected following stuff, part, or notes/note. @@ -636,7 +635,7 @@ details p { margin: 0.2em 0em } EOOO element-out-of-order exists(preceding-sibling::term | preceding-sibling::part | preceding-sibling::note | preceding-sibling::h1 | preceding-sibling::h2 | preceding-sibling::h3 | preceding-sibling::h4 | preceding-sibling::h5 | preceding-sibling::h6 | preceding-sibling::table | preceding-sibling::img | preceding-sibling::pre | preceding-sibling::hr | preceding-sibling::blockquote | preceding-sibling::ul | preceding-sibling::ol | preceding-sibling::p) + select="exists(preceding-sibling::term | preceding-sibling::part | preceding-sibling::note | preceding-sibling::h1 | preceding-sibling::h2 | preceding-sibling::h3 | preceding-sibling::h4 | preceding-sibling::h5 | preceding-sibling::h6 | preceding-sibling::table | preceding-sibling::img | preceding-sibling::pre | preceding-sibling::hr | preceding-sibling::blockquote | preceding-sibling::ul | preceding-sibling::ol | preceding-sibling::p)"/> Element title is unexpected following term, stuff, part, or note. @@ -650,7 +649,7 @@ details p { margin: 0.2em 0em } EOOO element-out-of-order exists(preceding-sibling::part | preceding-sibling::note | preceding-sibling::h1 | preceding-sibling::h2 | preceding-sibling::h3 | preceding-sibling::h4 | preceding-sibling::h5 | preceding-sibling::h6 | preceding-sibling::table | preceding-sibling::img | preceding-sibling::pre | preceding-sibling::hr | preceding-sibling::blockquote | preceding-sibling::ul | preceding-sibling::ol | preceding-sibling::p) + select="exists(preceding-sibling::part | preceding-sibling::note | preceding-sibling::h1 | preceding-sibling::h2 | preceding-sibling::h3 | preceding-sibling::h4 | preceding-sibling::h5 | preceding-sibling::h6 | preceding-sibling::table | preceding-sibling::img | preceding-sibling::pre | preceding-sibling::hr | preceding-sibling::blockquote | preceding-sibling::ul | preceding-sibling::ol | preceding-sibling::p)"/> Element term is unexpected following stuff, part, or note. @@ -762,12 +761,12 @@ details p { margin: 0.2em 0em } gix.148 + as="xs:string" + select="($matching[matches(.,'\S')],'*')[1]"/> { $class } not(string(.) castable as xs:string and matches(.,'^\S(.*\S)?$')) + select="not(string(.) castable as xs:string and matches(.,'^\S(.*\S)?$'))"/> Value { string(.) } of { if (self::element()) then 'element' else 'attribute' } { self::attribute()/'@' }{ name(.) } does not conform to string datatype. @@ -779,111 +778,111 @@ details p { margin: 0.2em 0em } gix.148 + as="xs:string" + select="($matching[matches(.,'\S')],'*')[1]"/> { $class } not(string(.) castable as xs:string and matches(.,'^(\p{L}|_)(\p{L}|\p{N}|[.\-_])*$') and matches(.,'^\S(.*\S)?$')) + select="not(string(.) castable as xs:string and matches(.,'^(\p{L}|_)(\p{L}|\p{N}|[.\-_])*$') and matches(.,'^\S(.*\S)?$'))"/> Value { string(.) } of { if (self::element()) then 'element' else 'attribute' } { self::attribute()/'@' }{ name(.) } does not conform to token datatype. + match="title/a|title/insert|title/br|title/code|title/em|title/i|title/b|title/strong|title/sub|title/sup|title/q|title/img"/> + match="TINY/h1|TINY/h2|TINY/h3|TINY/h4|TINY/h5|TINY/h6|TINY/table|TINY/img|TINY/pre|TINY/hr|TINY/blockquote|TINY/ul|TINY/ol|TINY/p"> gix.390 EOOO element-out-of-order exists(preceding-sibling::part | preceding-sibling::notes) + select="exists(preceding-sibling::part | preceding-sibling::notes)"/> Element stuff is unexpected following part or notes/note. + match="part/h1|part/h2|part/h3|part/h4|part/h5|part/h6|part/table|part/img|part/pre|part/hr|part/blockquote|part/ul|part/ol|part/p"> gix.390 EOOO element-out-of-order exists(preceding-sibling::part | preceding-sibling::note) + select="exists(preceding-sibling::part | preceding-sibling::note)"/> Element stuff is unexpected following part or note. + match="TINY/notes/note/h1|TINY/notes/note/h2|TINY/notes/note/h3|TINY/notes/note/h4|TINY/notes/note/h5|TINY/notes/note/h6|TINY/notes/note/table|TINY/notes/note/img|TINY/notes/note/pre|TINY/notes/note/hr|TINY/notes/note/blockquote|TINY/notes/note/ul|TINY/notes/note/ol|TINY/notes/note/p"/> + match="part/note/h1|part/note/h2|part/note/h3|part/note/h4|part/note/h5|part/note/h6|part/note/table|part/note/img|part/note/pre|part/note/hr|part/note/blockquote|part/note/ul|part/note/ol|part/note/p"/> + match="TINY/title/a|TINY/title/insert|TINY/title/br|TINY/title/code|TINY/title/em|TINY/title/i|TINY/title/b|TINY/title/strong|TINY/title/sub|TINY/title/sup|TINY/title/q|TINY/title/img"> gix.390 EOOO element-out-of-order exists(preceding-sibling::term | preceding-sibling::part | preceding-sibling::notes | preceding-sibling::h1 | preceding-sibling::h2 | preceding-sibling::h3 | preceding-sibling::h4 | preceding-sibling::h5 | preceding-sibling::h6 | preceding-sibling::table | preceding-sibling::img | preceding-sibling::pre | preceding-sibling::hr | preceding-sibling::blockquote | preceding-sibling::ul | preceding-sibling::ol | preceding-sibling::p) + select="exists(preceding-sibling::term | preceding-sibling::part | preceding-sibling::notes | preceding-sibling::h1 | preceding-sibling::h2 | preceding-sibling::h3 | preceding-sibling::h4 | preceding-sibling::h5 | preceding-sibling::h6 | preceding-sibling::table | preceding-sibling::img | preceding-sibling::pre | preceding-sibling::hr | preceding-sibling::blockquote | preceding-sibling::ul | preceding-sibling::ol | preceding-sibling::p)"/> Element title is unexpected following term, stuff, part, or notes/note. + match="part/title/a|part/title/insert|part/title/br|part/title/code|part/title/em|part/title/i|part/title/b|part/title/strong|part/title/sub|part/title/sup|part/title/q|part/title/img"> gix.390 EOOO element-out-of-order exists(preceding-sibling::term | preceding-sibling::part | preceding-sibling::note | preceding-sibling::h1 | preceding-sibling::h2 | preceding-sibling::h3 | preceding-sibling::h4 | preceding-sibling::h5 | preceding-sibling::h6 | preceding-sibling::table | preceding-sibling::img | preceding-sibling::pre | preceding-sibling::hr | preceding-sibling::blockquote | preceding-sibling::ul | preceding-sibling::ol | preceding-sibling::p) + select="exists(preceding-sibling::term | preceding-sibling::part | preceding-sibling::note | preceding-sibling::h1 | preceding-sibling::h2 | preceding-sibling::h3 | preceding-sibling::h4 | preceding-sibling::h5 | preceding-sibling::h6 | preceding-sibling::table | preceding-sibling::img | preceding-sibling::pre | preceding-sibling::hr | preceding-sibling::blockquote | preceding-sibling::ul | preceding-sibling::ol | preceding-sibling::p)"/> Element title is unexpected following term, stuff, part, or note. + match="h1/a|h2/a|h3/a|h4/a|h5/a|h6/a|table/a|pre/a|blockquote/a|ul/a|ol/a|p/a"/> + match="a/a|insert/a|code/a|em/a|i/a|b/a|strong/a|sub/a|sup/a|q/a"/> + match="h1/insert|h2/insert|h3/insert|h4/insert|h5/insert|h6/insert|table/insert|pre/insert|blockquote/insert|ul/insert|ol/insert|p/insert"/> + match="a/insert|insert/insert|code/insert|em/insert|i/insert|b/insert|strong/insert|sub/insert|sup/insert|q/insert"/> + match="h1/br|h2/br|h3/br|h4/br|h5/br|h6/br|table/br|pre/br|blockquote/br|ul/br|ol/br|p/br"/> + match="a/br|insert/br|code/br|em/br|i/br|b/br|strong/br|sub/br|sup/br|q/br"/> + match="h1/code|h2/code|h3/code|h4/code|h5/code|h6/code|table/code|pre/code|blockquote/code|ul/code|ol/code|p/code"/> + match="a/code|insert/code|code/code|em/code|i/code|b/code|strong/code|sub/code|sup/code|q/code"/> + match="h1/em|h2/em|h3/em|h4/em|h5/em|h6/em|table/em|pre/em|blockquote/em|ul/em|ol/em|p/em"/> + match="a/em|insert/em|code/em|em/em|i/em|b/em|strong/em|sub/em|sup/em|q/em"/> + match="h1/i|h2/i|h3/i|h4/i|h5/i|h6/i|table/i|pre/i|blockquote/i|ul/i|ol/i|p/i"/> + match="a/i|insert/i|code/i|em/i|i/i|b/i|strong/i|sub/i|sup/i|q/i"/> + match="h1/b|h2/b|h3/b|h4/b|h5/b|h6/b|table/b|pre/b|blockquote/b|ul/b|ol/b|p/b"/> + match="a/b|insert/b|code/b|em/b|i/b|b/b|strong/b|sub/b|sup/b|q/b"/> + match="h1/strong|h2/strong|h3/strong|h4/strong|h5/strong|h6/strong|table/strong|pre/strong|blockquote/strong|ul/strong|ol/strong|p/strong"/> + match="a/strong|insert/strong|code/strong|em/strong|i/strong|b/strong|strong/strong|sub/strong|sup/strong|q/strong"/> + match="h1/sub|h2/sub|h3/sub|h4/sub|h5/sub|h6/sub|table/sub|pre/sub|blockquote/sub|ul/sub|ol/sub|p/sub"/> + match="a/sub|insert/sub|code/sub|em/sub|i/sub|b/sub|strong/sub|sub/sub|sup/sub|q/sub"/> + match="h1/sup|h2/sup|h3/sup|h4/sup|h5/sup|h6/sup|table/sup|pre/sup|blockquote/sup|ul/sup|ol/sup|p/sup"/> + match="a/sup|insert/sup|code/sup|em/sup|i/sup|b/sup|strong/sup|sub/sup|sup/sup|q/sup"/> + match="h1/q|h2/q|h3/q|h4/q|h5/q|h6/q|table/q|pre/q|blockquote/q|ul/q|ol/q|p/q"/> + match="a/q|insert/q|code/q|em/q|i/q|b/q|strong/q|sub/q|sup/q|q/q"/> + match="h1/img|h2/img|h3/img|h4/img|h5/img|h6/img|table/img|pre/img|blockquote/img|ul/img|ol/img|p/img"/> + match="a/img|insert/img|code/img|em/img|i/img|b/img|strong/img|sub/img|sup/img|q/img"/> diff --git a/src/schema-gen/InspectorXSLT/testing/current/tiny_metaschema-schema.xsd b/src/schema-gen/InspectorXSLT/testing/current/tiny_metaschema-schema.xsd index 8abaa3d5..ee5828b7 100644 --- a/src/schema-gen/InspectorXSLT/testing/current/tiny_metaschema-schema.xsd +++ b/src/schema-gen/InspectorXSLT/testing/current/tiny_metaschema-schema.xsd @@ -1,11 +1,10 @@ - + xmlns:m="http://csrc.nist.gov/ns/oscal/metaschema/1.0" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + elementFormDefault="qualified" + targetNamespace="http://example.com/ns/tinydata" + version="0.0.5"> Computer Model @@ -30,18 +29,18 @@ + type="computer-title-FIELD" + minOccurs="1" + maxOccurs="1"/> + type="computer-term-FIELD" + minOccurs="0" + maxOccurs="unbounded"/> + type="computer-part-ASSEMBLY" + minOccurs="0" + maxOccurs="unbounded"/> @@ -134,18 +133,18 @@ + type="computer-title-FIELD" + minOccurs="1" + maxOccurs="1"/> + type="computer-term-FIELD" + minOccurs="0" + maxOccurs="unbounded"/> + type="computer-part-ASSEMBLY" + minOccurs="0" + maxOccurs="unbounded"/> @@ -208,9 +207,9 @@ + type="listItemType" + minOccurs="1" + maxOccurs="unbounded"/> diff --git a/src/schema-gen/InspectorXSLT/testing/refresh-computer-inspector.sh b/src/schema-gen/InspectorXSLT/testing/refresh-computer-inspector.sh index f010ebbf..533c6788 100644 --- a/src/schema-gen/InspectorXSLT/testing/refresh-computer-inspector.sh +++ b/src/schema-gen/InspectorXSLT/testing/refresh-computer-inspector.sh @@ -28,8 +28,18 @@ ADDITIONAL_ARGS=$(echo "${*// /\\ }") CALABASH_ARGS="-oINSPECTOR-XSLT=\"$XSLT_RESULT\" $ADDITIONAL_ARGS \"${XPROC_FILE}\"" -# echo "${CALABASH_ARGS}" +## show usage if a first argument is '-h', expanding $1 to '' if not set +if [ "${1:-}" = '-h' ] || [ "${1:-}" = '--help' ]; + +then + + usage +else + +# echo "${CALABASH_ARGS}" invoke_calabash "${CALABASH_ARGS}" -echo Computer Model Inspector XSLT refreshed - check - \ No newline at end of file +echo Computer Model Inspector XSLT refreshed - check - + +fi diff --git a/src/schema-gen/InspectorXSLT/testing/refresh-test-inspectors.sh b/src/schema-gen/InspectorXSLT/testing/refresh-test-inspectors.sh index ac4841f1..fc72d481 100644 --- a/src/schema-gen/InspectorXSLT/testing/refresh-test-inspectors.sh +++ b/src/schema-gen/InspectorXSLT/testing/refresh-test-inspectors.sh @@ -26,8 +26,20 @@ ADDITIONAL_ARGS=$(echo "${*// /\\ }") # -iMETASCHEMA=computer_metaschema.xml -iMETASCHEMA=tiny_metaschema.xml CALABASH_ARGS="$ADDITIONAL_ARGS \"${XPROC_FILE}\"" + + +## show usage if a first argument is '-h', expanding $1 to '' if not set +if [ "${1:-}" = '-h' ] || [ "${1:-}" = '--help' ]; + +then + + usage + +else + # echo "${CALABASH_ARGS}" invoke_calabash "${CALABASH_ARGS}" -# invoke_calabash "-iMETASCHEMA=computer_metaschema.xml -iMETASCHEMA=tiny_metaschema.xml "${CALABASH_ARGS}" echo Current test models refreshed - InspectorXSLT and XSD - check 'current' + +fi \ No newline at end of file diff --git a/src/schema-gen/InspectorXSLT/testing/smoketest-computer-inspector.sh b/src/schema-gen/InspectorXSLT/testing/smoketest-computer-inspector.sh index db1e7d32..ca39ee68 100644 --- a/src/schema-gen/InspectorXSLT/testing/smoketest-computer-inspector.sh +++ b/src/schema-gen/InspectorXSLT/testing/smoketest-computer-inspector.sh @@ -26,7 +26,17 @@ ADDITIONAL_ARGS=$(echo "${*// /\\ }") CALABASH_ARGS="-oINSPECTOR-XSLT=/dev/null $ADDITIONAL_ARGS \"${XPROC_FILE}\"" # echo "${CALABASH_ARGS}" +## show usage if a first argument is '-h', expanding $1 to '' if not set +if [ "${1:-}" = '-h' ] || [ "${1:-}" = '--help' ]; + +then + + usage + +else invoke_calabash "${CALABASH_ARGS}" -echo Computer Model Inspector XSLT produced and run - without apparent error \ No newline at end of file +echo Computer Model Inspector XSLT produced and run - without apparent error + +fi diff --git a/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/metamap-test.xspec b/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/metamap-test.xspec index 7dce5483..1c2c1d24 100644 --- a/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/metamap-test.xspec +++ b/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/metamap-test.xspec @@ -16,7 +16,7 @@ - + diff --git a/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-runtime-xspec/jsonschema-gen-test.xspec b/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-runtime-xspec/jsonschema-gen-test.xspec index 809cd0b2..11eab3a4 100644 --- a/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-runtime-xspec/jsonschema-gen-test.xspec +++ b/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-runtime-xspec/jsonschema-gen-test.xspec @@ -18,7 +18,7 @@ - + On diff --git a/src/testing/issue105/XSD-VALIDATE-CHOICES.xpl b/src/testing/issue105/XSD-VALIDATE-CHOICES.xpl new file mode 100644 index 00000000..69012066 --- /dev/null +++ b/src/testing/issue105/XSD-VALIDATE-CHOICES.xpl @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Checking { count(*/*) }{ if (count(*/*) eq 1) then ' document' else ' documents' } against an OSCAL Catalog XSD ... + + + + ALL GOOD - confirming expected results from XSD validation + + + + + + VALIDATION ANOMALY: a document expected to be valid is found to be INVALID + + + + VALIDATION ANOMALY: a marked document ('<?EXPECT ERROR?>') is found to be VALID + + + + CONFIRMED (invalid) + + + + CONFIRMED (valid) + + + + + + + + + + + + + + + + + { (1 to 12) ! ':::::' } + + + + + + + + + + : { . } + + + + + + + \ No newline at end of file diff --git a/src/testing/issue105/choices-invalid/colors03.xml b/src/testing/issue105/choices-invalid/colors03.xml new file mode 100644 index 00000000..5089a445 --- /dev/null +++ b/src/testing/issue105/choices-invalid/colors03.xml @@ -0,0 +1,19 @@ + + + Family of Choices + + + + + + + + Another family + + + + + + + + \ No newline at end of file diff --git a/src/testing/issue105/choices-invalid/colors05.xml b/src/testing/issue105/choices-invalid/colors05.xml new file mode 100644 index 00000000..153f01da --- /dev/null +++ b/src/testing/issue105/choices-invalid/colors05.xml @@ -0,0 +1,19 @@ + + + Family of Choices + + + + + + + + Another family + + + + + + + + \ No newline at end of file diff --git a/src/testing/issue105/choices-invalid/colors06.xml b/src/testing/issue105/choices-invalid/colors06.xml new file mode 100644 index 00000000..e7bc9488 --- /dev/null +++ b/src/testing/issue105/choices-invalid/colors06.xml @@ -0,0 +1,17 @@ + + + Family of Choices + + + + + + + + Another family + + + + + + \ No newline at end of file diff --git a/src/testing/issue105/choices-invalid/colors07.xml b/src/testing/issue105/choices-invalid/colors07.xml new file mode 100644 index 00000000..97204593 --- /dev/null +++ b/src/testing/issue105/choices-invalid/colors07.xml @@ -0,0 +1,11 @@ + + + Family of Choices + + Another family + + + + + + \ No newline at end of file diff --git a/src/testing/issue105/choices-invalid/colors08.xml b/src/testing/issue105/choices-invalid/colors08.xml new file mode 100644 index 00000000..9af70386 --- /dev/null +++ b/src/testing/issue105/choices-invalid/colors08.xml @@ -0,0 +1,10 @@ + + + Family of Choices + + Another family + + + + + \ No newline at end of file diff --git a/src/testing/issue105/choices-valid/colors01.xml b/src/testing/issue105/choices-valid/colors01.xml new file mode 100644 index 00000000..e48e3a72 --- /dev/null +++ b/src/testing/issue105/choices-valid/colors01.xml @@ -0,0 +1,10 @@ + + + Family of Choices + + + + + + + \ No newline at end of file diff --git a/src/testing/issue105/choices-valid/colors02.xml b/src/testing/issue105/choices-valid/colors02.xml new file mode 100644 index 00000000..ce1c5dca --- /dev/null +++ b/src/testing/issue105/choices-valid/colors02.xml @@ -0,0 +1,16 @@ + + + Family of Choices + + + + + + + + Another family + + + + + \ No newline at end of file diff --git a/src/testing/issue105/choices-valid/colors04.xml b/src/testing/issue105/choices-valid/colors04.xml new file mode 100644 index 00000000..eaef0855 --- /dev/null +++ b/src/testing/issue105/choices-valid/colors04.xml @@ -0,0 +1,28 @@ + + + Families of Choices + + A + + + + + + B group + + + + + + C group + + + + + + D group + + + + + \ No newline at end of file diff --git a/src/testing/issue105/choices_metaschema.xml b/src/testing/issue105/choices_metaschema.xml new file mode 100644 index 00000000..8aaeb7b3 --- /dev/null +++ b/src/testing/issue105/choices_metaschema.xml @@ -0,0 +1,94 @@ + + + Choices Model + 0.0.1 + choices + http://example.com/ns/choices + http://example.com/ns/choices + + + Choices + Colors and patterns. + CHOICES + + Vendor Identifier + An identifier for classifying a unique computer parts vendor. + + + + Color family + A name for your selection. + + + + + + + + + + + + Group + A grouping. + + + Color family + A name or identifying code for your selection. + + + + + + + + + + + + + + + Blue + A blue color. + + + + Aquamarine + Peace and tranquility. + + + Midnight + Calmly resting. + + + Lapis + In repose. + + + + + + + Red + A red color. + + + + Firetruck + Heading for an emergeny. + + + Flame + Hot as heck. + + + Rooster + Cock-a-doodle-doo. + + + + + + diff --git a/src/testing/issue105/current/choices_schema-proposed.json b/src/testing/issue105/current/choices_schema-proposed.json new file mode 100644 index 00000000..47bdb296 --- /dev/null +++ b/src/testing/issue105/current/choices_schema-proposed.json @@ -0,0 +1,194 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://example.com/ns/choices/0.0.1/choices-schema.json", + "$comment": "Choices Model: JSON Schema", + "type": "object", + "definitions": { + "json-schema-directive": { + "title": "Schema Directive", + "description": "A JSON Schema directive to bind a specific schema to its document instance.", + "$id": "#/definitions/json-schema-directive", + "$ref": "#/definitions/URIReferenceDatatype" + }, + "choices-choices:CHOICES": { + "title": "Choices", + "description": "Colors and patterns.", + "$id": "#/definitions/choices-choices:CHOICES", + "type": "object", + "properties": { + "id": { + "title": "Vendor Identifier", + "description": "An identifier for classifying a unique computer parts vendor.", + "$ref": "#/definitions/StringDatatype" + }, + "family": { + "title": "Color family", + "description": "A name for your selection.", + "$ref": "#/definitions/StringDatatype" + }, + "blue": {"$ref": "#/definitions/choices-choices:blue"}, + "red": {"$ref": "#/definitions/choices-choices:red"}, + "groups": { + "anyOf": [ + {"$ref": "#/definitions/choices-choices:group"}, + { + "type": "array", + "minItems": 1, + "items": {"$ref": "#/definitions/choices-choices:group"} + } + ] + } + }, + "required": ["family"], + "additionalProperties": false + }, + "choices-choices:group": { + "title": "Group", + "description": "A grouping.", + "$id": "#/definitions/choices-choices:group", + "type": "object", + "oneOf": [ + { + "properties": { + "family": { + "title": "Color family", + "description": "A name or identifying code for your selection.", + "$ref": "#/definitions/StringDatatype" + }, + "blue": {"$ref": "#/definitions/choices-choices:blue"}, + "subgroups": { + "anyOf": [ + {"$ref": "#/definitions/choices-choices:group"}, + { + "type": "array", + "minItems": 1, + "items": {"$ref": "#/definitions/choices-choices:group"} + } + ] + } + }, + "required": ["family"], + "additionalProperties": false + }, + { + "properties": { + "family": { + "title": "Color family", + "description": "A name or identifying code for your selection.", + "$ref": "#/definitions/StringDatatype" + }, + "red": {"$ref": "#/definitions/choices-choices:red"}, + "subgroups": { + "anyOf": [ + {"$ref": "#/definitions/choices-choices:group"}, + { + "type": "array", + "minItems": 1, + "items": {"$ref": "#/definitions/choices-choices:group"} + } + ] + } + }, + "required": ["family"], + "additionalProperties": false + } + ] + }, + "choices-choices:blue": { + "title": "Blue", + "description": "A blue color.", + "$id": "#/definitions/choices-choices:blue", + "type": "object", + "oneOf": [ + { + "properties": { + "aquamarine": { + "title": "Aquamarine", + "description": "Peace and tranquility.", + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "properties": { + "aquamarine": { + "title": "Midnight", + "description": "Calmly resting.", + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "properties": { + "aquamarine": { + "title": "Lapis", + "description": "In repose.", + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "choices-choices:red": { + "title": "Red", + "description": "A red color.", + "$id": "#/definitions/choices-choices:red", + "type": "object", + "oneOf": [ + { + "properties": { + "firetruck": { + "title": "Firetruck", + "description": "Heading for an emergeny.", + "type": "object", + "additionalProperties": false + } + } + }, + { + "properties": { + "flame": { + "title": "Flame", + "description": "Hot as heck.", + "type": "object", + "additionalProperties": false + } + } + }, + { + "properties": { + "rooster": { + "title": "Rooster", + "description": "Cock-a-doodle-doo.", + "type": "object", + "additionalProperties": false + } + } + } + ], + "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)?$" + }, + "URIReferenceDatatype": { + "description": "A URI Reference, either a URI or a relative-reference, formatted according to section 4.1 of RFC3986.", + "type": "string", + "format": "uri-reference" + } + }, + "properties": { + "$schema": {"$ref": "#/definitions/json-schema-directive"}, + "CHOICES": {"$ref": "#/definitions/choices-choices:CHOICES"} + }, + "required": ["CHOICES"], + "additionalProperties": false +} \ No newline at end of file diff --git a/src/testing/issue105/current/choices_schema.json b/src/testing/issue105/current/choices_schema.json new file mode 100644 index 00000000..a1367106 --- /dev/null +++ b/src/testing/issue105/current/choices_schema.json @@ -0,0 +1,127 @@ + + { "$schema" : "http://json-schema.org/draft-07/schema#", + "$id" : "http://example.com/ns/choices/0.0.1/choices-schema.json", + "$comment" : "Choices Model: JSON Schema", + "type" : "object", + "definitions" : + { "json-schema-directive" : + { "title" : "Schema Directive", + "description" : "A JSON Schema directive to bind a specific schema to its document instance.", + "$id" : "#/definitions/json-schema-directive", + "$ref" : "#/definitions/URIReferenceDatatype" }, + "choices-choices:CHOICES" : + { "title" : "Choices", + "description" : "Colors and patterns.", + "$id" : "#/definitions/choices-choices:CHOICES", + "type" : "object", + "properties" : + { "id" : + { "title" : "Vendor Identifier", + "description" : "An identifier for classifying a unique computer parts vendor.", + "$ref" : "#/definitions/StringDatatype" }, + "family" : + { "title" : "Color family", + "description" : "A name for your selection.", + "$ref" : "#/definitions/StringDatatype" }, + "blue" : + { "$ref" : "#/definitions/choices-choices:blue" }, + "red" : + { "$ref" : "#/definitions/choices-choices:red" }, + "groups" : + { "anyOf" : + [ + { "$ref" : "#/definitions/choices-choices:group" }, + + { "type" : "array", + "minItems" : 1, + "items" : + { "$ref" : "#/definitions/choices-choices:group" } } ] } }, + "required" : + [ "family" ], + "additionalProperties" : false }, + "choices-choices:group" : + { "title" : "Group", + "description" : "A grouping.", + "$id" : "#/definitions/choices-choices:group", + "type" : "object", + "properties" : + { "family" : + { "title" : "Color family", + "description" : "A name or identifying code for your selection.", + "$ref" : "#/definitions/StringDatatype" }, + "blue" : + { "$ref" : "#/definitions/choices-choices:blue" }, + "red" : + { "$ref" : "#/definitions/choices-choices:red" }, + "subgroups" : + { "anyOf" : + [ + { "$ref" : "#/definitions/choices-choices:group" }, + + { "type" : "array", + "minItems" : 1, + "items" : + { "$ref" : "#/definitions/choices-choices:group" } } ] } }, + "required" : + [ "family" ], + "additionalProperties" : false }, + "choices-choices:blue" : + { "title" : "Blue", + "description" : "A blue color.", + "$id" : "#/definitions/choices-choices:blue", + "type" : "object", + "properties" : + { "aquamarine" : + { "title" : "Aquamarine", + "description" : "Peace and tranquility.", + "type" : "object", + "additionalProperties" : false }, + "midnight" : + { "title" : "Midnight", + "description" : "Calmly resting.", + "type" : "object", + "additionalProperties" : false }, + "lapis" : + { "title" : "Lapis", + "description" : "In repose.", + "type" : "object", + "additionalProperties" : false } }, + "additionalProperties" : false }, + "choices-choices:red" : + { "title" : "Red", + "description" : "A red color.", + "$id" : "#/definitions/choices-choices:red", + "type" : "object", + "properties" : + { "firetruck" : + { "title" : "Firetruck", + "description" : "Heading for an emergeny.", + "type" : "object", + "additionalProperties" : false }, + "flame" : + { "title" : "Flame", + "description" : "Hot as heck.", + "type" : "object", + "additionalProperties" : false }, + "rooster" : + { "title" : "Rooster", + "description" : "Cock-a-doodle-doo.", + "type" : "object", + "additionalProperties" : false } }, + "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)?$" }, + "URIReferenceDatatype" : + { "description" : "A URI Reference, either a URI or a relative-reference, formatted according to section 4.1 of RFC3986.", + "type" : "string", + "format" : "uri-reference" } }, + "properties" : + { "$schema" : + { "$ref" : "#/definitions/json-schema-directive" }, + "CHOICES" : + { "$ref" : "#/definitions/choices-choices:CHOICES" } }, + "required" : + [ "CHOICES" ], + "additionalProperties" : false } \ No newline at end of file diff --git a/src/testing/issue105/current/choices_schema.xsd b/src/testing/issue105/current/choices_schema.xsd new file mode 100644 index 00000000..457e651d --- /dev/null +++ b/src/testing/issue105/current/choices_schema.xsd @@ -0,0 +1,223 @@ + + + + Choices Model + 0.0.1 + choices + CHOICES + + + + + + + Choices + Colors and patterns. + + + Choices: Colors and patterns. + + + + + + + Color family + A name for your selection. + + + Color family: A name for your selection. + + + + + + + + + + + + Vendor Identifier + An identifier for classifying a unique computer parts vendor. + + + Vendor Identifier: An identifier for classifying a unique computer parts vendor. + + + + + + + Group + A grouping. + + + Group: A grouping. + + + + + + + Color family + A name or identifying code for your selection. + + + Color family: A name or identifying code for your selection. + + + + + + + + + + + + + + + Blue + A blue color. + + + Blue: A blue color. + + + + + + + + Aquamarine + Peace and tranquility. + + + Aquamarine: Peace and tranquility. + + + + + + + + Midnight + Calmly resting. + + + Midnight: Calmly resting. + + + + + + + + Lapis + In repose. + + + Lapis: In repose. + + + + + + + + + + Red + A red color. + + + Red: A red color. + + + + + + + + Firetruck + Heading for an emergeny. + + + Firetruck: Heading for an emergeny. + + + + + + + + Flame + Hot as heck. + + + Flame: Hot as heck. + + + + + + + + Rooster + Cock-a-doodle-doo. + + + Rooster: Cock-a-doodle-doo. + + + + + + + + + A non-empty string of Unicode characters with leading and trailing whitespace + disallowed. Whitespace is: U+9, U+10, U+32 or [ \n\t]+ + + + + The 'string' datatype restricts the XSD type by prohibiting leading + and trailing whitespace, and something (not only whitespace) is required. + + + + + This pattern ensures that leading and trailing whitespace is + disallowed. This helps to even the user experience between implementations + related to whitespace. + + + + + diff --git a/src/testing/issue105/refresh-choices-schemas.sh b/src/testing/issue105/refresh-choices-schemas.sh new file mode 100644 index 00000000..327a0925 --- /dev/null +++ b/src/testing/issue105/refresh-choices-schemas.sh @@ -0,0 +1,75 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# shellcheck source=../common/subcommand_common.bash + +source "$SCRIPT_DIR/../../common/subcommand_common.bash" + +# XProc produces Inspector XSLT with a fail-safe check by compiling and running it +XPROC_FILE="${SCRIPT_DIR}/COMPUTER-INSPECTOR-PRODUCE.xpl" + +XSLT_RESULT=${SCRIPT_DIR}/current/computer_metaschema-inspector.xsl + +usage() { + cat <&2 + rm -f "$XSD_FILE" +fi + +if [ -e "$JSONSCHEMA_FILE" ]; then + echo "Overwriting prior $JSONSCHEMA_FILE..." >&2 + rm -f "$JSONSCHEMA_FILE" +fi + +invoke_calabash "${CALABASH_ARGS}" + +if [ -e "$XSD_FILE" ] && [ -e "$JSONSCHEMA_FILE" ]; then + echo "Wrote XSD to $XSD_FILE" >&2 + echo "Wrote JSON schema to $JSONSCHEMA_FILE" >&2 +fi + +fi diff --git a/src/testing/issue105/xsd-crosscheck-choices.sh b/src/testing/issue105/xsd-crosscheck-choices.sh new file mode 100644 index 00000000..dd4c1ece --- /dev/null +++ b/src/testing/issue105/xsd-crosscheck-choices.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# shellcheck source=../common/subcommand_common.bash + +source "$SCRIPT_DIR/../common/subcommand_common.bash" + +# XProc produces Inspector XSLT with a fail-safe check by compiling and running it +XPROC_FILE="${SCRIPT_DIR}/XSD-VALIDATE-OSCAL-SAMPLES.xpl" + +usage() { + cat < Date: Wed, 13 Mar 2024 17:09:13 -0400 Subject: [PATCH 04/19] Preliminary implementation of 'choice' breakout --- src/schema-gen/JSON-schema/choice-split.xsl | 84 +++++++ .../choice-splitting.xspec | 230 ++++++++++++++++++ 2 files changed, 314 insertions(+) create mode 100644 src/schema-gen/JSON-schema/choice-split.xsl create mode 100644 src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/choice-splitting.xspec diff --git a/src/schema-gen/JSON-schema/choice-split.xsl b/src/schema-gen/JSON-schema/choice-split.xsl new file mode 100644 index 00000000..ca8297bf --- /dev/null +++ b/src/schema-gen/JSON-schema/choice-split.xsl @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { generate-id() } { count($splitters) }: { ($splitters ! serialize(.)) => string-join(' ==== ') } + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/choice-splitting.xspec b/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/choice-splitting.xspec new file mode 100644 index 00000000..9b684830 --- /dev/null +++ b/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/choice-splitting.xspec @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 0e785aba75d68aa98708ad39ddde664d86327ac4 Mon Sep 17 00:00:00 2001 From: Wendell Piez Date: Fri, 15 Mar 2024 16:29:38 -0400 Subject: [PATCH 05/19] Now adding XSD and Schematron validation supporting a PR-time validation check on input dependencies - it is replicable --- .../xspec-patterns.xspec | 1 + src/schema-gen/JSON-schema/choice-split.xsl | 9 +-- .../choice-splitting.xspec | 3 +- src/testing/Makefile | 71 +++++++++++++++++++ src/testing/issue_235_regression.xspec | 2 + src/testing/readme.md | 38 ++++++++++ src/validate/METASCHEMA-SCHXSLT-VALIDATE.xpl | 2 +- src/validate/METASCHEMA-VALIDATE.xpl | 52 -------------- src/validate/METASCHEMA-XSD-VALIDATE.xpl | 48 +++++++++++++ .../mvn-metaschema-xsd-validate-xpl.sh | 26 +++++++ src/validate/svrl-reduce.xsl | 2 +- 11 files changed, 194 insertions(+), 60 deletions(-) create mode 100644 src/testing/Makefile create mode 100644 src/testing/readme.md delete mode 100644 src/validate/METASCHEMA-VALIDATE.xpl create mode 100644 src/validate/METASCHEMA-XSD-VALIDATE.xpl create mode 100644 src/validate/mvn-metaschema-xsd-validate-xpl.sh diff --git a/src/schema-gen/InspectorXSLT/testing/tests/inspector-functional-xspec/xspec-patterns.xspec b/src/schema-gen/InspectorXSLT/testing/tests/inspector-functional-xspec/xspec-patterns.xspec index c3fb7592..0185d4a8 100644 --- a/src/schema-gen/InspectorXSLT/testing/tests/inspector-functional-xspec/xspec-patterns.xspec +++ b/src/schema-gen/InspectorXSLT/testing/tests/inspector-functional-xspec/xspec-patterns.xspec @@ -91,6 +91,7 @@ Modes to test: + diff --git a/src/schema-gen/JSON-schema/choice-split.xsl b/src/schema-gen/JSON-schema/choice-split.xsl index ca8297bf..e2c64d2a 100644 --- a/src/schema-gen/JSON-schema/choice-split.xsl +++ b/src/schema-gen/JSON-schema/choice-split.xsl @@ -16,7 +16,7 @@ - + @@ -40,6 +40,7 @@ + @@ -58,9 +59,8 @@ - { generate-id() } { count($splitters) }: { ($splitters ! serialize(.)) => string-join(' ==== ') } + - @@ -73,6 +73,7 @@ + diff --git a/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/choice-splitting.xspec b/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/choice-splitting.xspec index 9b684830..c744927b 100644 --- a/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/choice-splitting.xspec +++ b/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/choice-splitting.xspec @@ -2,8 +2,7 @@ - - + diff --git a/src/testing/Makefile b/src/testing/Makefile new file mode 100644 index 00000000..b40d9ccc --- /dev/null +++ b/src/testing/Makefile @@ -0,0 +1,71 @@ +include ./make_common.mk + +# TODO: Build out targets and runtimes for XML <-> JSON conversions +# Including XSpec testing of conversion pipelines and steps +# Extend and integrate unit tests into this Makefile + +# See the Makefile at ../schema-gen/InspectorXSLT/Makefile for more logic to borrow + +# INCLUDES: +# smoke-test - smoke testing - whether artifacts are produced as expected +# xspec - run XSpec tests in designated folder +# clean - clean up designated output folder + +module_path:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +output_folder:=$(module_path)/test_output +xspec_script=$(realpath $(module_path)/../../../support/xspec-dev/mvn-saxon-xspec-batch-quiet.sh) +xspec_ci_script=$(realpath $(module_path)/../../../support/xspec-dev/mvn-saxon-xspec-batch.sh) +metaschema_validate_xsd_script=$(realpath $(module_path)/../validate/mvn-metaschema-xsd-validate-xpl.sh) +metaschema_validate_schematron_script=$(realpath $(module_path)/../validate/mvn-composition-validate-xpl.sh) + +folder=. +METASCHEMA=models_metaschema.xml + + +.PHONY: test +test: smoke-test ## Run all tests + + +# .PHONY: spec-test # +# spec-test: ## Run all specification tests +# LOGFILE="$(output_folder)/inspector-functional-tests.log" $(xspec_ci_script) \ +# "folder=$(module_path)/testing/tests/inspector-functional-xspec" \ +# "report-to=$(output_folder)/inspector-functional-tests_report.html" \ +# "junit-to=$(output_folder)/inspector-functional-tests_junit-report.xml" \ +# "stop-on-error=yes" \ +# "recurse=yes" + + +.PHONY: smoke-test ## Pre-check models_metaschema.xml +smoke-test: validate_models_metaschema ## Pre-check test inputs + + +.PHONY: validate_models_metaschema +validate_models_metaschema: ## Validate models_metaschema.xml with the Metaschema XSD and Schematron + $(metaschema_validate_xsd_script) models_metaschema.xml + $(metaschema_validate_schematron_script) models_metaschema.xml + + +.PHONY: metaschema-validate-xsd +metaschema-validate-xsd: ## Validate (top level or component module) metaschema with the Metaschema XSD + $(metaschema_validate_xsd_script) METASCHEMA + + +.PHONY: metaschema-validate-schematron +metaschema-validate-schematron: ## Pre-check metaschema with the Metaschema Composition Checker Schematron + $(metaschema_validate_xsd_script) METASCHEMA + + +.PHONY: xspec +xspec: ## Run all *.xspec in a designated folder, quietly - use folder=[folder] + LOGFILE="$(output_folder)/$(folder)-xspec-tests.log" $(xspec_script) \ + "baseURI=file:$(module_path)/" \ + "folder=$(folder)" \ + "report-to=$(output_folder)/inspector-$(folder)-tests_report.html" \ + "stop-on-error=no" \ + "recurse=yes" + + +.PHONY: clean +clean: ## Remove test output + rm -fr $(output_folder)/* \ No newline at end of file diff --git a/src/testing/issue_235_regression.xspec b/src/testing/issue_235_regression.xspec index a61e54a9..3398df48 100644 --- a/src/testing/issue_235_regression.xspec +++ b/src/testing/issue_235_regression.xspec @@ -3,6 +3,8 @@ xmlns:x="http://www.jenitennison.com/xslt/xspec" xmlns:mv="http://g" stylesheet="../converter-gen/xml-to-json/supermodel-to-json.xsl"> + + diff --git a/src/testing/readme.md b/src/testing/readme.md new file mode 100644 index 00000000..440a2b4c --- /dev/null +++ b/src/testing/readme.md @@ -0,0 +1,38 @@ +# Testing Resources + +See the [TESTING](../TESTING.md) docs for info on testing. + +This directory contains misc testing resources that do not have a home elsewhere, or have not yet been moved to their proper homes. + +## Illustrative Model Metaschema + +Dynamic testing of Metaschema-based data conversions, XML to JSON and back. + +- models-testdata.xml +- models_metaschema.xml +- test-json-conversions.xpl +- test-xml-conversions.xpl +- test-xml-json-roundtrip.xpl + +## Demo JSON Serialization Debug XSpec + +The converters when targeting JSON depend on a serialization step found to be buggy in an OSCAL issue. The files `issue_235_regression.xspec` and `issue_235_regression-metaschema.xml` support testing for this solution as well as (if maintained) regression testing going forward. + +## Towards CI/CD + +Try `make` to use utilities installed for CI/CD: + +``` +> make smoke-test +``` + +Currently, smoke testing includes XSD and Schematron validation of the `models_metaschema.xml` test metaschema, using the XSD and "Composition Check" Schematron. + +``` +> make validate_models_metaschema +``` + +Does this as well, only without any other smoke testing added since this page was written. + +See `make help` from a `bash` command line for more on Make targets available in this folder. + diff --git a/src/validate/METASCHEMA-SCHXSLT-VALIDATE.xpl b/src/validate/METASCHEMA-SCHXSLT-VALIDATE.xpl index 53ce2154..a812d25d 100644 --- a/src/validate/METASCHEMA-SCHXSLT-VALIDATE.xpl +++ b/src/validate/METASCHEMA-SCHXSLT-VALIDATE.xpl @@ -3,7 +3,7 @@ xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0" xmlns:metaschema="http://csrc.nist.gov/ns/metaschema/1.0" xmlns:schxslt="https://doi.org/10.5281/zenodo.1495494" - type="metaschema:METASCHEMA-ALL-SCHEMAS" name="METASCHEMA-ALL-SCHEMAS"> + type="metaschema:METASCHEMA-SCHXSLT-VALIDATE" name="METASCHEMA-SCHXSLT-VALIDATE"> diff --git a/src/validate/METASCHEMA-VALIDATE.xpl b/src/validate/METASCHEMA-VALIDATE.xpl deleted file mode 100644 index c0668bb2..00000000 --- a/src/validate/METASCHEMA-VALIDATE.xpl +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/validate/METASCHEMA-XSD-VALIDATE.xpl b/src/validate/METASCHEMA-XSD-VALIDATE.xpl new file mode 100644 index 00000000..cb3f6a47 --- /dev/null +++ b/src/validate/METASCHEMA-XSD-VALIDATE.xpl @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SUCCESS - XSD Validation has apparently run without error on document { $base } + + + + + + + + + \ No newline at end of file diff --git a/src/validate/mvn-metaschema-xsd-validate-xpl.sh b/src/validate/mvn-metaschema-xsd-validate-xpl.sh new file mode 100644 index 00000000..cf163d52 --- /dev/null +++ b/src/validate/mvn-metaschema-xsd-validate-xpl.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# shellcheck source=../common/subcommand_common.bash +source "$SCRIPT_DIR/../common/subcommand_common.bash" + +usage() { + cat < - You are good - well-formed, no reported errors + You are good - well-formed, with no reported Schematron messages (reports or failed assertions) From 15074a6b92f6de70a006e72d4b60ac7b278d2aa7 Mon Sep 17 00:00:00 2001 From: Wendell Piez Date: Fri, 22 Mar 2024 17:36:19 -0400 Subject: [PATCH 06/19] Now more better support of JSON Schema field testing, with document proof sets --- src/Makefile | 4 + .../issue_235_regression-metaschema.xml | 0 .../issue_235_regression.xspec | 2 +- src/schema-gen/Makefile | 15 +++- src/testing/Makefile | 32 +++----- src/testing/issue105/CHOICES-MAKE-JSON.xpl | 72 ++++++++++++++++++ .../issue105/JSON-VALIDATE-CHOICES.xp3 | 63 ++++++++++++++++ src/testing/issue105/XSD-VALIDATE-CHOICES.xpl | 5 +- src/testing/issue105/choices-json-validate.sh | 27 +++++++ .../issue105/choices_xml-converter.xsl | 17 +++++ .../json-schema-crosscheck-choices.sh | 47 ++++++++++++ .../issue105/json-validation-screener.xsl | 39 ++++++++++ .../issue105/json-validation-summarizer.xsl | 43 +++++++++++ .../issue105/refresh-choices-converters.sh | 73 +++++++++++++++++++ .../issue105/refresh-choices-schemas.sh | 5 -- src/testing/issue105/run-xproc3.sh | 24 ++++++ src/testing/issue105/summary-plaintext.xsl | 30 ++++++++ src/testing/readme.md | 31 ++------ src/validate/Makefile | 15 +++- support/download-jars.sh | 65 +++++++++++++++++ 20 files changed, 552 insertions(+), 57 deletions(-) rename src/{testing => converter-gen}/issue_235_regression-metaschema.xml (100%) rename src/{testing => converter-gen}/issue_235_regression.xspec (98%) create mode 100644 src/testing/issue105/CHOICES-MAKE-JSON.xpl create mode 100644 src/testing/issue105/JSON-VALIDATE-CHOICES.xp3 create mode 100644 src/testing/issue105/choices-json-validate.sh create mode 100644 src/testing/issue105/choices_xml-converter.xsl create mode 100644 src/testing/issue105/json-schema-crosscheck-choices.sh create mode 100644 src/testing/issue105/json-validation-screener.xsl create mode 100644 src/testing/issue105/json-validation-summarizer.xsl create mode 100644 src/testing/issue105/refresh-choices-converters.sh create mode 100644 src/testing/issue105/run-xproc3.sh create mode 100644 src/testing/issue105/summary-plaintext.xsl create mode 100644 support/download-jars.sh diff --git a/src/Makefile b/src/Makefile index 71cdcad9..8253a313 100644 --- a/src/Makefile +++ b/src/Makefile @@ -10,6 +10,10 @@ dirs:=$(shell find '.' ! -wholename ./Makefile -name 'Makefile' -printf "%h\n") test: ## Run all tests $(call FOREACH_MAKE,$@,$(dirs)) +.PHONY: pre-checks +pre-checks: ## Run all "pre checks", enforcing validation contracts across input artifacts + $(call FOREACH_MAKE_OPTIONAL,$@,$(dirs)) + .PHONY: smoke-test smoke-test: ## Run all "smoke tests", establishing a baseline of sanity across the project $(call FOREACH_MAKE_OPTIONAL,$@,$(dirs)) diff --git a/src/testing/issue_235_regression-metaschema.xml b/src/converter-gen/issue_235_regression-metaschema.xml similarity index 100% rename from src/testing/issue_235_regression-metaschema.xml rename to src/converter-gen/issue_235_regression-metaschema.xml diff --git a/src/testing/issue_235_regression.xspec b/src/converter-gen/issue_235_regression.xspec similarity index 98% rename from src/testing/issue_235_regression.xspec rename to src/converter-gen/issue_235_regression.xspec index 3398df48..9f818c69 100644 --- a/src/testing/issue_235_regression.xspec +++ b/src/converter-gen/issue_235_regression.xspec @@ -2,7 +2,7 @@ + stylesheet="xml-to-json/supermodel-to-json.xsl"> diff --git a/src/schema-gen/Makefile b/src/schema-gen/Makefile index 6a23d2e1..e88e0d86 100644 --- a/src/schema-gen/Makefile +++ b/src/schema-gen/Makefile @@ -4,13 +4,24 @@ include ../testing/make_common.mk test_metaschema:=../testing/models_metaschema.xml output_folder:=test_output + .PHONY: test -test: smoke-test ## Run all tests +test: smoke-test unit-test ## Run all tests + .PHONY: smoke-test -smoke-test: ## Run all smoke-tests +smoke-test: ## Generate schemas from ../testing/models_metaschema.xml ./mvn-schemas-xpl.sh "$(test_metaschema)" $(output_folder) models_metaschema + +.PHONY: unit-test +unit-test: xsd-proof-test ## Generate, validate and test run an XSD for ../testing/models_metaschema.xml + + +.PHONY: xsd-proof-test +xsd-proof-test: ## Proof test XSD schema for ../testing/models_metaschema.xml + ./mvn-xsd-proofcheck-xpl.sh "$(test_metaschema)" + .PHONY: clean clean: ## Remove test output rm -fr $(output_folder)/* diff --git a/src/testing/Makefile b/src/testing/Makefile index b40d9ccc..8c0f7751 100644 --- a/src/testing/Makefile +++ b/src/testing/Makefile @@ -1,13 +1,13 @@ include ./make_common.mk # TODO: Build out targets and runtimes for XML <-> JSON conversions -# Including XSpec testing of conversion pipelines and steps +# Including XSpec testing of conversion pipelines and steps # Extend and integrate unit tests into this Makefile - + # See the Makefile at ../schema-gen/InspectorXSLT/Makefile for more logic to borrow # INCLUDES: -# smoke-test - smoke testing - whether artifacts are produced as expected +# smoke-test - smoke testing - for this directory, pre-checks models_metaschema.xml # xspec - run XSpec tests in designated folder # clean - clean up designated output folder @@ -19,12 +19,11 @@ metaschema_validate_xsd_script=$(realpath $(module_path)/../validate/mvn-metasch metaschema_validate_schematron_script=$(realpath $(module_path)/../validate/mvn-composition-validate-xpl.sh) folder=. -METASCHEMA=models_metaschema.xml +test_metaschema=models_metaschema.xml .PHONY: test -test: smoke-test ## Run all tests - +test: smoke-test spec-test ## Run all tests # .PHONY: spec-test # # spec-test: ## Run all specification tests @@ -36,26 +35,16 @@ test: smoke-test ## Run all tests # "recurse=yes" -.PHONY: smoke-test ## Pre-check models_metaschema.xml -smoke-test: validate_models_metaschema ## Pre-check test inputs +.PHONY: smoke-test +smoke-test: pre-checks ## For this directory, run pre-checks for other processes -.PHONY: validate_models_metaschema -validate_models_metaschema: ## Validate models_metaschema.xml with the Metaschema XSD and Schematron +.PHONY: pre-checks +pre-checks: ## Validate and check models_metaschema.xml $(metaschema_validate_xsd_script) models_metaschema.xml $(metaschema_validate_schematron_script) models_metaschema.xml -.PHONY: metaschema-validate-xsd -metaschema-validate-xsd: ## Validate (top level or component module) metaschema with the Metaschema XSD - $(metaschema_validate_xsd_script) METASCHEMA - - -.PHONY: metaschema-validate-schematron -metaschema-validate-schematron: ## Pre-check metaschema with the Metaschema Composition Checker Schematron - $(metaschema_validate_xsd_script) METASCHEMA - - .PHONY: xspec xspec: ## Run all *.xspec in a designated folder, quietly - use folder=[folder] LOGFILE="$(output_folder)/$(folder)-xspec-tests.log" $(xspec_script) \ @@ -68,4 +57,5 @@ xspec: ## Run all *.xspec in a designated folder, quietly - use folder=[folder] .PHONY: clean clean: ## Remove test output - rm -fr $(output_folder)/* \ No newline at end of file + rm -fr $(output_folder)/* + diff --git a/src/testing/issue105/CHOICES-MAKE-JSON.xpl b/src/testing/issue105/CHOICES-MAKE-JSON.xpl new file mode 100644 index 00000000..48a2618c --- /dev/null +++ b/src/testing/issue105/CHOICES-MAKE-JSON.xpl @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/testing/issue105/JSON-VALIDATE-CHOICES.xp3 b/src/testing/issue105/JSON-VALIDATE-CHOICES.xp3 new file mode 100644 index 00000000..f2d11e52 --- /dev/null +++ b/src/testing/issue105/JSON-VALIDATE-CHOICES.xp3 @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/testing/issue105/XSD-VALIDATE-CHOICES.xpl b/src/testing/issue105/XSD-VALIDATE-CHOICES.xpl index 69012066..9372d03a 100644 --- a/src/testing/issue105/XSD-VALIDATE-CHOICES.xpl +++ b/src/testing/issue105/XSD-VALIDATE-CHOICES.xpl @@ -8,8 +8,7 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:nm="http://csrc.nist.gov/ns/metaschema" xmlns:xs="http://www.w3.org/2001/XMLSchema"> - - + @@ -138,7 +137,7 @@ select="child::NOMINALLY-VALID/document[@VALIDATION-STATUS='XSD-INVALID'] | child::NOMINALLY-INVALID/document[not(@VALIDATION-STATUS='XSD-INVALID')]"/> - Checking { count(*/*) }{ if (count(*/*) eq 1) then ' document' else ' documents' } against an OSCAL Catalog XSD ... + Checking { count(*/*) }{ if (count(*/*) eq 1) then ' document' else ' documents' } against a 'choices' XSD ... diff --git a/src/testing/issue105/choices-json-validate.sh b/src/testing/issue105/choices-json-validate.sh new file mode 100644 index 00000000..3061c473 --- /dev/null +++ b/src/testing/issue105/choices-json-validate.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# shellcheck source=../common/subcommand_common.bash + +source "$SCRIPT_DIR/../../common/subcommand_common.bash" + +usage() { + cat < + + + + + + yes + + + + + + + diff --git a/src/testing/issue105/json-schema-crosscheck-choices.sh b/src/testing/issue105/json-schema-crosscheck-choices.sh new file mode 100644 index 00000000..864ef9f8 --- /dev/null +++ b/src/testing/issue105/json-schema-crosscheck-choices.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# shellcheck source=../common/subcommand_common.bash + +# source "$SCRIPT_DIR/../common/subcommand_common.bash" + +# XProc produces Inspector XSLT with a fail-safe check by compiling and running it +XPROC_FILE="${SCRIPT_DIR}/XSD-VALIDATE-OSCAL-SAMPLES.xpl" + +usage() { + cat < + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/testing/issue105/json-validation-summarizer.xsl b/src/testing/issue105/json-validation-summarizer.xsl new file mode 100644 index 00000000..d96b4514 --- /dev/null +++ b/src/testing/issue105/json-validation-summarizer.xsl @@ -0,0 +1,43 @@ + + + + + + + + Checking { count(*/*) }{ if (count(*/*) eq 1) then ' document' else ' documents' } against a 'choices' JSON Schema ... + + + + ALL GOOD - confirming expected results from JSON Schema validation + + + + + + VALIDATION ANOMALY: a document collected as 'valid' is found to be INVALID + + + + VALIDATION ANOMALY: a document collected as 'invalid' is found to be VALID + + + + CONFIRMED (invalid) + + + + CONFIRMED (valid) + + + + \ No newline at end of file diff --git a/src/testing/issue105/refresh-choices-converters.sh b/src/testing/issue105/refresh-choices-converters.sh new file mode 100644 index 00000000..d3c5d45d --- /dev/null +++ b/src/testing/issue105/refresh-choices-converters.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# shellcheck source=../common/subcommand_common.bash + +source "$SCRIPT_DIR/../../common/subcommand_common.bash" + +usage() { + cat <&2 + rm -f "$XJ_CONVERTER" +fi + +if [ -e "$JX_CONVERTER" ]; then + echo "Overwriting prior $JX_CONVERTER..." >&2 + rm -f "$JX_CONVERTER" +fi + +invoke_calabash "${CALABASH_ARGS}" + +if [ -e "$XJ_CONVERTER" ] && [ -e "$JX_CONVERTER" ]; then + echo "Wrote fresh XML/JSON conversion XSLTs into ${OUTPUT_DIR}" >&2 +fi + +fi diff --git a/src/testing/issue105/refresh-choices-schemas.sh b/src/testing/issue105/refresh-choices-schemas.sh index 327a0925..1136f426 100644 --- a/src/testing/issue105/refresh-choices-schemas.sh +++ b/src/testing/issue105/refresh-choices-schemas.sh @@ -5,11 +5,6 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$SCRIPT_DIR/../../common/subcommand_common.bash" -# XProc produces Inspector XSLT with a fail-safe check by compiling and running it -XPROC_FILE="${SCRIPT_DIR}/COMPUTER-INSPECTOR-PRODUCE.xpl" - -XSLT_RESULT=${SCRIPT_DIR}/current/computer_metaschema-inspector.xsl - usage() { cat < + + + + + + + + + + { (1 to 12) ! ':::::' } + + + + + + + + + + : { . } + + \ No newline at end of file diff --git a/src/testing/readme.md b/src/testing/readme.md index 440a2b4c..8d1703f0 100644 --- a/src/testing/readme.md +++ b/src/testing/readme.md @@ -4,7 +4,14 @@ See the [TESTING](../TESTING.md) docs for info on testing. This directory contains misc testing resources that do not have a home elsewhere, or have not yet been moved to their proper homes. -## Illustrative Model Metaschema +## Warning: taking care editing resources + +The files and utilities in this subdirectory are used as inputs in testing across the repository. When editing them, be sure that dependent operations are still running. + +Don't edit and amend these resources without performing due diligence to align processes and tests that depend on them. + +## In this directory + Dynamic testing of Metaschema-based data conversions, XML to JSON and back. @@ -14,25 +21,3 @@ Dynamic testing of Metaschema-based data conversions, XML to JSON and back. - test-xml-conversions.xpl - test-xml-json-roundtrip.xpl -## Demo JSON Serialization Debug XSpec - -The converters when targeting JSON depend on a serialization step found to be buggy in an OSCAL issue. The files `issue_235_regression.xspec` and `issue_235_regression-metaschema.xml` support testing for this solution as well as (if maintained) regression testing going forward. - -## Towards CI/CD - -Try `make` to use utilities installed for CI/CD: - -``` -> make smoke-test -``` - -Currently, smoke testing includes XSD and Schematron validation of the `models_metaschema.xml` test metaschema, using the XSD and "Composition Check" Schematron. - -``` -> make validate_models_metaschema -``` - -Does this as well, only without any other smoke testing added since this page was written. - -See `make help` from a `bash` command line for more on Make targets available in this folder. - diff --git a/src/validate/Makefile b/src/validate/Makefile index 665c7ee4..683f1d8f 100644 --- a/src/validate/Makefile +++ b/src/validate/Makefile @@ -1,11 +1,22 @@ include ../testing/make_common.mk +# Note that Makefile definitions in other subdirectories use scripts defined in this one + + # XML Calabash prefers absolute paths test_metaschema:=../testing/models_metaschema.xml .PHONY: test -test: smoke-test ## Run all tests +test: pre-checks smoke-test ## Run all tests + +# As a pre-check we validate the test metaschema first; +# if this succeeds we check its composition + +.PHONY: pre-checks ## Validate test inputs (model metaschema) + ./mvn-metaschema-xsd-validate-xpl.sh "$(test_metaschema)" + ./mvn-composition-validate-xpl.sh "$(test_metaschema)" + .PHONY: smoke-test smoke-test: ## Run all smoke-tests - ./mvn-composition-validate-xpl.sh "$(test_metaschema)" + diff --git a/support/download-jars.sh b/support/download-jars.sh new file mode 100644 index 00000000..1e072ad2 --- /dev/null +++ b/support/download-jars.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +# This script attempts to download MorganaXProcIII + + +mkdir -p lib + +download() { + proj=$1 + lcproj=`echo $proj | tr '[:upper:'] '[:lower:]'` + uri="https://github.com/nineml/$lcproj/releases/latest" + ver=`curl -sI $uri | grep -i location: | sed "s#^.*/tag/##" | tr -d '\n\r'` + if [ ! -f "lib/$proj-$ver.jar" ]; then + echo "Downloading $proj ..." + rm -f lib/$proj-*.jar + uri="https://github.com/nineml/$lcproj/releases/download/$ver/$lcproj-$ver.zip" + curl -s -L -o lib/$lcproj-$ver.zip $uri + cd lib + unzip -q -j $lcproj-$ver.zip "*.jar" + rm $lcproj-$ver.zip + cd .. + fi +} + +download CoffeeGrinder +download CoffeeFilter +download CoffeeSacks + +if [ ! -d lib/xmlcalabash1-coffeepress.jar ]; then + echo "Downloading CoffeePress ..." + curl -s -L -o coffeepress.zip \ + https://github.com/ndw/xmlcalabash1-coffeepress/releases/download/1.0.0/xmlcalabash1-coffeepress-1.0.0.zip + unzip -q -j coffeepress.zip "*.jar" + mv *.jar lib/ + rm -f coffeepress.zip +fi + +if [ ! -d xmlcalabash-1.5.7-120 ]; then + echo "Downloading XML Calabash ..." + curl -s -L -o xmlcalabash.zip \ + https://github.com/ndw/xmlcalabash1/releases/download/1.5.7-120/xmlcalabash-1.5.7-120.zip + unzip -q xmlcalabash.zip + rm -f xmlcalabash.zip +fi + +if [ ! -f saxon-he-12.3.jar ]; then + echo "Downloading Saxon 12.3 ..." + curl -s -L -o SaxonHE12-3J.zip https://www.saxonica.com/download/SaxonHE12-3J.zip + unzip -q -o SaxonHE12-3J.zip "*.jar" + rm -f SaxonHE12-3J.zip saxon-he-test*.jar saxon-he-xqj*.jar +fi + +if [ ! -f saxon-he-12.3.jar ]; then + echo "Downloading Saxon 12.3 ..." + curl -s -L -o SaxonHE12-3J.zip https://www.saxonica.com/download/SaxonHE12-3J.zip + unzip -q -o SaxonHE12-3J.zip "*.jar" + rm -f SaxonHE12-3J.zip saxon-he-test*.jar saxon-he-xqj*.jar +fi + + + https://sourceforge.net/projects/morganaxproc-iiise/files/MorganaXProc-IIIse-1.3.6/MorganaXProc-IIIse-1.3.6.zip/download + + + + From 5810d2ced5c1dce05820631d75263a7d58c8ca6c Mon Sep 17 00:00:00 2001 From: Wendell Piez Date: Tue, 7 May 2024 17:51:25 -0400 Subject: [PATCH 07/19] Rearranging submodules; catching up with JSON schema modeling issue --- .gitmodules | 11 +- src/schema-gen/InspectorXSLT/Makefile | 4 +- src/schema-gen/JSON-schema/Makefile | 4 +- src/testing/Makefile | 4 +- src/testing/issue105/CHOICES-MAKE-JSON.xpl | 5 +- .../issue105/choices-invalid/colors05.xml | 4 +- .../current/choices_schema-proposed.json | 34 +- .../json-schema-crosscheck-choices.sh | 2 +- .../JSON-VALIDATE-CHOICES.xp3 | 32 +- .../json-validation-screener.xsl | 0 .../json-validation-summarizer.xsl | 3 +- .../summary-plaintext.xsl | 8 +- support/schxslt | 1 - support/xslt3-functions | 1 + support/xspec | 1 - support/xspec-dev/XSPEC-BATCH.xsl | 334 ----------- support/xspec-dev/XSPEC-SINGLE.xsl | 100 ---- .../xspec-dev/mvn-saxon-xspec-batch-quiet.sh | 80 --- support/xspec-dev/mvn-saxon-xspec-batch.sh | 79 --- support/xspec-dev/mvn-saxon-xspec-html.sh | 36 -- support/xspec-dev/mvn-xproc-xspec-html.sh | 33 -- support/xspec-dev/planning.md | 20 - support/xspec-dev/readme.md | 175 ------ support/xspec-dev/testing/copy_me.xsl | 9 - support/xspec-dev/testing/iso8601.ixml | 171 ------ support/xspec-dev/testing/ixml-demo.xsl | 57 -- support/xspec-dev/testing/ixml-parsing.xspec | 92 --- .../testing/mvn-xproc-xspec-test-batch.sh | 32 -- .../xspec-dev/testing/test/xspec-basicR.xspec | 47 -- support/xspec-dev/testing/xspec-basic.xspec | 47 -- support/xspec-dev/testing/xspec-shell.xspec | 35 -- .../xspec-dev/testing/xspec-test-batch.xpl | 75 --- support/xspec-dev/xspec-assurance.sch | 13 - support/xspec-dev/xspec-batch-report.xpl | 98 ---- support/xspec-dev/xspec-mx-html-report.xsl | 538 ------------------ support/xspec-dev/xspec-single-report.xpl | 85 --- .../xspec-single-xspec-repo-report.xpl | 78 --- support/xspec-dev/xspec-summarize.xsl | 50 -- support/xspec-dev/xspec-summary-reduce.xsl | 68 --- 39 files changed, 57 insertions(+), 2409 deletions(-) rename src/testing/issue105/{ => jsonv7-validate}/JSON-VALIDATE-CHOICES.xp3 (69%) rename src/testing/issue105/{ => jsonv7-validate}/json-validation-screener.xsl (100%) rename src/testing/issue105/{ => jsonv7-validate}/json-validation-summarizer.xsl (95%) rename src/testing/issue105/{ => jsonv7-validate}/summary-plaintext.xsl (84%) delete mode 160000 support/schxslt create mode 160000 support/xslt3-functions delete mode 160000 support/xspec delete mode 100644 support/xspec-dev/XSPEC-BATCH.xsl delete mode 100644 support/xspec-dev/XSPEC-SINGLE.xsl delete mode 100644 support/xspec-dev/mvn-saxon-xspec-batch-quiet.sh delete mode 100755 support/xspec-dev/mvn-saxon-xspec-batch.sh delete mode 100755 support/xspec-dev/mvn-saxon-xspec-html.sh delete mode 100755 support/xspec-dev/mvn-xproc-xspec-html.sh delete mode 100644 support/xspec-dev/planning.md delete mode 100644 support/xspec-dev/readme.md delete mode 100644 support/xspec-dev/testing/copy_me.xsl delete mode 100644 support/xspec-dev/testing/iso8601.ixml delete mode 100644 support/xspec-dev/testing/ixml-demo.xsl delete mode 100644 support/xspec-dev/testing/ixml-parsing.xspec delete mode 100644 support/xspec-dev/testing/mvn-xproc-xspec-test-batch.sh delete mode 100644 support/xspec-dev/testing/test/xspec-basicR.xspec delete mode 100644 support/xspec-dev/testing/xspec-basic.xspec delete mode 100644 support/xspec-dev/testing/xspec-shell.xspec delete mode 100644 support/xspec-dev/testing/xspec-test-batch.xpl delete mode 100644 support/xspec-dev/xspec-assurance.sch delete mode 100644 support/xspec-dev/xspec-batch-report.xpl delete mode 100644 support/xspec-dev/xspec-mx-html-report.xsl delete mode 100644 support/xspec-dev/xspec-single-report.xpl delete mode 100644 support/xspec-dev/xspec-single-xspec-repo-report.xpl delete mode 100644 support/xspec-dev/xspec-summarize.xsl delete mode 100644 support/xspec-dev/xspec-summary-reduce.xsl diff --git a/.gitmodules b/.gitmodules index c3cb9c7f..f57c9ade 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,13 +1,8 @@ -[submodule "support/xspec"] - path = support/xspec - url = https://github.com/xspec/xspec.git [submodule "support/metaschema"] path = support/metaschema url = https://github.com/usnistgov/metaschema.git branch = develop fetchRecurseSubmodules = false -[submodule "support/schxslt"] - path = support/schxslt - url = https://github.com/schxslt/schxslt.git -[submodule "metaschema"] - url = https://github.com/usnistgov/metaschema.git +[submodule "support/xslt3-functions"] + path = support/xslt3-functions + url = https://github.com/usnistgov/xslt3-functions.git diff --git a/src/schema-gen/InspectorXSLT/Makefile b/src/schema-gen/InspectorXSLT/Makefile index 5a9e87bb..5d7854dc 100644 --- a/src/schema-gen/InspectorXSLT/Makefile +++ b/src/schema-gen/InspectorXSLT/Makefile @@ -10,8 +10,8 @@ include ../../testing/make_common.mk module_path:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) output_folder:=$(module_path)/test_output -xspec_script=$(realpath $(module_path)/../../../support/xspec-dev/mvn-saxon-xspec-batch-quiet.sh) -xspec_ci_script=$(realpath $(module_path)/../../../support/xspec-dev/mvn-saxon-xspec-batch.sh) +xspec_script=$(realpath $(module_path)/../../../support/xslt3-functions/xspec-dev/mvn-saxon-xspec-batch-quiet.sh) +xspec_ci_script=$(realpath $(module_path)/../../../support/xslt3-functions/xspec-dev/mvn-saxon-xspec-batch.sh) smoketest_script=$(realpath $(module_path)/testing/smoketest-computer-inspector.sh) testing-refresh_script=$(realpath $(module_path)/testing/refresh-test-inspectors.sh) folder=. diff --git a/src/schema-gen/JSON-schema/Makefile b/src/schema-gen/JSON-schema/Makefile index fbb6fdb9..2be33b51 100644 --- a/src/schema-gen/JSON-schema/Makefile +++ b/src/schema-gen/JSON-schema/Makefile @@ -12,8 +12,8 @@ include ../../testing/make_common.mk module_path:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) output_folder:=$(module_path)/test_output -xspec_script=$(realpath $(module_path)/../../../support/xspec-dev/mvn-saxon-xspec-batch-quiet.sh) -xspec_ci_script=$(realpath $(module_path)/../../../support/xspec-dev/mvn-saxon-xspec-batch.sh) +xspec_script=$(realpath $(module_path)/../../../support/xslt3-functions/xspec-dev/mvn-saxon-xspec-batch-quiet.sh) +xspec_ci_script=$(realpath $(module_path)/../../../support/xslt3-functions/xspec-dev/mvn-saxon-xspec-batch.sh) folder=. .PHONY: test diff --git a/src/testing/Makefile b/src/testing/Makefile index 8c0f7751..d9fca3dd 100644 --- a/src/testing/Makefile +++ b/src/testing/Makefile @@ -13,8 +13,8 @@ include ./make_common.mk module_path:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) output_folder:=$(module_path)/test_output -xspec_script=$(realpath $(module_path)/../../../support/xspec-dev/mvn-saxon-xspec-batch-quiet.sh) -xspec_ci_script=$(realpath $(module_path)/../../../support/xspec-dev/mvn-saxon-xspec-batch.sh) +xspec_script=$(realpath $(module_path)/../../../support/xslt3-functions/xspec-dev/mvn-saxon-xspec-batch-quiet.sh) +xspec_ci_script=$(realpath $(module_path)/../../../support/xslt3-functions/xspec-dev/mvn-saxon-xspec-batch.sh) metaschema_validate_xsd_script=$(realpath $(module_path)/../validate/mvn-metaschema-xsd-validate-xpl.sh) metaschema_validate_schematron_script=$(realpath $(module_path)/../validate/mvn-composition-validate-xpl.sh) diff --git a/src/testing/issue105/CHOICES-MAKE-JSON.xpl b/src/testing/issue105/CHOICES-MAKE-JSON.xpl index 48a2618c..da0224b6 100644 --- a/src/testing/issue105/CHOICES-MAKE-JSON.xpl +++ b/src/testing/issue105/CHOICES-MAKE-JSON.xpl @@ -5,7 +5,8 @@ type="metaschema:CHOICES-MAKE-JSON" name="CHOICES-MAKE-JSON" xmlns:x="http://www.jenitennison.com/xslt/xspec" - xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:nm="http://csrc.nist.gov/ns/metaschema" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:nm="http://csrc.nist.gov/ns/metaschema" xmlns:xs="http://www.w3.org/2001/XMLSchema"> @@ -44,8 +45,6 @@ - - diff --git a/src/testing/issue105/choices-invalid/colors05.xml b/src/testing/issue105/choices-invalid/colors05.xml index 153f01da..5089a445 100644 --- a/src/testing/issue105/choices-invalid/colors05.xml +++ b/src/testing/issue105/choices-invalid/colors05.xml @@ -12,8 +12,8 @@ - + - + \ No newline at end of file diff --git a/src/testing/issue105/current/choices_schema-proposed.json b/src/testing/issue105/current/choices_schema-proposed.json index 47bdb296..5b1a99d8 100644 --- a/src/testing/issue105/current/choices_schema-proposed.json +++ b/src/testing/issue105/current/choices_schema-proposed.json @@ -47,7 +47,7 @@ "description": "A grouping.", "$id": "#/definitions/choices-choices:group", "type": "object", - "oneOf": [ + "anyOf": [ { "properties": { "family": { @@ -99,7 +99,7 @@ "description": "A blue color.", "$id": "#/definitions/choices-choices:blue", "type": "object", - "oneOf": [ + "anyOf": [ { "properties": { "aquamarine": { @@ -109,29 +109,32 @@ "additionalProperties": false } }, - "additionalProperties": false + "additionalProperties": false, + "minProperties": 1 }, { "properties": { - "aquamarine": { + "midnight": { "title": "Midnight", "description": "Calmly resting.", "type": "object", "additionalProperties": false } }, - "additionalProperties": false + "additionalProperties": false, + "minProperties": 1 }, { "properties": { - "aquamarine": { + "lapis": { "title": "Lapis", "description": "In repose.", "type": "object", "additionalProperties": false } }, - "additionalProperties": false + "additionalProperties": false, + "minProperties": 1 } ] }, @@ -140,7 +143,7 @@ "description": "A red color.", "$id": "#/definitions/choices-choices:red", "type": "object", - "oneOf": [ + "anyOf": [ { "properties": { "firetruck": { @@ -149,7 +152,9 @@ "type": "object", "additionalProperties": false } - } + }, + "additionalProperties": false, + "minProperties": 1 }, { "properties": { @@ -159,7 +164,9 @@ "type": "object", "additionalProperties": false } - } + }, + "additionalProperties": false, + "minProperties": 1 }, { "properties": { @@ -169,10 +176,11 @@ "type": "object", "additionalProperties": false } - } + }, + "additionalProperties": false, + "minProperties": 1 } - ], - "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]+", diff --git a/src/testing/issue105/json-schema-crosscheck-choices.sh b/src/testing/issue105/json-schema-crosscheck-choices.sh index 864ef9f8..1528bd4e 100644 --- a/src/testing/issue105/json-schema-crosscheck-choices.sh +++ b/src/testing/issue105/json-schema-crosscheck-choices.sh @@ -25,7 +25,7 @@ ADDITIONAL_ARGS=$(echo "${*// /\\ }") CALL_MORGANA=../../../support/lib/MorganaXProc-IIIse-1.3.6/Morgana.sh -PIPELINE3=JSON-VALIDATE-CHOICES.xp3 +PIPELINE3=jsonv7-validate/JSON-VALIDATE-CHOICES.xp3 MORGANA_ARGS="$PIPELINE3 -xslt-connector=saxon12-3 $ADDITIONAL_ARGS" diff --git a/src/testing/issue105/JSON-VALIDATE-CHOICES.xp3 b/src/testing/issue105/jsonv7-validate/JSON-VALIDATE-CHOICES.xp3 similarity index 69% rename from src/testing/issue105/JSON-VALIDATE-CHOICES.xp3 rename to src/testing/issue105/jsonv7-validate/JSON-VALIDATE-CHOICES.xp3 index f2d11e52..8b2535be 100644 --- a/src/testing/issue105/JSON-VALIDATE-CHOICES.xp3 +++ b/src/testing/issue105/jsonv7-validate/JSON-VALIDATE-CHOICES.xp3 @@ -12,30 +12,31 @@ - - - - - - + + + + + + + - + - + - + - + - + @@ -45,19 +46,22 @@ - + - + + - + + + diff --git a/src/testing/issue105/json-validation-screener.xsl b/src/testing/issue105/jsonv7-validate/json-validation-screener.xsl similarity index 100% rename from src/testing/issue105/json-validation-screener.xsl rename to src/testing/issue105/jsonv7-validate/json-validation-screener.xsl diff --git a/src/testing/issue105/json-validation-summarizer.xsl b/src/testing/issue105/jsonv7-validate/json-validation-summarizer.xsl similarity index 95% rename from src/testing/issue105/json-validation-summarizer.xsl rename to src/testing/issue105/jsonv7-validate/json-validation-summarizer.xsl index d96b4514..581ba287 100644 --- a/src/testing/issue105/json-validation-summarizer.xsl +++ b/src/testing/issue105/jsonv7-validate/json-validation-summarizer.xsl @@ -31,13 +31,12 @@ VALIDATION ANOMALY: a document collected as 'invalid' is found to be VALID - + CONFIRMED (invalid) CONFIRMED (valid) - \ No newline at end of file diff --git a/src/testing/issue105/summary-plaintext.xsl b/src/testing/issue105/jsonv7-validate/summary-plaintext.xsl similarity index 84% rename from src/testing/issue105/summary-plaintext.xsl rename to src/testing/issue105/jsonv7-validate/summary-plaintext.xsl index 738d957d..21921469 100644 --- a/src/testing/issue105/summary-plaintext.xsl +++ b/src/testing/issue105/jsonv7-validate/summary-plaintext.xsl @@ -5,18 +5,14 @@ xmlns:xvrl="http://www.xproc.org/ns/xvrl" xmlns:nm="http://csrc.nist.gov/ns/metaschema" exclude-result-prefixes="xs math" - expand-text="true" + expand-text="true" version="3.0"> - - - + - { (1 to 12) ! ':::::' } - diff --git a/support/schxslt b/support/schxslt deleted file mode 160000 index 87cf981d..00000000 --- a/support/schxslt +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 87cf981dcefd80247d2203fbdf63f5f15f212e1d diff --git a/support/xslt3-functions b/support/xslt3-functions new file mode 160000 index 00000000..bb680f78 --- /dev/null +++ b/support/xslt3-functions @@ -0,0 +1 @@ +Subproject commit bb680f78e0c41cdc5944e08c36099e761bc160a9 diff --git a/support/xspec b/support/xspec deleted file mode 160000 index 9cef3713..00000000 --- a/support/xspec +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9cef3713f5a7aaedf38a4ec2190ba3262d51cd72 diff --git a/support/xspec-dev/XSPEC-BATCH.xsl b/support/xspec-dev/XSPEC-BATCH.xsl deleted file mode 100644 index 98ed7016..00000000 --- a/support/xspec-dev/XSPEC-BATCH.xsl +++ /dev/null @@ -1,334 +0,0 @@ - - - - - - - - - - - ../xspec/src/reporter/junit-report.xsl - - - - - - - - - - - src - - *.xspec - - no - - - - - - - - - - no - - - no - - - - - - select={$pattern} - recurse={ if ($recurse=('no','false')) then 'no' else 'yes' } - on-error={ if ($stopping-on-error) then 'fail' else 'warning' } - - - - - - - - - - ERROR: Unable to resolve collection at URI {$collection-uri} - getting {$err:code} '{$err:description}' - - - - - - Param $baseURI is: { $baseURI } - Static base URI is: { static-base-uri() } - Collection location is: { $collection-location } - - - - - - Acquiring collection from { $collection-uri } - - - - - - - - ERROR: Unable to compile XSpec at { $my?name } - getting {$err:code} '{$err:description}' - - - - - - - - - - ERROR: - Unable to execute compiled XSpec from { /*/xsl:variable[@name='Q{{http://www.jenitennison.com/xslt/xspec}}xspec-uri'] } - getting {$err:code} - '{$err:description}' - - - - - - - - - - - - - - - - - - - - - - - WARNING: of { count($collection-in) } { if (count($collection-in)=1) then 'file' else 'files' }, { count($dropped) } { if (count($dropped) = 1) then 'file selected was' else 'were' } dropped - either unavailable, would not compile (XSpec to XSLT), or would not execute (XSLT): - { $dropped?name => string-join(', ') } - - - - - - - Failures detected - process terminating - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - WARNING: No JUnit report is written to '{ $junit-to }' - try a file name with suffix - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {$report-to}/{$xspec-basename}.html - - - - - - - - - - - - - - Writing report {$filename} ... - - - - - - - - - Writing report {$filename} ... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/support/xspec-dev/XSPEC-SINGLE.xsl b/support/xspec-dev/XSPEC-SINGLE.xsl deleted file mode 100644 index 5599a8ee..00000000 --- a/support/xspec-dev/XSPEC-SINGLE.xsl +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - ../xspec/src/compiler/compile-xslt-tests.xsl - - - - - - - - - - - - - - - ... and formatted a report. - - - - - - - - - - - - - - - - - - - - - - - - - - ... compiled XSpec ... - - - - - - - - - - - - - - - - - - - - ... executed XSpec ... - - - \ No newline at end of file diff --git a/support/xspec-dev/mvn-saxon-xspec-batch-quiet.sh b/support/xspec-dev/mvn-saxon-xspec-batch-quiet.sh deleted file mode 100644 index 9c64eb4e..00000000 --- a/support/xspec-dev/mvn-saxon-xspec-batch-quiet.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# shellcheck source=../common/subcommand_common.bash - -source "$SCRIPT_DIR/../../src/common/subcommand_common.bash" - -XSLT_FILE="${SCRIPT_DIR}/XSPEC-BATCH.xsl" -LOGFILE=${LOGFILE:-"xspec_$(date +"%Y%m%d%H%M").log.txt"} - -usage() { - cat </dev/null to drop all runtime messages / progress reports instead of logging -# the process should error out only if stop-on-error=yes, otherwise it will do its best to complete -# invoke_saxon "${SAXON_ARGS}" 2>${LOGFILE} | echo_on_error "Failure running XSpec: see ${LOGFILE}" | tee ${LOGFILE} -invoke_saxon "${SAXON_ARGS}" 2>${LOGFILE} | tee ${LOGFILE} diff --git a/support/xspec-dev/mvn-saxon-xspec-batch.sh b/support/xspec-dev/mvn-saxon-xspec-batch.sh deleted file mode 100755 index 16c34ae0..00000000 --- a/support/xspec-dev/mvn-saxon-xspec-batch.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env bash - -set -o pipefail - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# shellcheck source=../common/subcommand_common.bash - -source "$SCRIPT_DIR/../../src/common/subcommand_common.bash" - -XSLT_FILE="${SCRIPT_DIR}/XSPEC-BATCH.xsl" -LOGFILE=${LOGFILE:-"xspec_$(date +"%Y%m%d%H%M").log.txt"} - -usage() { - cat </dev/null to drop all runtime messages / progress reports instead of logging -# the process should error out only if stop-on-error=yes, otherwise it will do its best to complete -invoke_saxon "${SAXON_ARGS}" 2>&1 | tee ${LOGFILE} diff --git a/support/xspec-dev/mvn-saxon-xspec-html.sh b/support/xspec-dev/mvn-saxon-xspec-html.sh deleted file mode 100755 index 8aae060a..00000000 --- a/support/xspec-dev/mvn-saxon-xspec-html.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env bash - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# shellcheck source=../common/subcommand_common.bash - -source "$SCRIPT_DIR/../../src/common/subcommand_common.bash" - -XSLT_FILE="${SCRIPT_DIR}/XSPEC-SINGLE.xsl" - -usage() { - cat </dev/null` in the command invoking the script. - -``` -./mvn-saxon-xspec-batch.sh folder=src/project recurse=yes 2>/dev/null -``` - -All XSpec files in the folder `src/project` and any subfolders, reporting results to the console (STDOUT) but not creating HTML reports and not echoing warning or error messages to the console. - -It is best to silence STDERR only after you are confident that all XSpecs in your file set can be run successfully, especially if the "break early on error" option is set (since you will neither see STDERR nor get any results). - -## Enhanced HTML Production - -In order to work around limitations in the current XSpec HTML production (details with respect to its deployment under XProc 1.0), a [new HTML production XSLT](xspec-mx-html-report.xsl) is provided here, for use either for standalone XSpec reporting, or for reporting results from several XSpecs in aggregate ("batch"). - -[This XSLT ](xspec-mx-html-report.xsl) produces standalone HTML including embedded CSS and some lightweight Javascript supporting navigation features. - -### Theming HTML from XProc - -The XProc files support a runtime option, `theme`, which also exposes control of the theme setting (in the HTML and CSS). This takes the form of an HTML `class` value on the `body` element, along with CSS to be applied to the page on the basis of that setting. - -- `theme=clean` (the default) produces a medium-contrast color-neutral format -- `theme=uswds` uses colors for emphasis from the USWDS color scheme -- `theme=classic` uses colors drawn from the good-old XSpec HTML -- `theme=toybox` provides a more extravagant scheme. - -New themes can be added in the XSLT or in a new "shell" XSLT importing it, by copying and modifying an appropriate template to match the new theme and give it style. Such an importing XSLT can also modify any other feature of the HTML page result. - diff --git a/support/xspec-dev/testing/copy_me.xsl b/support/xspec-dev/testing/copy_me.xsl deleted file mode 100644 index 6e34968e..00000000 --- a/support/xspec-dev/testing/copy_me.xsl +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/support/xspec-dev/testing/iso8601.ixml b/support/xspec-dev/testing/iso8601.ixml deleted file mode 100644 index 9a4b6933..00000000 --- a/support/xspec-dev/testing/iso8601.ixml +++ /dev/null @@ -1,171 +0,0 @@ -{ An Invisible XML grammar for ISO 8601(:2004?) dates and times. } -{ Originally constructed by Norm Tovey-Walsh, 17 April 2022 } -{ See https://en.wikipedia.org/wiki/ISO_8601 among others } - --iso8601-datetime = date - ; time - ; datetime - ; duration - ; interval - ; recurrence . - -date = calendar-date ; ordinal-date ; week-date . - --time = local-time ; utc-time . - --datetime = local-datetime ; utc-datetime . - -local-datetime = -date, -'T', -local-time-no-t . -utc-datetime = -date, -'T', -utc-time-no-t . - -duration = -standard-duration; -alternate-duration . - -interval = start-end-interval - ; start-plus-duration-interval - ; duration-plus-end-interval . - -recurrence = repeat-count, -'/', interval . - -{ -- Calendar dates -- } - --calendar-date = complete-calendar-date - ; reduced-accuracy-calendar-date - ; expanded-calendar-date . - --complete-calendar-date = year, month, day; year, -'-', month, -'-', day . - --reduced-accuracy-calendar-date = year, -'-', month; year; century . - --expanded-calendar-date = expanded-year, month, day - ; expanded-year, -'-', month, -'-', day - ; expanded-year, -'-', month - ; expanded-year - ; expanded-century . - -{ -- Ordinal dates -- } - --ordinal-date = complete-ordinal-date ; expanded-ordinal-date . - --complete-ordinal-date = year, day-of-year - ; year, -'-', day-of-year . - --expanded-ordinal-date = expanded-year, day-of-year - ; expanded-year, -'-', day-of-year . - -{ -- Week dates -- } - --week-date = complete-week-date - ; reduced-accuracy-week-date - ; expanded-week-date . - --complete-week-date = year, -'W', week, day-of-week - ; year, -'-W', week, -'-', day-of-week . - --reduced-accuracy-week-date = year, -'W', week - ; year, -'-W', week . - --expanded-week-date = expanded-year, -'W', week, day-of-week - ; expanded-year, -'-W', week, '-', day-of-week - ; expanded-year, -'W', week - ; expanded-year, -'-W', week . - -{ -- Local time -- } - -local-time = local-time-t ; local-time-no-t . - --local-time-t = local-time-without-utc-t; local-time-with-utc-t . --local-time-no-t = local-time-without-utc; local-time-with-utc . - --local-time-without-utc-t = -'T', local-time-without-utc . - --local-time-without-utc = hour, minute, second - ; hour, -':', minute, -':', second - ; hour, minute - ; hour, -':', minute - ; hour - ; fractional-second-local-time - ; fractional-minute-local-time - ; fractional-hour-local-time . - --local-time-with-utc-t = -local-time-without-utc-t, utc-offset . --local-time-with-utc = -local-time-without-utc, utc-offset . - --fractional-second-local-time = (hour, minute, second; hour, -':', minute, -':', second), - fraction-sep, - fractional-second . - --fractional-minute-local-time = (hour, minute; hour, -':', minute), - fraction-sep, - fractional-minute . - --fractional-hour-local-time = hour, fraction-sep, fractional-hour . - -utc-offset = offset-hour, (-':'?, offset-minute)? . - -{ -- UTC time -- } - -utc-time = utc-time-t ; utc-time-no-t . --utc-time-t = -local-time-without-utc-t, -'Z' . --utc-time-no-t = -local-time-without-utc, -'Z' . - -{ -- Durations -- } - --standard-duration = -'P', (standard-ymdhs-duration ; standard-week-duration) . - -{ N.B. This tecnically allows a standard-ymdhs-duration with no fields. } --standard-ymdhs-duration = duration-years?, duration-months?, duration-days?, - (-'T', duration-hours?, duration-minutes?, duration-seconds?)? . --standard-week-duration = duration-weeks . - --alternate-duration = -'P', (alternate-ymd-duration ; alternate-yd-duration) . - --alternate-ymd-duration = year, month, day, -'T', hour, minute, second - ; year, -'-', month, -'-', day, -'T', hour, -':', minute, -':', second . --alternate-yd-duration = year, number-of-days, -'T', hour, minute, second - ; year, -'-', number-of-days, -'T', hour, -':', minute, -':', second . - --start-end-interval = (date; datetime), -'/', (date; datetime) . --start-plus-duration-interval = (date; datetime), -'/', duration . --duration-plus-end-interval = duration, -'/', (date; datetime) . - -duration-years = digit+, -'Y' . -duration-months = digit+, -'M' . -duration-days = digit+, -'D' . -duration-hours = digit+, -'H' . -duration-minutes = digit+, -'M' . -duration-seconds = digit+, -'S' . -duration-weeks = digit+, -'W' . - -{ -- Recurrence -- } - --repeat-count = -'R-1' ; -'R' ; -'R', repetitions . -repetitions = digit+ . - -{ -- Utility rules -- } - -expanded-year = sign, digit+, digit, digit, digit . -expanded-century = sign, digit+, digit, digit . --sign = -'+' ; '-' . - -offset-hour = @direction, digit, digit . -offset-minute = digit, digit . -direction = '+'; '-' . - -year = digit, digit, digit, digit . -century = digit, digit . -month = digit, digit . -week = digit, digit . -day = digit, digit . -hour = digit, digit . -minute = digit, digit . -second = digit, digit . -fractional-second = digit+ . -fractional-minute = digit+ . -fractional-hour = digit+ . - -day-of-year = digit, digit, digit . -number-of-days = -day-of-year . -day-of-week = digit . - --digit = ["0"-"9"] . --fraction-sep = -[','; '.'] . diff --git a/support/xspec-dev/testing/ixml-demo.xsl b/support/xspec-dev/testing/ixml-demo.xsl deleted file mode 100644 index da0232d5..00000000 --- a/support/xspec-dev/testing/ixml-demo.xsl +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - iso8601.ixml - - - - - 1962-06-28 - 1963-11-04 - 2024-02-30 - 2024-02-99 - 2024-01-17T17:26:38.416457100-05:00 - 2024-02-300 - 2025-12-25 - 2025-12-31T - - - - - - - - - - - - - - - - - - - - BUST on '{ $maybeDateTime }' - - - - - - diff --git a/support/xspec-dev/testing/ixml-parsing.xspec b/support/xspec-dev/testing/ixml-parsing.xspec deleted file mode 100644 index 6fdc1345..00000000 --- a/support/xspec-dev/testing/ixml-parsing.xspec +++ /dev/null @@ -1,92 +0,0 @@ - - - - - Parsing some dates - - - - 2024-01-20 - - - - - 2024 - 01 - 20 - - - - - - - 2024-01-0 - - - - BUST on '2024-01-0' - - - - - - 2024-01-18T14:44 - - - - - 2024 - 01 - 18 - 14 - 44 - - - - - - - 2024-01-18T14:44:10 - - - - - 2024 - 01 - 18 - 14 - 44 - 10 - - - - - - - 2024-01-18T14:44:10.777578600-05:00 - - - - - 2024 - 01 - 18 - 14 - 44 - 10 - 777578600 - - 05 - 00 - - - - - - - diff --git a/support/xspec-dev/testing/mvn-xproc-xspec-test-batch.sh b/support/xspec-dev/testing/mvn-xproc-xspec-test-batch.sh deleted file mode 100644 index 2fceeba5..00000000 --- a/support/xspec-dev/testing/mvn-xproc-xspec-test-batch.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# shellcheck source=../common/subcommand_common.bash - -source "$SCRIPT_DIR/../../../src/common/subcommand_common.bash" - -XPROC_FILE="${SCRIPT_DIR}/xspec-test-batch.xpl" -REPORT_HTML="xspec-test-report.html" - -usage() { - cat < - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/support/xspec-dev/testing/xspec-basic.xspec b/support/xspec-dev/testing/xspec-basic.xspec deleted file mode 100644 index bdccf48c..00000000 --- a/support/xspec-dev/testing/xspec-basic.xspec +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/support/xspec-dev/testing/xspec-shell.xspec b/support/xspec-dev/testing/xspec-shell.xspec deleted file mode 100644 index ba66430f..00000000 --- a/support/xspec-dev/testing/xspec-shell.xspec +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/support/xspec-dev/testing/xspec-test-batch.xpl b/support/xspec-dev/testing/xspec-test-batch.xpl deleted file mode 100644 index 2b25a22f..00000000 --- a/support/xspec-dev/testing/xspec-test-batch.xpl +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/support/xspec-dev/xspec-assurance.sch b/support/xspec-dev/xspec-assurance.sch deleted file mode 100644 index 42c624c2..00000000 --- a/support/xspec-dev/xspec-assurance.sch +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - No document found at - - - - \ No newline at end of file diff --git a/support/xspec-dev/xspec-batch-report.xpl b/support/xspec-dev/xspec-batch-report.xpl deleted file mode 100644 index abd9ea5d..00000000 --- a/support/xspec-dev/xspec-batch-report.xpl +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/support/xspec-dev/xspec-mx-html-report.xsl b/support/xspec-dev/xspec-mx-html-report.xsl deleted file mode 100644 index a817368b..00000000 --- a/support/xspec-dev/xspec-mx-html-report.xsl +++ /dev/null @@ -1,538 +0,0 @@ - - - - - - - - - clean - - - - - - - - - - - - - - XSpec - { $result-count } { if ($result-count eq 1) then 'test' else 'tests'} in { $report-count } { if ($report-count eq 1) then 'report' else 'reports'} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  • FAILING - - { ancestor-or-self::*/x:label => string-join(' - ') } -
  • -
    - - -
    -
    - -
    -

    XSpec Report - { @xspec/replace(.,'.*/','') }

    - -
    -
    - - - -
    - - XSpec Report - { @xspec/replace(.,'.*/','') } - -
    - -
    - -
    -
    - - - - - -
    - -
    -
    - -
    - - - - - - -
    - -
    -
    - - - - - - - - - - 🤞 - - - 👍 - - - 👎 - - - - -

    { local-name(..) }/{ local-name(.) }: { . }

    -
    - - - - -

    { local-name(..) }/{ local-name(.) }: { . }

    -
    - - -

    { local-name(..) }/{ local-name(.) }: { format-dateTime(xs:dateTime(.),'[MNn] [D1], [Y0001] [H01]:[m01]:[s01]') } ({.})

    -
    - - - - - -
    - - - open - - - - -
    - -
    -
    -
    - - - - - { $whose/ancestor::x:report ! ('report' || count(.|preceding-sibling::x:report || '-' )) }{ $whose/@id } - - - - - - - - - - { self::x:report/'Total tests '}{ child::x:label } -   - - - - - - - - - - - - { . } - : - - - - - - - - - { child::x:label } -   - - - { (child::x:test/@pending/('Pending ' || .),child::x:test[@successful='true']/'Passes','Fails')[1] } - - - - - Expecting { child::x:label } - - - -
    - - - -
    -
    - - -
    - - - - - -
    -
    - - -

    Expecting (testing against)

    -
    - - -

    Producing (actual result)

    -
    - - - - - - - - - -
    - -
    -
    - - -
    - -
    -
    - - - - - -

    From input

    -
    - - - -

    Expecting

    -
    - - - - - - -
    - - - -
    -
    - - -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - -.uswds { - background-color: #f0f0f0; - - .label { background-color: #1a4480; color: white} - .pending .label { background-color: inherit; color: black } - .passing { background-color: #d9e8f6 } - .pending { background-color: white } - .failing { background-color: #f8dfe2 } - .failing .passing { background-color: #d9e8f6 } - .pending.zero, .failing.zero { background-color: inherit } -} - - - - - - - -.classic { - h1, .h1, .label { background-color: #606; color: #6f6 } - h1 { padding: 0.2em } - .pending .label { background-color: inherit; color: black } - .passing { background-color: #cfc } - .pending { background-color: #eee } - .failing { background-color: #fcc } - .failing .passing { background-color: #cfc } - .pending.zero, .failing.zero { background-color: inherit } -} - - - - - -.toybox { - .label { background-color: black; color: white } - .failing .label { background-color: darkred } - .passing .label { background-color: darkgreen } - .pending .label { background-color: inherit; color: black } - .passing { background-color: honeydew } - .pending { background-color: cornsilk } - .failing { background-color: mistyrose } - .failing .passing { background-color: honeydew } - .pending.zero, .failing.zero { background-color: inherit } -} - - - - - No template for theme '{ $theme }' - using 'simple' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/support/xspec-dev/xspec-single-report.xpl b/support/xspec-dev/xspec-single-report.xpl deleted file mode 100644 index a847de3b..00000000 --- a/support/xspec-dev/xspec-single-report.xpl +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/support/xspec-dev/xspec-single-xspec-repo-report.xpl b/support/xspec-dev/xspec-single-xspec-repo-report.xpl deleted file mode 100644 index 402b1557..00000000 --- a/support/xspec-dev/xspec-single-xspec-repo-report.xpl +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/support/xspec-dev/xspec-summarize.xsl b/support/xspec-dev/xspec-summarize.xsl deleted file mode 100644 index 451f8d5e..00000000 --- a/support/xspec-dev/xspec-summarize.xsl +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - { @xspec } - { @stylesheet } - - - - - - { ancestor-or-self::*/child::label => string-join(' : ') } - - - - - \ No newline at end of file diff --git a/support/xspec-dev/xspec-summary-reduce.xsl b/support/xspec-dev/xspec-summary-reduce.xsl deleted file mode 100644 index fad32c0f..00000000 --- a/support/xspec-dev/xspec-summary-reduce.xsl +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - { (1 to 14) ! ' ...' } - XSpec summary report: { mx:enumerate('XSpec',count(report)) } - - { (1 to 14) ! ' ...' } - - - - - - - SUCCESS - { mx:give-report-counts(.) } - NO FAILURES REPORTED - - - - - - FAILURE - { mx:give-report-counts(.) } - { count(descendant::fail) } { mx:pluralize('failure',count(descendant::fail)) => upper-case() } REPORTED - - - - - { xspec-file ! tokenize(.,'/')[last()] } testing { xslt-file ! tokenize(.,'/')[last()] }: { mx:enumerate('test',@test-count) }, { @pending-count} pending, { mx:enumerate('failure',count(fail)) } - - - - - { mx:enumerate('report',count($r/report)) } with { mx:enumerate('test', sum($r/report/@test-count)) } ({ sum($r/report/@pending-count) } pending) - - - - - - - { $c } { mx:pluralize($nom,$c) } - - - - - - - - - - - - - { . }{ 's'[$plural] } - - - \ No newline at end of file From 048b85af44e902b6558d4b3713097e326d5e0604 Mon Sep 17 00:00:00 2001 From: Wendell Piez Date: Tue, 7 May 2024 18:10:31 -0400 Subject: [PATCH 08/19] Restoring schxslt b/c we need it after all (while using it under XProc 1.0) --- .gitignore | 4 ++++ .gitmodules | 3 +++ support/schxslt | 1 + 3 files changed, 8 insertions(+) create mode 160000 support/schxslt diff --git a/.gitignore b/.gitignore index 3cc589cb..73a1e16d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,7 @@ # test outputs src/**/test_output/ + +# downloaded miscellaneous + +support/lib/* \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index f57c9ade..8b1c4076 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,3 +6,6 @@ [submodule "support/xslt3-functions"] path = support/xslt3-functions url = https://github.com/usnistgov/xslt3-functions.git +[submodule "support/schxslt"] + path = support/schxslt + url = https://github.com/schxslt/schxslt.git diff --git a/support/schxslt b/support/schxslt new file mode 160000 index 00000000..3f961be6 --- /dev/null +++ b/support/schxslt @@ -0,0 +1 @@ +Subproject commit 3f961be6b1e7b1bd6522b39002d1c082bc841071 From 837a42ba296d0bb2d1300c088d39f570674d40d1 Mon Sep 17 00:00:00 2001 From: Wendell Piez Date: Tue, 4 Jun 2024 15:53:13 -0400 Subject: [PATCH 09/19] Repair addressing #105 (failure to honor 'choice' semantics), still wanting testing; with a small testing application --- src/common/metaschema-ws-strip.xsl | 24 + src/schema-gen/JSON-schema/Makefile | 4 +- src/schema-gen/JSON-schema/choice-split.xsl | 2 +- .../JSON-schema/make-json-schema-metamap.xsl | 90 +- .../metamap-test.xspec | 33 +- src/schema-gen/METASCHEMA-ALL-VALIDATORS.xpl | 92 ++ src/testing/readme.md | 25 + src/testing/tinydata/TINYDATA-MAKE-JSON.xpl | 52 + .../tinydata/TINYDATA-XSD-VALIDATE.xpl | 192 +++ .../tinydata/current/tiny_COMPOSED.xml | 446 +++++++ .../tinydata/current/tiny_inspector.xsl | 1048 +++++++++++++++++ .../tinydata/current/tiny_json-schema.xml | 306 +++++ .../tinydata/current/tiny_json-to-xml.xsl | 780 ++++++++++++ src/testing/tinydata/current/tiny_schema.json | 219 ++++ src/testing/tinydata/current/tiny_schema.xsd | 498 ++++++++ .../tinydata/current/tiny_xml-to-json.xsl | 755 ++++++++++++ src/testing/tinydata/readme.md | 62 + .../tinydata/refresh-tiny-converters.sh | 73 ++ src/testing/tinydata/refresh-tiny-schemas.sh | 95 ++ src/testing/tinydata/tiny-data/bigbadtiny.xml | 30 + src/testing/tinydata/tiny-data/tiny1.xml | 22 + .../tinydata/tiny-json-validate-xp3.sh | 27 + src/testing/tinydata/tiny-xsd-validate-set.sh | 45 + .../tinydata/tiny_json-schema-corrected.xml | 336 ++++++ src/testing/tinydata/tiny_metaschema.xml | 161 +++ .../tinydata/tinydata_xml-converter.xsl | 17 + src/testing/tinydata/validate-tiny-json.xp3 | 28 + src/validate/METASCHEMA-SCHXSLT-VALIDATE.xpl | 4 +- 28 files changed, 5445 insertions(+), 21 deletions(-) create mode 100644 src/common/metaschema-ws-strip.xsl create mode 100644 src/schema-gen/METASCHEMA-ALL-VALIDATORS.xpl create mode 100644 src/testing/tinydata/TINYDATA-MAKE-JSON.xpl create mode 100644 src/testing/tinydata/TINYDATA-XSD-VALIDATE.xpl create mode 100644 src/testing/tinydata/current/tiny_COMPOSED.xml create mode 100644 src/testing/tinydata/current/tiny_inspector.xsl create mode 100644 src/testing/tinydata/current/tiny_json-schema.xml create mode 100644 src/testing/tinydata/current/tiny_json-to-xml.xsl create mode 100644 src/testing/tinydata/current/tiny_schema.json create mode 100644 src/testing/tinydata/current/tiny_schema.xsd create mode 100644 src/testing/tinydata/current/tiny_xml-to-json.xsl create mode 100644 src/testing/tinydata/readme.md create mode 100644 src/testing/tinydata/refresh-tiny-converters.sh create mode 100644 src/testing/tinydata/refresh-tiny-schemas.sh create mode 100644 src/testing/tinydata/tiny-data/bigbadtiny.xml create mode 100644 src/testing/tinydata/tiny-data/tiny1.xml create mode 100644 src/testing/tinydata/tiny-json-validate-xp3.sh create mode 100644 src/testing/tinydata/tiny-xsd-validate-set.sh create mode 100644 src/testing/tinydata/tiny_json-schema-corrected.xml create mode 100644 src/testing/tinydata/tiny_metaschema.xml create mode 100644 src/testing/tinydata/tinydata_xml-converter.xsl create mode 100644 src/testing/tinydata/validate-tiny-json.xp3 diff --git a/src/common/metaschema-ws-strip.xsl b/src/common/metaschema-ws-strip.xsl new file mode 100644 index 00000000..a5f76cf1 --- /dev/null +++ b/src/common/metaschema-ws-strip.xsl @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/schema-gen/JSON-schema/Makefile b/src/schema-gen/JSON-schema/Makefile index 2be33b51..807f1632 100644 --- a/src/schema-gen/JSON-schema/Makefile +++ b/src/schema-gen/JSON-schema/Makefile @@ -22,7 +22,7 @@ test: unit-test spec-test ## Run all tests .PHONY: spec-test spec-test: ## Run all specification tests - LOGFILE="$(output_folder)/inspector-functional-tests.log" $(xspec_ci_script) \ + LOGFILE="$(output_folder)/jsonschemagen-mapping.log" $(xspec_ci_script) \ "folder=$(module_path)/testing/tests/jsonschemagen-mapping-xspec/" \ "report-to=$(output_folder)/jsonschemagen-mapping_report.html" \ "junit-to=$(output_folder)/jsonschemagen-mapping_junit-report.xml" \ @@ -31,7 +31,7 @@ spec-test: ## Run all specification tests .PHONY: unit-test unit-test: ## Run all unit tests - LOGFILE="$(output_folder)/inspector-generation-tests.log" $(xspec_ci_script) \ + LOGFILE="$(output_folder)/jsonschemagen-runtime.log" $(xspec_ci_script) \ "folder=$(module_path)/testing/tests/jsonschemagen-runtime-xspec" \ "report-to=$(output_folder)/jsonschemagen-runtime_report.html" \ "junit-to=$(output_folder)/jsonschemagen-runtime_junit-report.xml" \ diff --git a/src/schema-gen/JSON-schema/choice-split.xsl b/src/schema-gen/JSON-schema/choice-split.xsl index e2c64d2a..6c2b618a 100644 --- a/src/schema-gen/JSON-schema/choice-split.xsl +++ b/src/schema-gen/JSON-schema/choice-split.xsl @@ -10,7 +10,7 @@ + It is however imported by `make-json-schema-metamap.xsl` and possibly other stylesheets. --> diff --git a/src/schema-gen/JSON-schema/make-json-schema-metamap.xsl b/src/schema-gen/JSON-schema/make-json-schema-metamap.xsl index c0c54878..0371ba7d 100644 --- a/src/schema-gen/JSON-schema/make-json-schema-metamap.xsl +++ b/src/schema-gen/JSON-schema/make-json-schema-metamap.xsl @@ -146,7 +146,7 @@ - + object @@ -156,7 +156,68 @@ - + + + + + + + + + + + + + + + object + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -167,6 +228,7 @@ + @@ -281,6 +343,8 @@
    + + @@ -296,7 +360,7 @@ + $with-model/(field|define-field|assembly|define-assembly)[@min-occurs > 0]"/> @@ -305,7 +369,7 @@ - true + true false @@ -425,8 +489,8 @@ + assembly[group-as/@in-json='BY_KEY'][exists(key('assembly-definition-by-name',@_key-ref, $composed-metaschema)/json-key)] | + field[group-as/@in-json='BY_KEY'][exists(key('field-definition-by-name', @_key-ref, $composed-metaschema)/json-key)]"> object @@ -444,7 +508,7 @@ - + @@ -453,7 +517,7 @@ - + @@ -509,17 +573,17 @@ - + - + - + @@ -550,8 +614,8 @@ - - + + string diff --git a/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/metamap-test.xspec b/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/metamap-test.xspec index 1c2c1d24..e2b38cb9 100644 --- a/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/metamap-test.xspec +++ b/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/metamap-test.xspec @@ -2,10 +2,17 @@ + xmlns:m="http://csrc.nist.gov/ns/oscal/metaschema/1.0" + xmlns="http://csrc.nist.gov/ns/metaschema-xslt/tinydata" + xmlns:t="http://csrc.nist.gov/ns/metaschema-xslt/tinydata" + xmlns:x="http://www.jenitennison.com/xslt/xspec" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:fn="http://www.w3.org/2005/xpath-functions" + stylesheet="../../../make-json-schema-metamap.xsl" + xslt-version="3.0" run-as="external"> + + @@ -21,4 +28,24 @@ + + + + + + + + + + + + diff --git a/src/schema-gen/METASCHEMA-ALL-VALIDATORS.xpl b/src/schema-gen/METASCHEMA-ALL-VALIDATORS.xpl new file mode 100644 index 00000000..6b644191 --- /dev/null +++ b/src/schema-gen/METASCHEMA-ALL-VALIDATORS.xpl @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/testing/readme.md b/src/testing/readme.md index 8d1703f0..245b60ce 100644 --- a/src/testing/readme.md +++ b/src/testing/readme.md @@ -21,3 +21,28 @@ Dynamic testing of Metaschema-based data conversions, XML to JSON and back. - test-xml-conversions.xpl - test-xml-json-roundtrip.xpl +Don't change any of these files without keeping the schema generation testing in place as it depends on them. + +## Tinydata model + +See the [tinydata](./tinydata) folder for a fully worked example, made to a different set of design requirements than models_metaschema.xml. + +It has its own tests and build scripts. + +The 'models' metaschema aims to present all assembly, field and flag model configurations and definitions in a 'lab-only' tag set. + +Tinydata, in contrast, is designed to be actually useful for some range of use cases, for example glossaries, data sheets or spreadsheet dumps. + +## Schema generation testing overhaul planning Summer 2024 + +- [ ] **Phase I** plan out, test and code solution to Issue 105 - JSON schema `choice` fail + - [x] use tinydata example to unit test this in schema-gen/JSON-schema + - [ ] demonstrate with some go/no-go testing in tinydata that this works + - [ ] make a new OSCAL catalog JSON Schema available for field testing in oscal-xproc3 + - [ ] clean up and push to address #105 +- [ ] **Phase II** build out XSpecs for schema generation - at least minimally (foothold) + - [ ] XSD and JSON Schema in detail + - [ ] both models_metaschema and tinydata +- [ ] **Phase III** Inspector XSLT generation + - [ ] free all schema generators from `metaschema` module runtime dependency + - [ ] make all schema generation available as runtimes in XSLT, XProc 1/3 diff --git a/src/testing/tinydata/TINYDATA-MAKE-JSON.xpl b/src/testing/tinydata/TINYDATA-MAKE-JSON.xpl new file mode 100644 index 00000000..1c34ed85 --- /dev/null +++ b/src/testing/tinydata/TINYDATA-MAKE-JSON.xpl @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/testing/tinydata/TINYDATA-XSD-VALIDATE.xpl b/src/testing/tinydata/TINYDATA-XSD-VALIDATE.xpl new file mode 100644 index 00000000..23e74366 --- /dev/null +++ b/src/testing/tinydata/TINYDATA-XSD-VALIDATE.xpl @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Checking { count(*/*) }{ if (count(*/*) eq 1) then ' document' else ' documents' } against a 'choices' XSD ... + + + + ALL GOOD - confirming expected results from XSD validation + + + + + + VALIDATION ANOMALY: a document expected to be valid is found to be INVALID + + + + VALIDATION ANOMALY: a marked document ('<?EXPECT ERROR?>') is found to be VALID + + + + CONFIRMED (invalid) + + + + CONFIRMED (valid) + + + + + + + + + + + + + + + + + { (1 to 12) ! ':::::' } + + + + + + + + + + : { . } + + + + + + + \ No newline at end of file diff --git a/src/testing/tinydata/current/tiny_COMPOSED.xml b/src/testing/tinydata/current/tiny_COMPOSED.xml new file mode 100644 index 00000000..2214fe8d --- /dev/null +++ b/src/testing/tinydata/current/tiny_COMPOSED.xml @@ -0,0 +1,446 @@ + + Seeing assembly#tiny:TINY, field#tiny:title, field#tiny:term, assembly#tiny:part, assembly#tiny:sheet, flag#tiny:key, flag#tiny:class, field#tiny:item, field#tiny:note + Tiny Data Model + 0.0.2 + tiny + http://csrc.nist.gov/ns/metaschema-xslt/tinydata + http://csrc.nist.gov/ns/metaschema-xslt/tinydata + +

    Tiny Metaschema

    +

    A metaschema can be small and yet deep.

    +
    + + Tiny Data + A minimally described data set. + TINY + + Tiny ID + An identifier. + + + + + + + + Stuff + Some amount of tiny stuff. + + + + + + + + + + + Title + markup-line example. + + + Term + Simple string value example. + + Term identifier + A token identifying this term uniquely within the document. + + +

    For a more extensive model supporting definitions, acronyms etc. build this out into an assembly. As a field, this supports some control over the vocabulary and formatting without heavier embedded metadata.

    +

    Of course you could always make a structured glossary out of regular and controlled parts for your terminology, and use this inside it, potentially with title/insert.

    +
    +
    + + Note + Wrapped markup-multiline example. + + + Tiny part + A bit of tiny data. + + + + + + + Stuff + Some amount of tiny stuff. + + + + + + + + + + + + Tiny sheet + A list or grid of data points (items), or an entry (row or line item) in such a list or grid that contains such a list or grid. + + + + + + Stuff + Some amount of tiny stuff. + + + + entry + + + + item + + + + + + + + Line item + A value, potentially marked with @key or @class. + + + + N (position) + An indexed position (distinctive among values of parent::*/*/@n). + + + + Distinctive 'n' value + @n must be distinctive among sibling items. + +

    A whole number is expected here although '0' is permitted. Values among siblings are not constrained to be ordered, only different. Ordering is up to the receiving application.

    +
    +
    +
    + +

    An application may constrain the value of the node to a datatype or other requirement, on the basis of @key, @class or other association(s).

    +
    +
    + + Field key + Distinguishing a sheet or item (field) among siblings or neighbors. + + + Class + Class or classes. + +
    diff --git a/src/testing/tinydata/current/tiny_inspector.xsl b/src/testing/tinydata/current/tiny_inspector.xsl new file mode 100644 index 00000000..c887bb9d --- /dev/null +++ b/src/testing/tinydata/current/tiny_inspector.xsl @@ -0,0 +1,1048 @@ + + + + + + + + inspected + + full + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + av.152 + _UE unmatched-element + Unrecognized element { name() }. + + + + + + + + + + + + + + av.180 + _UT unexpected-text + Errant text content. + + + + + + + av.193 + _UA unmatched-attribute + Unrecognized attribute @{ name() } on element { name(..) }. + + + + + + + + + + exists(.) + + __U uncategorized + * + [info] + ERROR + + + + + + + + + + + + + + + + + + [info] + + + + + + + + + /{ name() } + + + + + /{ name() }[{ mx:element-position(.)[count($kin) gt 1] }] + + + + /@{ name() } + + + + + [{ count(preceding-sibling::text()|.) }] + /text(){ (count($kin)[. gt 1]) ! $place } + + + + + [{ count(preceding-sibling::comment()|.) }] + /text(){ (count($kin)[. gt 1]) ! $place } + + + + + [{ count(preceding-sibling::processing-instruction()|.) + }] + /text(){ (count($kin)[. gt 1]) ! $place } + + + + + + + + + + + { $as } + { $as }s + + + + + + + + + + + + + + + + + + + + + + + + + + + + + File { replace(@src,'.*/','') } has { $error-count } { + mx:pluralize($error-count,'error')}. + File { replace(@src,'.*/','') } has { $report-count } { + mx:pluralize($report-count,'issue') } reported including { $error-count } { + mx:pluralize($error-count,'error')}. + + + + + + + + + + File { replace(@src,'.*/','') } is reported VALID, no issues ... + + + + + + + + + + + + + + + + + + + + + + + + + { (@level,'ERROR')[1] } [CLASS) { @class } ][PATH) { @xpath } ][REPORT) { + string(.) }] + + + + + + + + + + + + { $validating-filename } - { $checked } - { mx:metaschema/@shortname } validation + + + + + + +

    { $checked } Validating { $validating-filename } - { mx:metaschema } - found { + 'IN'[not($reported-valid)] }VALID

    + + +

    + { $validating-filename } contains { @elements} { + mx:pluralize(@elements/number(),'element') } and { @attributes } { + mx:pluralize(@attributes/number(),'attribute') }.

    + + +
    + +
    +
    +
    + + +
    + + + + + + +
    +

    { count(.//mx:report) } { mx:pluralize(count(.//mx:report),'issue') } reported.

    +

    + + 💥 + +

    +
    +
    + +
    +

    Good news - nothing to report - the instance is valid. 🚀 +

    +
    +
    + + + + +
    + + + +

    { @class }{ @level[not(.='ERROR')] ! (' ' || .) }

    +
      + +
    • Rule ID: { . } +
    • +
      +
    • test: { @test } +
    • + +
    • matching: { @matching } +
    • +
      +
    • XPath: { @xpath } +
    • +
    +
    +
    + + + + + + + + + + + + + + + + + { codepoints-to-string(10) } + + + + + + + { $lf } + + + + { $lf2 }--- + + + + # + + + + + { $lf2 }# + + + + + { $lf2 }## + + + + + { $lf2 }### + + + + + { $lf2 } + + + + + + + + + { $lf }- + + + + ** + + ** + + + * + + * + + + ` + + ` + + + Tiny Data Model + + + + + + + + + + + + + + + + + + + gix.390 + EOOO element-out-of-order + exists(preceding-sibling::notes) + + Element part is unexpected following notes/note. + + + + + + + + gix.390 + EOOO element-out-of-order + exists(preceding-sibling::sheet | preceding-sibling::note) + + Element part is unexpected following sheet or note. + + + + + + + + gix.390 + EOOO element-out-of-order + exists(preceding-sibling::note) + + Element sheet is unexpected following note. + + + + + + + + gix.362 + empty(preceding-sibling::entry) and exists(../(item)) + + VEXC violates-exclusive-choice + Element entry is unexpected along with item. + + + + + + + + + gix.347 + EATO element-appears-too-often + count(. | preceding-sibling::title) gt 1 + + Element title appears too many times: 1 maximum is permitted. + + + gix.390 + EOOO element-out-of-order + exists(preceding-sibling::term | preceding-sibling::part | preceding-sibling::notes | preceding-sibling::h1 | preceding-sibling::h2 | preceding-sibling::h3 | preceding-sibling::h4 | preceding-sibling::h5 | preceding-sibling::h6 | preceding-sibling::table | preceding-sibling::img | preceding-sibling::pre | preceding-sibling::hr | preceding-sibling::blockquote | preceding-sibling::ul | preceding-sibling::ol | preceding-sibling::p) + + Element title is unexpected following term, stuff, part, or notes/note. + + + + + + + + + gix.390 + EOOO element-out-of-order + exists(preceding-sibling::part | preceding-sibling::notes | preceding-sibling::h1 | preceding-sibling::h2 | preceding-sibling::h3 | preceding-sibling::h4 | preceding-sibling::h5 | preceding-sibling::h6 | preceding-sibling::table | preceding-sibling::img | preceding-sibling::pre | preceding-sibling::hr | preceding-sibling::blockquote | preceding-sibling::ul | preceding-sibling::ol | preceding-sibling::p) + + Element term is unexpected following stuff, part, or notes/note. + + + + + + + + + + + + + + + + gix.347 + EATO element-appears-too-often + count(. | preceding-sibling::title) gt 1 + + Element title appears too many times: 1 maximum is permitted. + + + gix.390 + EOOO element-out-of-order + exists(preceding-sibling::term | preceding-sibling::part | preceding-sibling::sheet | preceding-sibling::note | preceding-sibling::h1 | preceding-sibling::h2 | preceding-sibling::h3 | preceding-sibling::h4 | preceding-sibling::h5 | preceding-sibling::h6 | preceding-sibling::table | preceding-sibling::img | preceding-sibling::pre | preceding-sibling::hr | preceding-sibling::blockquote | preceding-sibling::ul | preceding-sibling::ol | preceding-sibling::p) + + Element title is unexpected following term, stuff, part, sheet, or note. + + + + + + + + + gix.390 + EOOO element-out-of-order + exists(preceding-sibling::part | preceding-sibling::sheet | preceding-sibling::note | preceding-sibling::h1 | preceding-sibling::h2 | preceding-sibling::h3 | preceding-sibling::h4 | preceding-sibling::h5 | preceding-sibling::h6 | preceding-sibling::table | preceding-sibling::img | preceding-sibling::pre | preceding-sibling::hr | preceding-sibling::blockquote | preceding-sibling::ul | preceding-sibling::ol | preceding-sibling::p) + + Element term is unexpected following stuff, part, sheet, or note. + + + + + + + + + gix.347 + EATO element-appears-too-often + count(. | preceding-sibling::note) gt 1 + + Element note appears too many times: 1 maximum is permitted. + + + + + + + + + gix.347 + EATO element-appears-too-often + count(. | preceding-sibling::title) gt 1 + + Element title appears too many times: 1 maximum is permitted. + + + gix.390 + EOOO element-out-of-order + exists(preceding-sibling::entry | preceding-sibling::item | preceding-sibling::note | preceding-sibling::h1 | preceding-sibling::h2 | preceding-sibling::h3 | preceding-sibling::h4 | preceding-sibling::h5 | preceding-sibling::h6 | preceding-sibling::table | preceding-sibling::img | preceding-sibling::pre | preceding-sibling::hr | preceding-sibling::blockquote | preceding-sibling::ul | preceding-sibling::ol | preceding-sibling::p) + + Element title is unexpected following stuff, entry, item, or note. + + + + + + + + + gix.362 + empty(preceding-sibling::item) and exists(../(entry)) + + VEXC violates-exclusive-choice + Element item is unexpected along with entry. + + + + + + + + + gix.347 + EATO element-appears-too-often + count(. | preceding-sibling::note) gt 1 + + Element note appears too many times: 1 maximum is permitted. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gix.108 + EOOP element-out-of-place + Element { name() } is not permitted here. + + + + + gix.117 + AOOP attribute-out-of-place + Attribute @{ name() } is not permitted here. + + + + + + + + gix.748 + MRQA missing-required-attribute + empty(@id) + + Element { name() } requires attribute @id. + + + gix.445 + MRQC missing-required-contents + empty(title) + + Element { name() } requires element title. + + + + + + + + + + + + + + gix.748 + MRQA missing-required-attribute + empty(@id) + + Element { name() } requires attribute @id. + + + + + + + + + + + + gix.445 + MRQC missing-required-contents + empty(title) + + Element { name() } requires element title. + + + + + + + + + + + + + + + + + + + + + + + + + + + VDSX violates-datatype-syntax + + + gix.148 + + + { $class } + not(string(.) castable as xs:string and matches(.,'^\S(.*\S)?$')) + + Value { string(.) } of { if (self::element()) then 'element' else 'attribute' } { self::attribute()/'@' }{ name(.) } does not conform to string datatype. + + + + + VDSX violates-datatype-syntax + + + gix.148 + + + { $class } + not(string(.) castable as xs:string and matches(.,'^(\p{L}|_)(\p{L}|\p{N}|[.\-_])*$') and matches(.,'^\S(.*\S)?$')) + + Value { string(.) } of { if (self::element()) then 'element' else 'attribute' } { self::attribute()/'@' }{ name(.) } does not conform to token datatype. + + + + + VDSX violates-datatype-syntax + + + gix.148 + + + { $class } + not(string(.) castable as xs:nonNegativeInteger and matches(.,'^\S(.*\S)?$')) + + Value { string(.) } of { if (self::element()) then 'element' else 'attribute' } { self::attribute()/'@' }{ name(.) } does not conform to non-negative-integer datatype. + + + + + + + gix.390 + EOOO element-out-of-order + exists(preceding-sibling::part | preceding-sibling::notes) + + Element stuff is unexpected following part or notes/note. + + + + + gix.390 + EOOO element-out-of-order + exists(preceding-sibling::part | preceding-sibling::sheet | preceding-sibling::note) + + Element stuff is unexpected following part, sheet, or note. + + + + + gix.390 + EOOO element-out-of-order + exists(preceding-sibling::entry | preceding-sibling::item | preceding-sibling::note) + + Element stuff is unexpected following entry, item, or note. + + + + + + + + gix.390 + EOOO element-out-of-order + exists(preceding-sibling::term | preceding-sibling::part | preceding-sibling::notes | preceding-sibling::h1 | preceding-sibling::h2 | preceding-sibling::h3 | preceding-sibling::h4 | preceding-sibling::h5 | preceding-sibling::h6 | preceding-sibling::table | preceding-sibling::img | preceding-sibling::pre | preceding-sibling::hr | preceding-sibling::blockquote | preceding-sibling::ul | preceding-sibling::ol | preceding-sibling::p) + + Element title is unexpected following term, stuff, part, or notes/note. + + + + + gix.390 + EOOO element-out-of-order + exists(preceding-sibling::term | preceding-sibling::part | preceding-sibling::sheet | preceding-sibling::note | preceding-sibling::h1 | preceding-sibling::h2 | preceding-sibling::h3 | preceding-sibling::h4 | preceding-sibling::h5 | preceding-sibling::h6 | preceding-sibling::table | preceding-sibling::img | preceding-sibling::pre | preceding-sibling::hr | preceding-sibling::blockquote | preceding-sibling::ul | preceding-sibling::ol | preceding-sibling::p) + + Element title is unexpected following term, stuff, part, sheet, or note. + + + + + gix.390 + EOOO element-out-of-order + exists(preceding-sibling::entry | preceding-sibling::item | preceding-sibling::note | preceding-sibling::h1 | preceding-sibling::h2 | preceding-sibling::h3 | preceding-sibling::h4 | preceding-sibling::h5 | preceding-sibling::h6 | preceding-sibling::table | preceding-sibling::img | preceding-sibling::pre | preceding-sibling::hr | preceding-sibling::blockquote | preceding-sibling::ul | preceding-sibling::ol | preceding-sibling::p) + + Element title is unexpected following stuff, entry, item, or note. + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    diff --git a/src/testing/tinydata/current/tiny_json-schema.xml b/src/testing/tinydata/current/tiny_json-schema.xml new file mode 100644 index 00000000..eb100626 --- /dev/null +++ b/src/testing/tinydata/current/tiny_json-schema.xml @@ -0,0 +1,306 @@ + + http://json-schema.org/draft-07/schema# + http://csrc.nist.gov/ns/metaschema-xslt/tinydata/0.0.2/tiny-schema.json + Tiny Data Model: JSON Schema + object + + + Schema Directive + A JSON Schema directive to bind a specific schema to its document instance. + #/definitions/json-schema-directive + #/definitions/URIReferenceDatatype + + + Tiny Data + A minimally described data set. + #/definitions/tiny-tiny:TINY + object + + + Tiny ID + An identifier. + #/definitions/TokenDatatype + + + #/definitions/tiny-tiny:title + + + + + #/definitions/tiny-tiny:term + + + array + 1 + + #/definitions/tiny-tiny:term + + + + + + Stuff + Some amount of tiny stuff. + string + + + + + #/definitions/tiny-tiny:part + + + array + 1 + + #/definitions/tiny-tiny:part + + + + + + + + #/definitions/tiny-tiny:note + + + array + 1 + + #/definitions/tiny-tiny:note + + + + + + + id + title + + false + + + Title + markup-line example. + #/definitions/tiny-tiny:title + string + + + Term + Simple string value example. + #/definitions/tiny-tiny:term + object + + + Term identifier + A token identifying this term uniquely within the document. + #/definitions/TokenDatatype + + + #/definitions/StringDatatype + + + + STRVALUE + id + + false + + + Note + Wrapped markup-multiline example. + #/definitions/tiny-tiny:note + string + + + Tiny part + A bit of tiny data. + #/definitions/tiny-tiny:part + object + + + #/definitions/tiny-tiny:title + + + + + #/definitions/tiny-tiny:term + + + array + 1 + + #/definitions/tiny-tiny:term + + + + + + Stuff + Some amount of tiny stuff. + string + + + + + #/definitions/tiny-tiny:part + + + array + 1 + + #/definitions/tiny-tiny:part + + + + + + + + #/definitions/tiny-tiny:sheet + + + array + 1 + + #/definitions/tiny-tiny:sheet + + + + + + #/definitions/tiny-tiny:note + + + + title + + false + + + Tiny sheet + A list or grid of data points (items), or an entry (row or line item) in such a list or grid that contains such a list or grid. + #/definitions/tiny-tiny:sheet + object + + + Field key + Distinguishing a sheet or item (field) among siblings or neighbors. + #/definitions/TokenDatatype + + + Class + Class or classes. + #/definitions/StringDatatype + + + #/definitions/tiny-tiny:title + + + Stuff + Some amount of tiny stuff. + string + + + array + 1 + + #/definitions/tiny-tiny:sheet + + + + + + #/definitions/tiny-tiny:item + + + array + 1 + + #/definitions/tiny-tiny:item + + + + + + #/definitions/tiny-tiny:note + + + false + + + Line item + A value, potentially marked with @key or @class. + #/definitions/tiny-tiny:item + object + + + Field key + Distinguishing a sheet or item (field) among siblings or neighbors. + #/definitions/TokenDatatype + + + Class + Class or classes. + #/definitions/StringDatatype + + + N (position) + An indexed position (distinctive among values of parent::*/*/@n). + #/definitions/NonNegativeIntegerDatatype NonNegativeIntegerDatatype + + + object + + + + RICHTEXT + + false + + + A whole number value. + integer + + + An integer value that is equal to or greater than 0. + + + #/definitions/IntegerDatatype + + + number + 0 + + + + + A non-empty string with leading and trailing whitespace disallowed. Whitespace is: U+9, U+10, U+32 or [ + ]+ + string + ^\S(.*\S)?$ + + + A non-colonized name as defined by XML Schema Part 2: Datatypes Second Edition. https://www.w3.org/TR/xmlschema11-2/#NCName. + string + ^(\p{L}|_)(\p{L}|\p{N}|[.\-_])*$ + + + A URI Reference, either a URI or a relative-reference, formatted according to section 4.1 of RFC3986. + string + uri-reference + + + + + #/definitions/json-schema-directive + + + #/definitions/tiny-tiny:TINY + + + + TINY + + false + diff --git a/src/testing/tinydata/current/tiny_json-to-xml.xsl b/src/testing/tinydata/current/tiny_json-to-xml.xsl new file mode 100644 index 00000000..c5c5902e --- /dev/null +++ b/src/testing/tinydata/current/tiny_json-to-xml.xsl @@ -0,0 +1,780 @@ + + + + + + + + + + xml + + + No file found at { $file } + + + + + + + {{ $err:description }} + + + + + + + {{ $err:description }} + + + + + + + + + + + + Error in XSLT invocation - an initial template (-it) is expected ('from-json' or 'from-xdm-json-xml'), but none is given + + + + + + + + { $err:description } + + + + + + + + + + No XPath (XML) JSON found at { $file } - using syntax of http://www.w3.org/2005/xpath-functions + + + + + + + + + + + + + + + + + + + + + + + + + http://example.com/ns/tinydata + + + + + + TINY + + + + + + + + + + + + + + + + + + part + + + + + + + + + + + + + + + sheet + + + + + + + + + + + + + + + + + + + + + + + + + + + + + title + + + + + + + + + + + + + + + term + + + + + + + + + + + + + + + + + items + + + + + + + + + + + + + + + + + + + note + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    + + + + + +

    +
    +
    + + + + + + + + + + + + + + + + +
    + + + + + + + +
    +         
    +            language-{.}
    +         
    +         
    +      
    +
    + + +

    + + +

    +
    +
    + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + +

    + +

    +
    + ^\s*(\*|\d+\.)\s + + + +
  • + + +
    +
    + +
    +
  • +
    +
    +
    + + + + + + + + + + + + + + + + + + + +
  • + + + + + + + + +
  • +
    + + +
  • + + + + + +
  • +
    +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + &amp; + &lt; + + &quot; + + &#x2A; + &#x60; + &#x7E; + &#x5E; + + + + + + + + + + + + + + + + + + + "" + !\[{{$noclosebracket}}\] + \{\{\s*insert: ,\s*\s*\}\} + \(\) + `` + + \*\*\*\*\*\* + + \*\*\*\* + \*\* + ~~ + \^\^ + + + + + + + + + + + + + + + + (.*?) + + + (\i\c*?) + + + ([^{ @not }]*?) + + + + < + + + xmlns="http://csrc.nist.gov/ns/oscal/metaschema/1.0/supermodel" + + + > + + </ + + > + + + $1 + + + + <insert xmlns="http://csrc.nist.gov/ns/oscal/metaschema/1.0/supermodel" + + + /> + + + type='$1' + + + id-ref='$2' + + + href='$2' + + + + alt='$1' + + + + src='$2' + + + { insertion } + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    diff --git a/src/testing/tinydata/current/tiny_schema.json b/src/testing/tinydata/current/tiny_schema.json new file mode 100644 index 00000000..ebb5e69c --- /dev/null +++ b/src/testing/tinydata/current/tiny_schema.json @@ -0,0 +1,219 @@ + + { "$schema" : "http://json-schema.org/draft-07/schema#", + "$id" : "http://csrc.nist.gov/ns/metaschema-xslt/tinydata/0.0.2/tiny-schema.json", + "$comment" : "Tiny Data Model: JSON Schema", + "type" : "object", + "definitions" : + { "json-schema-directive" : + { "title" : "Schema Directive", + "description" : "A JSON Schema directive to bind a specific schema to its document instance.", + "$id" : "#/definitions/json-schema-directive", + "$ref" : "#/definitions/URIReferenceDatatype" }, + "tiny-tiny:TINY" : + { "title" : "Tiny Data", + "description" : "A minimally described data set.", + "$id" : "#/definitions/tiny-tiny:TINY", + "type" : "object", + "properties" : + { "id" : + { "title" : "Tiny ID", + "description" : "An identifier.", + "$ref" : "#/definitions/TokenDatatype" }, + "title" : + { "$ref" : "#/definitions/tiny-tiny:title" }, + "terminology" : + { "anyOf" : + [ + { "$ref" : "#/definitions/tiny-tiny:term" }, + + { "type" : "array", + "minItems" : 1, + "items" : + { "$ref" : "#/definitions/tiny-tiny:term" } } ] }, + "stuff" : + { "title" : "Stuff", + "description" : "Some amount of tiny stuff.", + "type" : "string" }, + "parts" : + { "anyOf" : + [ + { "$ref" : "#/definitions/tiny-tiny:part" }, + + { "type" : "array", + "minItems" : 1, + "items" : + { "$ref" : "#/definitions/tiny-tiny:part" } } ] }, + "notes" : + { "anyOf" : + [ + { "$ref" : "#/definitions/tiny-tiny:note" }, + + { "type" : "array", + "minItems" : 1, + "items" : + { "$ref" : "#/definitions/tiny-tiny:note" } } ] } }, + "required" : + [ "id", + "title" ], + "additionalProperties" : false }, + "tiny-tiny:title" : + { "title" : "Title", + "description" : "markup-line example.", + "$id" : "#/definitions/tiny-tiny:title", + "type" : "string" }, + "tiny-tiny:term" : + { "title" : "Term", + "description" : "Simple string value example.", + "$id" : "#/definitions/tiny-tiny:term", + "type" : "object", + "properties" : + { "id" : + { "title" : "Term identifier", + "description" : "A token identifying this term uniquely within the document.", + "$ref" : "#/definitions/TokenDatatype" }, + "STRVALUE" : + { "$ref" : "#/definitions/StringDatatype" } }, + "required" : + [ "STRVALUE", + "id" ], + "additionalProperties" : false }, + "tiny-tiny:note" : + { "title" : "Note", + "description" : "Wrapped markup-multiline example.", + "$id" : "#/definitions/tiny-tiny:note", + "type" : "string" }, + "tiny-tiny:part" : + { "title" : "Tiny part", + "description" : "A bit of tiny data.", + "$id" : "#/definitions/tiny-tiny:part", + "type" : "object", + "properties" : + { "title" : + { "$ref" : "#/definitions/tiny-tiny:title" }, + "terminology" : + { "anyOf" : + [ + { "$ref" : "#/definitions/tiny-tiny:term" }, + + { "type" : "array", + "minItems" : 1, + "items" : + { "$ref" : "#/definitions/tiny-tiny:term" } } ] }, + "stuff" : + { "title" : "Stuff", + "description" : "Some amount of tiny stuff.", + "type" : "string" }, + "parts" : + { "anyOf" : + [ + { "$ref" : "#/definitions/tiny-tiny:part" }, + + { "type" : "array", + "minItems" : 1, + "items" : + { "$ref" : "#/definitions/tiny-tiny:part" } } ] }, + "sheets" : + { "anyOf" : + [ + { "$ref" : "#/definitions/tiny-tiny:sheet" }, + + { "type" : "array", + "minItems" : 1, + "items" : + { "$ref" : "#/definitions/tiny-tiny:sheet" } } ] }, + "note" : + { "$ref" : "#/definitions/tiny-tiny:note" } }, + "required" : + [ "title" ], + "additionalProperties" : false }, + "tiny-tiny:sheet" : + { "title" : "Tiny sheet", + "description" : "A list or grid of data points (items), or an entry (row or line item) in such a list or grid that contains such a list or grid.", + "$id" : "#/definitions/tiny-tiny:sheet", + "type" : "object", + "properties" : + { "key" : + { "title" : "Field key", + "description" : "Distinguishing a sheet or item (field) among siblings or neighbors.", + "$ref" : "#/definitions/TokenDatatype" }, + "class" : + { "title" : "Class", + "description" : "Class or classes.", + "$ref" : "#/definitions/StringDatatype" }, + "title" : + { "$ref" : "#/definitions/tiny-tiny:title" }, + "stuff" : + { "title" : "Stuff", + "description" : "Some amount of tiny stuff.", + "type" : "string" }, + "sheets" : + { "type" : "array", + "minItems" : 1, + "items" : + { "$ref" : "#/definitions/tiny-tiny:sheet" } }, + "items" : + { "anyOf" : + [ + { "$ref" : "#/definitions/tiny-tiny:item" }, + + { "type" : "array", + "minItems" : 1, + "items" : + { "$ref" : "#/definitions/tiny-tiny:item" } } ] }, + "note" : + { "$ref" : "#/definitions/tiny-tiny:note" } }, + "additionalProperties" : false }, + "tiny-tiny:item" : + { "title" : "Line item", + "description" : "A value, potentially marked with @key or @class.", + "$id" : "#/definitions/tiny-tiny:item", + "type" : "object", + "properties" : + { "key" : + { "title" : "Field key", + "description" : "Distinguishing a sheet or item (field) among siblings or neighbors.", + "$ref" : "#/definitions/TokenDatatype" }, + "class" : + { "title" : "Class", + "description" : "Class or classes.", + "$ref" : "#/definitions/StringDatatype" }, + "n" : + { "title" : "N (position)", + "description" : "An indexed position (distinctive among values of parent::*/*/@n).", + "$ref" : "#/definitions/NonNegativeIntegerDatatype NonNegativeIntegerDatatype" }, + "RICHTEXT" : + { "type" : "object" } }, + "required" : + [ "RICHTEXT" ], + "additionalProperties" : false }, + "IntegerDatatype" : + { "description" : "A whole number value.", + "type" : "integer" }, + "NonNegativeIntegerDatatype" : + { "description" : "An integer value that is equal to or greater than 0.", + "allOf" : + [ + { "$ref" : "#/definitions/IntegerDatatype" }, + + { "type" : "number", + "minimum" : 0 } ] }, + "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.", + "type" : "string", + "pattern" : "^(\\p{L}|_)(\\p{L}|\\p{N}|[.\\-_])*$" }, + "URIReferenceDatatype" : + { "description" : "A URI Reference, either a URI or a relative-reference, formatted according to section 4.1 of RFC3986.", + "type" : "string", + "format" : "uri-reference" } }, + "properties" : + { "$schema" : + { "$ref" : "#/definitions/json-schema-directive" }, + "TINY" : + { "$ref" : "#/definitions/tiny-tiny:TINY" } }, + "required" : + [ "TINY" ], + "additionalProperties" : false } \ No newline at end of file diff --git a/src/testing/tinydata/current/tiny_schema.xsd b/src/testing/tinydata/current/tiny_schema.xsd new file mode 100644 index 00000000..0fa3bbe5 --- /dev/null +++ b/src/testing/tinydata/current/tiny_schema.xsd @@ -0,0 +1,498 @@ + + + + Tiny Data Model + 0.0.2 + tiny + +

    Tiny Metaschema

    +

    A metaschema can be small and yet deep.

    +
    + TINY +
    +
    + + + + + Tiny Data + A minimally described data set. + + + Tiny Data: A minimally described data set. + + + + + + + + + + + + + Note + Wrapped markup-multiline example. + + + Note: Wrapped markup-multiline example. + + + + + + + + + + + + + Tiny ID + An identifier. + + + Tiny ID: An identifier. + + + + + + + Title + markup-line example. + + + Title: markup-line example. + + + + + + + + + Term + Simple string value example. + + + Term: Simple string value example. + + + + + + + Term identifier + A token identifying this term uniquely within the document. + + + Term identifier: A token identifying this term uniquely within the document. + + + + + + + + + Note + Wrapped markup-multiline example. + + + Note: Wrapped markup-multiline example. + + + + + + + + + Tiny part + A bit of tiny data. + + + Tiny part: A bit of tiny data. + + + + + + + + + + + Note + Wrapped markup-multiline example. + + + Note: Wrapped markup-multiline example. + + + + + + + + + + + Tiny sheet + A list or grid of data points (items), or an entry (row or line item) in such a list or grid that contains such a list or grid. + + + Tiny sheet: A list or grid of data points (items), or an entry (row or line item) in such a list or grid that contains such a list or grid. + + + + + + + + + + + + Note + Wrapped markup-multiline example. + + + Note: Wrapped markup-multiline example. + + + + + + + + + + Field key + Distinguishing a sheet or item (field) among siblings or neighbors. + + + Field key: Distinguishing a sheet or item (field) among siblings or neighbors. + + + + + + Class + Class or classes. + + + Class: Class or classes. + + + + + + + Line item + A value, potentially marked with @key or @class. + + + Line item: A value, potentially marked with @key or @class. + + + + + + + Field key + Distinguishing a sheet or item (field) among siblings or neighbors. + + + Field key: Distinguishing a sheet or item (field) among siblings or neighbors. + + + + + + Class + Class or classes. + + + Class: Class or classes. + + + + + + N (position) + An indexed position (distinctive among values of parent::*/*/@n). + + + N (position): An indexed position (distinctive among values of parent::*/*/@n). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The content model is the same as inlineMarkupType, but line endings need + to be preserved, since this is pre-formatted. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + An insert can be used to identify a placeholder for dynamically inserting text related to a specific object, which is referenced by the object's identifier using an id-ref. This insert mechanism allows the selection of which text value from the object to dynamically include based on the application's display requirements. + + + + The type of object to include from (e.g., parameter, control, component, role, etc.) + + + + + The identity of the object to insert a value for. The identity will be selected from the index of objects of the specified type. The specific value to include is based on the application's display requirements, which will likely use a specific data element associated with the type (e.g., title, identifier, value, etc.) that is appropriate for the application. + + + + + + An integer value that is equal to or greater than 0. + + + + + This pattern ensures that leading and trailing whitespace is + disallowed. This helps to even the user experience between implementations + related to whitespace. + + + + + + + A non-empty string of Unicode characters with leading and trailing whitespace + disallowed. Whitespace is: U+9, U+10, U+32 or [ \n\t]+ + + + + The 'string' datatype restricts the XSD type by prohibiting leading + and trailing whitespace, and something (not only whitespace) is required. + + + + + This pattern ensures that leading and trailing whitespace is + disallowed. This helps to even the user experience between implementations + related to whitespace. + + + + + + + + A non-empty, non-colonized name as defined by XML Schema Part 2: Datatypes + Second Edition (https://www.w3.org/TR/xmlschema11-2/#NCName), with leading and trailing + whitespace disallowed. + + + + + + A single token may not contain whitespace. + + + + + +
    diff --git a/src/testing/tinydata/current/tiny_xml-to-json.xsl b/src/testing/tinydata/current/tiny_xml-to-json.xsl new file mode 100644 index 00000000..b63a218e --- /dev/null +++ b/src/testing/tinydata/current/tiny_xml-to-json.xsl @@ -0,0 +1,755 @@ + + + + + + + json + no + + + + + + + + + + + + + + + { $err:description } + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $err:description } + + + + + + + + + + + + + + + + + + http://example.com/ns/tinydata + + + + + TINY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + part + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sheet + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + title + + + + + + + + + + + term + + + + + + + + + + + + items + + + + + + + + + + + + + + note + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + # + ## + ### + #### + ##### + ###### + + + + + + + + + + + | + + --- | + + + + + + | + + + | + + + + ``` + + + + ``` + + + + + + + + + + + + + + + * + + + + + + + + + 1. + + + + + ` + + ` + + + * + + * + + + ** + + ** + + + " + + " + + + {{ insert: + + }} + + + [ + + ] + ( + + ) + + + ![ + + ] + ( + + + "{.}" + + ) + + diff --git a/src/testing/tinydata/readme.md b/src/testing/tinydata/readme.md new file mode 100644 index 00000000..8e86fa5c --- /dev/null +++ b/src/testing/tinydata/readme.md @@ -0,0 +1,62 @@ +# Tiny Data Example Metaschema + +Purpose: An illustrative metaschema for testing + +Meant to be complementary to other testing Metaschemas for example the 'Everything' or 'computer model' metaschemas. + +Aims: + +- Be lightweight, tractable and intelligible +- Be actually albeit hypothetically useful i.e. be plausible & 'realistic' - more than a toy +- Illustrate basic (but not advanced) Metaschema functionality +- Illustrate core concepts including + - Recursive assemblies + - Mixing prose with structure + - both `markup-line` and `markup-multiline` datatypes + - Key-based text expansion (**insert/@ref-id**) + - Data dumps + - Layered constraints? + +## Basic model + +TinyData provides a simple model suitable for glossaries, dictionaries and similar structured prose, supplemented with a general-purpose "grid" or data-dump model. + +It is suitable for high-level structured documentation. But also for what might be CSV, JSON, or HTML tables. Also suitable for documents with islands of structure, or structures with islands of documentation. + +Functional semantics provided for include indexing and reasonably decent formatting for reuse, as HTML and Markdown among other formats. + +But the entire markup language has no more than ten or fifteen tags (depending on how you count). + +Meanwhile we get XSD, JSON Schemas, converters and other utilities (InspectorXSLT) to play with. + +Since it is straightforward to map a [Metaschema-based](https://github.com/usnistgov/metaschema) format into another Metaschema-based format, producing OSCAL (for example) from TinyData ought to be an instructive if elementary exercise. + +## dev punchlist + +Addressing https://github.com/usnistgov/metaschema-xslt/issues/105 + +But also leaving this resource intact for later use + +- Copy scripting over from ../issue105/ +- Refresh validators: XSD, JSON Schema and InspectorXSLT + - leave XProc in place for later use +- Validate `choice` use case + - field test this against samples (good vs broken) + - demonstrate XSD, JSON Schema *and InspectorXSLT* + - XSpec JSON Schema correction in ../../src/schema-gen/JSON-schema/ +- Assess issue with datatype handling + - are markup-line and markup-multiline adequately handled + - https://github.com/usnistgov/OSCAL/issues/2007 + - also sketch this out in XSpec +- Build out solution + - using ../../src/schema-gen/JSON-schema/choice-split.xsl + +- Makefile - `run tests` should include + - XSpecs over in ../../src + - field testing JSON and XSD validations of TinyData? (maybe not) +- Utilities? + - XSLT for TinyData making HTML + - Markdown? + - CSS for editor or browser + +Further: build out TinyData examples \ No newline at end of file diff --git a/src/testing/tinydata/refresh-tiny-converters.sh b/src/testing/tinydata/refresh-tiny-converters.sh new file mode 100644 index 00000000..269fb621 --- /dev/null +++ b/src/testing/tinydata/refresh-tiny-converters.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# shellcheck source=../common/subcommand_common.bash + +source "$SCRIPT_DIR/../../common/subcommand_common.bash" + +usage() { + cat <&2 + rm -f "$XJ_CONVERTER" +fi + +if [ -e "$JX_CONVERTER" ]; then + echo "Overwriting prior $JX_CONVERTER..." >&2 + rm -f "$JX_CONVERTER" +fi + +invoke_calabash "${CALABASH_ARGS}" + +if [ -e "$XJ_CONVERTER" ] && [ -e "$JX_CONVERTER" ]; then + echo "Wrote fresh XML/JSON conversion XSLTs into ${OUTPUT_DIR}" >&2 +fi + +fi diff --git a/src/testing/tinydata/refresh-tiny-schemas.sh b/src/testing/tinydata/refresh-tiny-schemas.sh new file mode 100644 index 00000000..8bf3ab2e --- /dev/null +++ b/src/testing/tinydata/refresh-tiny-schemas.sh @@ -0,0 +1,95 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# shellcheck source=../common/subcommand_common.bash + +source "$SCRIPT_DIR/../../common/subcommand_common.bash" + +usage() { + cat <&2 + rm -f "$COMPOSED_METASCHEMA" +fi + +if [ -e "$XSD_FILE" ]; then + echo "Overwriting prior $XSD_FILE..." >&2 + rm -f "$XSD_FILE" +fi + +if [ -e "$JSONSCHEMA_FILE" ]; then + echo "Overwriting prior $JSONSCHEMA_FILE..." >&2 + rm -f "$JSONSCHEMA_FILE" +fi + +if [ -e "$JSONSCHEMA_XMLFILE" ]; then + echo "Overwriting prior $JSONSCHEMA_XMLFILE..." >&2 + rm -f "$JSONSCHEMA_XMLFILE" +fi + +if [ -e "$INSPECTORXSLT_FILE" ]; then + echo "Overwriting prior $INSPECTORXSLT_FILE..." >&2 + rm -f "$INSPECTORXSLT_FILE" +fi + + +# echo "${CALABASH_ARGS}" + +invoke_calabash "${CALABASH_ARGS}" + +if [ -e "$XSD_FILE" ] && [ -e "$JSONSCHEMA_FILE" ] && [ -e "$INSPECTORXSLT_FILE" ]; then + echo "Wrote composed metaschema (de-referenced input) to $COMPOSED_METASCHEMA" >&2 + echo "Wrote XSD to $XSD_FILE" >&2 + echo "Wrote JSON schema to $JSONSCHEMA_FILE" >&2 + echo "Wrote JSON schema (XML notation) to $JSONSCHEMA_XMLFILE" >&2 + echo "Wrote Inspector XSLT to $INSPECTORXSLT_FILE" >&2 +fi + +fi diff --git a/src/testing/tinydata/tiny-data/bigbadtiny.xml b/src/testing/tinydata/tiny-data/bigbadtiny.xml new file mode 100644 index 00000000..71e83693 --- /dev/null +++ b/src/testing/tinydata/tiny-data/bigbadtiny.xml @@ -0,0 +1,30 @@ + + + Big Bad Tiny Data +

    A tiny data example sheet.

    +

    Find examples of both valid and invalid markup-line and markup-multiline in a pretend operational context.

    + + Some valid data +

    Here's some okay markup multiline, all clear.

    +

    A markup zoo permits all kinds of inline markup including bold, strong, italic, emphasis, code, subscript, superscript, hypertext anchors, and img alt-text for file.jpg (insertion points and images)

    + + Valid structures +

    Including:

    +
      +
    • lists
    • +
    • tables
    • +
    • preformatted blocks
    • +
    • block quotes
    • +
    +
    + + Here's a data sheet + + a + b + + +
    +
    diff --git a/src/testing/tinydata/tiny-data/tiny1.xml b/src/testing/tinydata/tiny-data/tiny1.xml new file mode 100644 index 00000000..5fb5c1f0 --- /dev/null +++ b/src/testing/tinydata/tiny-data/tiny1.xml @@ -0,0 +1,22 @@ + + + Hello World + + Part First + + Some part +

    Some parting words.

    +
    + +

    Take note here.

    +
    +
    + + +

    An endnote, with emphasis.

    +
    +
    +
    \ No newline at end of file diff --git a/src/testing/tinydata/tiny-json-validate-xp3.sh b/src/testing/tinydata/tiny-json-validate-xp3.sh new file mode 100644 index 00000000..17a5ae92 --- /dev/null +++ b/src/testing/tinydata/tiny-json-validate-xp3.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# shellcheck source=../common/subcommand_common.bash + +source "$SCRIPT_DIR/../../common/subcommand_common.bash" + +usage() { + cat < + http://json-schema.org/draft-07/schema# + http://csrc.nist.gov/ns/metaschema-xslt/tinydata/0.0.2/tiny-schema.json + Tiny Data Model: JSON Schema + object + + + Schema Directive + A JSON Schema directive to bind a specific schema to its document instance. + #/definitions/json-schema-directive + #/definitions/URIReferenceDatatype + + + Tiny Data + A minimally described data set. + #/definitions/tiny-tiny:TINY + object + + + Tiny ID + An identifier. + #/definitions/TokenDatatype + + + #/definitions/tiny-tiny:title + + + + + #/definitions/tiny-tiny:term + + + array + 1 + + #/definitions/tiny-tiny:term + + + + + + Stuff + Some amount of tiny stuff. + string + + + + + #/definitions/tiny-tiny:part + + + array + 1 + + #/definitions/tiny-tiny:part + + + + + + + + #/definitions/tiny-tiny:note + + + array + 1 + + #/definitions/tiny-tiny:note + + + + + + + id + title + + false + + + Title + markup-line example. + #/definitions/tiny-tiny:title + string + + + Term + Simple string value example. + #/definitions/tiny-tiny:term + object + + + Term identifier + A token identifying this term uniquely within the document. + #/definitions/TokenDatatype + + + #/definitions/StringDatatype + + + + STRVALUE + id + + false + + + Note + Wrapped markup-multiline example. + #/definitions/tiny-tiny:note + string + + + Tiny part + A bit of tiny data. + #/definitions/tiny-tiny:part + object + + + #/definitions/tiny-tiny:title + + + + + #/definitions/tiny-tiny:term + + + array + 1 + + #/definitions/tiny-tiny:term + + + + + + Stuff + Some amount of tiny stuff. + string + + + + + #/definitions/tiny-tiny:part + + + array + 1 + + #/definitions/tiny-tiny:part + + + + + + + + #/definitions/tiny-tiny:sheet + + + array + 1 + + #/definitions/tiny-tiny:sheet + + + + + + #/definitions/tiny-tiny:note + + + + title + + false + + + Tiny sheet + A list or grid of data points (items), or an entry (row or line item) in such a list or grid that contains such a list or grid. + #/definitions/tiny-tiny:sheet + object + + + + + Field key + Distinguishing a sheet or item (field) among siblings or neighbors. + #/definitions/TokenDatatype + + + Class + Class or classes. + #/definitions/StringDatatype + + + #/definitions/tiny-tiny:title + + + Stuff + Some amount of tiny stuff. + string + + + array + 1 + + #/definitions/tiny-tiny:sheet + + + + #/definitions/tiny-tiny:note + + + false + + + + + Field key + Distinguishing a sheet or item (field) among siblings or neighbors. + #/definitions/TokenDatatype + + + Class + Class or classes. + #/definitions/StringDatatype + + + #/definitions/tiny-tiny:title + + + Stuff + Some amount of tiny stuff. + string + + + + + #/definitions/tiny-tiny:item + + + array + 1 + + #/definitions/tiny-tiny:item + + + + + + #/definitions/tiny-tiny:note + + + false + + + + + Line item + A value, potentially marked with @key or @class. + #/definitions/tiny-tiny:item + object + + + Field key + Distinguishing a sheet or item (field) among siblings or neighbors. + #/definitions/TokenDatatype + + + Class + Class or classes. + #/definitions/StringDatatype + + + N (position) + An indexed position (distinctive among values of parent::*/*/@n). + #/definitions/NonNegativeIntegerDatatype NonNegativeIntegerDatatype + + + object + + + + RICHTEXT + + false + + + A whole number value. + integer + + + An integer value that is equal to or greater than 0. + + + #/definitions/IntegerDatatype + + + number + 0 + + + + + A non-empty string with leading and trailing whitespace disallowed. Whitespace is: U+9, U+10, U+32 or [ + ]+ + string + ^\S(.*\S)?$ + + + A non-colonized name as defined by XML Schema Part 2: Datatypes Second Edition. https://www.w3.org/TR/xmlschema11-2/#NCName. + string + ^(\p{L}|_)(\p{L}|\p{N}|[.\-_])*$ + + + A URI Reference, either a URI or a relative-reference, formatted according to section 4.1 of RFC3986. + string + uri-reference + + + + + #/definitions/json-schema-directive + + + #/definitions/tiny-tiny:TINY + + + + TINY + + false +
    diff --git a/src/testing/tinydata/tiny_metaschema.xml b/src/testing/tinydata/tiny_metaschema.xml new file mode 100644 index 00000000..359dfd58 --- /dev/null +++ b/src/testing/tinydata/tiny_metaschema.xml @@ -0,0 +1,161 @@ + + + Tiny Data Model + 0.0.2 + tiny + http://csrc.nist.gov/ns/metaschema-xslt/tinydata + http://csrc.nist.gov/ns/metaschema-xslt/tinydata + + + + +

    Tiny Metaschema

    +

    A metaschema can be small and yet deep.

    +
    + + + Tiny Data + A minimally described data set. + TINY + + Tiny ID + An identifier. + + + + + + + + Stuff + Some amount of tiny stuff. + + + + + + + + + + + + Title + markup-line example. + + + + Term + Simple string value example. + + Term identifier + A token identifying this term uniquely within the document. + + +

    For a more extensive model supporting definitions, acronyms etc. build this out into an assembly. + As a field, this supports some control over the vocabulary and formatting without heavier embedded metadata.

    +

    Of course you could always make a structured glossary out of regular and controlled parts for your terminology, and use this inside it, potentially with title/insert.

    +
    +
    + + + Note + Wrapped markup-multiline example. + + + + Tiny part + A bit of tiny data. + + + + + + + Stuff + Some amount of tiny stuff. + + + + + + + + + + + + + Tiny sheet + A list or grid of data points (items), or an entry (row or line item) in such a list or grid that contains such a list or grid. + + + + + + + + Stuff + Some amount of tiny stuff. + + + + entry + + + + + item + + + + + + + + + Line item + A value, potentially marked with @key or @class. + + + + N (position) + An indexed position (distinctive among values of parent::*/*/@n). + + + + Distinctive 'n' value + @n must be distinctive among sibling items. + +

    A whole number is expected here although '0' is permitted. Values among siblings are not constrained to be ordered, only different. Ordering is up to the receiving application.

    +
    +
    +
    +

    An application may constrain the value of the node to a datatype or other requirement, on the basis of @key, @class or other association(s).

    +
    + + + Field key + Distinguishing a sheet or item (field) among siblings or neighbors. + + + + Class + Class or classes. + + +
    diff --git a/src/testing/tinydata/tinydata_xml-converter.xsl b/src/testing/tinydata/tinydata_xml-converter.xsl new file mode 100644 index 00000000..8ae7ca90 --- /dev/null +++ b/src/testing/tinydata/tinydata_xml-converter.xsl @@ -0,0 +1,17 @@ + + + + + + + yes + + + + + + + diff --git a/src/testing/tinydata/validate-tiny-json.xp3 b/src/testing/tinydata/validate-tiny-json.xp3 new file mode 100644 index 00000000..ebc0c7e4 --- /dev/null +++ b/src/testing/tinydata/validate-tiny-json.xp3 @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/validate/METASCHEMA-SCHXSLT-VALIDATE.xpl b/src/validate/METASCHEMA-SCHXSLT-VALIDATE.xpl index a812d25d..474d2ea8 100644 --- a/src/validate/METASCHEMA-SCHXSLT-VALIDATE.xpl +++ b/src/validate/METASCHEMA-SCHXSLT-VALIDATE.xpl @@ -5,8 +5,6 @@ xmlns:schxslt="https://doi.org/10.5281/zenodo.1495494" type="metaschema:METASCHEMA-SCHXSLT-VALIDATE" name="METASCHEMA-SCHXSLT-VALIDATE"> - - @@ -28,6 +26,8 @@ + + From 58dd94ecae715c4af97ca81016125ea1f03ca732 Mon Sep 17 00:00:00 2001 From: Wendell Piez Date: Wed, 5 Jun 2024 10:03:42 -0400 Subject: [PATCH 10/19] updating xslt3 functions submodule to current main --- support/xslt3-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/xslt3-functions b/support/xslt3-functions index bb680f78..bc3f7a90 160000 --- a/support/xslt3-functions +++ b/support/xslt3-functions @@ -1 +1 @@ -Subproject commit bb680f78e0c41cdc5944e08c36099e761bc160a9 +Subproject commit bc3f7a90707beeb685564461e404d0158037cb1a From 914270759289f3fbbd2084e5937cd1e0db0278dc Mon Sep 17 00:00:00 2001 From: Wendell Piez Date: Wed, 5 Jun 2024 13:38:48 -0400 Subject: [PATCH 11/19] Weirdest thing, correcting a validation error got into the models_metaschema.xml --- src/testing/models_metaschema.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/testing/models_metaschema.xml b/src/testing/models_metaschema.xml index 0b72c8d6..4a441e7c 100644 --- a/src/testing/models_metaschema.xml +++ b/src/testing/models_metaschema.xml @@ -45,11 +45,11 @@ assembly everything. EVERYTHING + + Deprecated + a deprecated flag. + - - Deprecated - a deprecated flag. - overloaded1 From bcc7b3bd699e72993682b8845e2012b7a7b7367d Mon Sep 17 00:00:00 2001 From: Wendell Piez Date: Wed, 5 Jun 2024 13:42:29 -0400 Subject: [PATCH 12/19] Removing errant testing.md file, now belongs in submodule --- support/xspec-dev/testing.md | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 support/xspec-dev/testing.md diff --git a/support/xspec-dev/testing.md b/support/xspec-dev/testing.md deleted file mode 100644 index 6bec6661..00000000 --- a/support/xspec-dev/testing.md +++ /dev/null @@ -1,28 +0,0 @@ -# Testing - -This work in support of XSpec is in need of more rigorous testing. - -Interactive testing has been performed with all scripts. - -But requirements and specifications are loose, having been driven up to this point by functional requirements faced by the metaschema-xslt project - for a flexible, performant runtime that works independently of licensed software, with developer-friendly controls from the command line and inside CI/CD. Specifically, this means a number of issues, including testing, that bear on full integration back into XSpec have been set aside for the present. - -Some experience in application will also be helpful in prioritizing the testing work to be done. - -Meanwhile, some interesting questions, both practical and theoretical, are posed by the need to test these capabilities, especially outside particular deployments. - -For which capabilities can we write XSpec or meaningfully test and confirm (expose and document) in other ways, including - - - `xsl:message` behavior including terminate="yes" - - side effects such as `xsl:result-document`? - - Runtime parameter semantics - - Exception handling - -(XSpec especially with `@run-as='external'` is able to provide support for much of this, but specific means are tbd.) - -Contributor at-galtm also notes that message handling code in the [xslt3-functions project repository](https://github.com/usnistgov/xslt3-functions) is configurable to emit processing instructions (instead of or with `xsl:message`) as message proxies, making this functionality testable. - -Additionally, plenty of 'obvious' tasks remain to be done, including - - - Addressing functional gaps e.g. Schematron, `x:label`, `x:pending` - - Scope/coverage analysis - - XSpec for "easy" stuff, including HTML rendering From 46e6cdc6df6fb97ac27807f1dcbd61f682913c66 Mon Sep 17 00:00:00 2001 From: Wendell Piez Date: Wed, 5 Jun 2024 17:07:16 -0400 Subject: [PATCH 13/19] Improvements to testing; repairing datatype lapse accounting for bug #2007 --- src/common/metaschema-ws-strip.xsl | 13 +++-- .../JSON-schema/make-json-schema-metamap.xsl | 10 ++-- .../metamap-test.xspec | 57 +++++++++++++------ src/schema-gen/XSD/make-metaschema-xsd.xsl | 2 + 4 files changed, 54 insertions(+), 28 deletions(-) diff --git a/src/common/metaschema-ws-strip.xsl b/src/common/metaschema-ws-strip.xsl index a5f76cf1..8896923e 100644 --- a/src/common/metaschema-ws-strip.xsl +++ b/src/common/metaschema-ws-strip.xsl @@ -1,24 +1,27 @@ + + + a insert code em i b strong sub sup fn:string"/> - + - + - + \ No newline at end of file diff --git a/src/schema-gen/JSON-schema/make-json-schema-metamap.xsl b/src/schema-gen/JSON-schema/make-json-schema-metamap.xsl index 0371ba7d..684da0cd 100644 --- a/src/schema-gen/JSON-schema/make-json-schema-metamap.xsl +++ b/src/schema-gen/JSON-schema/make-json-schema-metamap.xsl @@ -145,7 +145,10 @@
    - + + @@ -160,8 +163,6 @@ - - @@ -261,8 +262,6 @@
    - - @@ -278,6 +277,7 @@ + diff --git a/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/metamap-test.xspec b/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/metamap-test.xspec index e2b38cb9..6a5401d5 100644 --- a/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/metamap-test.xspec +++ b/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/metamap-test.xspec @@ -9,13 +9,28 @@ xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" stylesheet="../../../make-json-schema-metamap.xsl" - xslt-version="3.0" run-as="external"> + xslt-version="3.0"> + + + + + + + + + + @@ -28,24 +43,30 @@ - - - - - - - - + + + + + + - + + + + diff --git a/src/schema-gen/XSD/make-metaschema-xsd.xsl b/src/schema-gen/XSD/make-metaschema-xsd.xsl index 59b03f55..3d5998db 100644 --- a/src/schema-gen/XSD/make-metaschema-xsd.xsl +++ b/src/schema-gen/XSD/make-metaschema-xsd.xsl @@ -68,6 +68,8 @@ IntegerDatatype IPV4AddressDatatype IPV6AddressDatatype + MarkupLineDatatype + MarkupMultilineDatatype NonNegativeIntegerDatatype PositiveIntegerDatatype StringDatatype From ccd7af7e325a64b686eb5b6dd67ddf2f5e184b38 Mon Sep 17 00:00:00 2001 From: Wendell Piez Date: Thu, 6 Jun 2024 11:00:40 -0400 Subject: [PATCH 14/19] Improvements to JSON Schema testing, mainly --- .../JSON-schema/make-json-schema-metamap.xsl | 21 +-- .../metamap-test.xspec | 4 + .../tinydata/current/tiny_inspector.xsl | 2 +- .../tinydata/current/tiny_json-schema.xml | 126 ++++++++++++------ src/testing/tinydata/current/tiny_schema.json | 98 +++++++++----- .../tinydata/tiny_json-schema-corrected.xml | 98 ++++++++------ 6 files changed, 212 insertions(+), 137 deletions(-) diff --git a/src/schema-gen/JSON-schema/make-json-schema-metamap.xsl b/src/schema-gen/JSON-schema/make-json-schema-metamap.xsl index 684da0cd..d022c957 100644 --- a/src/schema-gen/JSON-schema/make-json-schema-metamap.xsl +++ b/src/schema-gen/JSON-schema/make-json-schema-metamap.xsl @@ -175,20 +175,25 @@ object + + - + - + @@ -200,25 +205,13 @@ - - - - - - diff --git a/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/metamap-test.xspec b/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/metamap-test.xspec index 6a5401d5..4a617357 100644 --- a/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/metamap-test.xspec +++ b/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/metamap-test.xspec @@ -56,6 +56,10 @@ + + + exclude-result-prefixes="#all"> diff --git a/src/testing/tinydata/current/tiny_json-schema.xml b/src/testing/tinydata/current/tiny_json-schema.xml index eb100626..7fc22741 100644 --- a/src/testing/tinydata/current/tiny_json-schema.xml +++ b/src/testing/tinydata/current/tiny_json-schema.xml @@ -42,7 +42,7 @@ Stuff Some amount of tiny stuff. - string + #/definitions/MarkupMultilineDatatype @@ -83,7 +83,7 @@ Title markup-line example. #/definitions/tiny-tiny:title - string + #/definitions/MarkupLineDatatype Term @@ -110,7 +110,7 @@ Note Wrapped markup-multiline example. #/definitions/tiny-tiny:note - string + #/definitions/MarkupMultilineDatatype Tiny part @@ -138,7 +138,7 @@ Stuff Some amount of tiny stuff. - string + #/definitions/MarkupMultilineDatatype @@ -182,51 +182,81 @@ A list or grid of data points (items), or an entry (row or line item) in such a list or grid that contains such a list or grid. #/definitions/tiny-tiny:sheet object - - - Field key - Distinguishing a sheet or item (field) among siblings or neighbors. - #/definitions/TokenDatatype - - - Class - Class or classes. - #/definitions/StringDatatype - - - #/definitions/tiny-tiny:title - - - Stuff - Some amount of tiny stuff. - string - - - array - 1 - - #/definitions/tiny-tiny:sheet - - - - - - #/definitions/tiny-tiny:item + + + + + Field key + Distinguishing a sheet or item (field) among siblings or neighbors. + #/definitions/TokenDatatype - + + Class + Class or classes. + #/definitions/StringDatatype + + + #/definitions/tiny-tiny:title + + + Stuff + Some amount of tiny stuff. + #/definitions/MarkupMultilineDatatype + + array 1 - #/definitions/tiny-tiny:item + #/definitions/tiny-tiny:sheet - + + #/definitions/tiny-tiny:note + + + false - - #/definitions/tiny-tiny:note + + + + Field key + Distinguishing a sheet or item (field) among siblings or neighbors. + #/definitions/TokenDatatype + + + Class + Class or classes. + #/definitions/StringDatatype + + + #/definitions/tiny-tiny:title + + + Stuff + Some amount of tiny stuff. + #/definitions/MarkupMultilineDatatype + + + + + #/definitions/tiny-tiny:item + + + array + 1 + + #/definitions/tiny-tiny:item + + + + + + #/definitions/tiny-tiny:note + + + false - - false + Line item @@ -247,10 +277,10 @@ N (position) An indexed position (distinctive among values of parent::*/*/@n). - #/definitions/NonNegativeIntegerDatatype NonNegativeIntegerDatatype + #/definitions/NonNegativeIntegerDatatype - object + #/definitions/MarkupLineDatatype @@ -262,6 +292,16 @@ A whole number value. integer + + A single line of Markdown content conformant to the Commonmark specification. + string + ^[^ +]+$ + + + A multiple lines of Markdown content conformant to the Commonmark specification. + string + An integer value that is equal to or greater than 0. diff --git a/src/testing/tinydata/current/tiny_schema.json b/src/testing/tinydata/current/tiny_schema.json index ebb5e69c..3f72fb10 100644 --- a/src/testing/tinydata/current/tiny_schema.json +++ b/src/testing/tinydata/current/tiny_schema.json @@ -33,7 +33,7 @@ "stuff" : { "title" : "Stuff", "description" : "Some amount of tiny stuff.", - "type" : "string" }, + "$ref" : "#/definitions/MarkupMultilineDatatype" }, "parts" : { "anyOf" : [ @@ -60,7 +60,7 @@ { "title" : "Title", "description" : "markup-line example.", "$id" : "#/definitions/tiny-tiny:title", - "type" : "string" }, + "$ref" : "#/definitions/MarkupLineDatatype" }, "tiny-tiny:term" : { "title" : "Term", "description" : "Simple string value example.", @@ -81,7 +81,7 @@ { "title" : "Note", "description" : "Wrapped markup-multiline example.", "$id" : "#/definitions/tiny-tiny:note", - "type" : "string" }, + "$ref" : "#/definitions/MarkupMultilineDatatype" }, "tiny-tiny:part" : { "title" : "Tiny part", "description" : "A bit of tiny data.", @@ -102,7 +102,7 @@ "stuff" : { "title" : "Stuff", "description" : "Some amount of tiny stuff.", - "type" : "string" }, + "$ref" : "#/definitions/MarkupMultilineDatatype" }, "parts" : { "anyOf" : [ @@ -131,38 +131,59 @@ "description" : "A list or grid of data points (items), or an entry (row or line item) in such a list or grid that contains such a list or grid.", "$id" : "#/definitions/tiny-tiny:sheet", "type" : "object", - "properties" : - { "key" : - { "title" : "Field key", - "description" : "Distinguishing a sheet or item (field) among siblings or neighbors.", - "$ref" : "#/definitions/TokenDatatype" }, - "class" : - { "title" : "Class", - "description" : "Class or classes.", - "$ref" : "#/definitions/StringDatatype" }, - "title" : - { "$ref" : "#/definitions/tiny-tiny:title" }, - "stuff" : - { "title" : "Stuff", - "description" : "Some amount of tiny stuff.", - "type" : "string" }, - "sheets" : - { "type" : "array", - "minItems" : 1, - "items" : - { "$ref" : "#/definitions/tiny-tiny:sheet" } }, - "items" : - { "anyOf" : - [ - { "$ref" : "#/definitions/tiny-tiny:item" }, - + "anyOf" : + [ + { "properties" : + { "key" : + { "title" : "Field key", + "description" : "Distinguishing a sheet or item (field) among siblings or neighbors.", + "$ref" : "#/definitions/TokenDatatype" }, + "class" : + { "title" : "Class", + "description" : "Class or classes.", + "$ref" : "#/definitions/StringDatatype" }, + "title" : + { "$ref" : "#/definitions/tiny-tiny:title" }, + "stuff" : + { "title" : "Stuff", + "description" : "Some amount of tiny stuff.", + "$ref" : "#/definitions/MarkupMultilineDatatype" }, + "sheets" : { "type" : "array", "minItems" : 1, "items" : - { "$ref" : "#/definitions/tiny-tiny:item" } } ] }, - "note" : - { "$ref" : "#/definitions/tiny-tiny:note" } }, - "additionalProperties" : false }, + { "$ref" : "#/definitions/tiny-tiny:sheet" } }, + "note" : + { "$ref" : "#/definitions/tiny-tiny:note" } }, + "additionalProperties" : false }, + + { "properties" : + { "key" : + { "title" : "Field key", + "description" : "Distinguishing a sheet or item (field) among siblings or neighbors.", + "$ref" : "#/definitions/TokenDatatype" }, + "class" : + { "title" : "Class", + "description" : "Class or classes.", + "$ref" : "#/definitions/StringDatatype" }, + "title" : + { "$ref" : "#/definitions/tiny-tiny:title" }, + "stuff" : + { "title" : "Stuff", + "description" : "Some amount of tiny stuff.", + "$ref" : "#/definitions/MarkupMultilineDatatype" }, + "items" : + { "anyOf" : + [ + { "$ref" : "#/definitions/tiny-tiny:item" }, + + { "type" : "array", + "minItems" : 1, + "items" : + { "$ref" : "#/definitions/tiny-tiny:item" } } ] }, + "note" : + { "$ref" : "#/definitions/tiny-tiny:note" } }, + "additionalProperties" : false } ] }, "tiny-tiny:item" : { "title" : "Line item", "description" : "A value, potentially marked with @key or @class.", @@ -180,15 +201,22 @@ "n" : { "title" : "N (position)", "description" : "An indexed position (distinctive among values of parent::*/*/@n).", - "$ref" : "#/definitions/NonNegativeIntegerDatatype NonNegativeIntegerDatatype" }, + "$ref" : "#/definitions/NonNegativeIntegerDatatype" }, "RICHTEXT" : - { "type" : "object" } }, + { "$ref" : "#/definitions/MarkupLineDatatype" } }, "required" : [ "RICHTEXT" ], "additionalProperties" : false }, "IntegerDatatype" : { "description" : "A whole number value.", "type" : "integer" }, + "MarkupLineDatatype" : + { "description" : "A single line of Markdown content conformant to the Commonmark specification.", + "type" : "string", + "pattern" : "^[^\n]+$" }, + "MarkupMultilineDatatype" : + { "description" : "A multiple lines of Markdown content conformant to the Commonmark specification.", + "type" : "string" }, "NonNegativeIntegerDatatype" : { "description" : "An integer value that is equal to or greater than 0.", "allOf" : diff --git a/src/testing/tinydata/tiny_json-schema-corrected.xml b/src/testing/tinydata/tiny_json-schema-corrected.xml index 4545c5cf..7fc22741 100644 --- a/src/testing/tinydata/tiny_json-schema-corrected.xml +++ b/src/testing/tinydata/tiny_json-schema-corrected.xml @@ -1,5 +1,5 @@ + xmlns:nm="http://csrc.nist.gov/ns/metaschema"> http://json-schema.org/draft-07/schema# http://csrc.nist.gov/ns/metaschema-xslt/tinydata/0.0.2/tiny-schema.json Tiny Data Model: JSON Schema @@ -42,7 +42,7 @@ Stuff Some amount of tiny stuff. - string + #/definitions/MarkupMultilineDatatype @@ -83,7 +83,7 @@ Title markup-line example. #/definitions/tiny-tiny:title - string + #/definitions/MarkupLineDatatype Term @@ -110,7 +110,7 @@ Note Wrapped markup-multiline example. #/definitions/tiny-tiny:note - string + #/definitions/MarkupMultilineDatatype Tiny part @@ -138,7 +138,7 @@ Stuff Some amount of tiny stuff. - string + #/definitions/MarkupMultilineDatatype @@ -201,7 +201,7 @@ Stuff Some amount of tiny stuff. - string + #/definitions/MarkupMultilineDatatype array @@ -217,44 +217,44 @@ false - - - Field key - Distinguishing a sheet or item (field) among siblings or neighbors. - #/definitions/TokenDatatype - - - Class - Class or classes. - #/definitions/StringDatatype - - - #/definitions/tiny-tiny:title - - - Stuff - Some amount of tiny stuff. - string - - - - - #/definitions/tiny-tiny:item + + + Field key + Distinguishing a sheet or item (field) among siblings or neighbors. + #/definitions/TokenDatatype - - array - 1 - - #/definitions/tiny-tiny:item - + + Class + Class or classes. + #/definitions/StringDatatype - - - - #/definitions/tiny-tiny:note - - - false + + #/definitions/tiny-tiny:title + + + Stuff + Some amount of tiny stuff. + #/definitions/MarkupMultilineDatatype + + + + + #/definitions/tiny-tiny:item + + + array + 1 + + #/definitions/tiny-tiny:item + + + + + + #/definitions/tiny-tiny:note + + + false @@ -277,10 +277,10 @@ N (position) An indexed position (distinctive among values of parent::*/*/@n). - #/definitions/NonNegativeIntegerDatatype NonNegativeIntegerDatatype + #/definitions/NonNegativeIntegerDatatype - object + #/definitions/MarkupLineDatatype @@ -292,6 +292,16 @@ A whole number value. integer + + A single line of Markdown content conformant to the Commonmark specification. + string + ^[^ +]+$ + + + A multiple lines of Markdown content conformant to the Commonmark specification. + string + An integer value that is equal to or greater than 0. From 476837c8783ae8c29cf19698a61e4ca0798c38d9 Mon Sep 17 00:00:00 2001 From: Wendell Piez Date: Thu, 6 Jun 2024 11:52:56 -0400 Subject: [PATCH 15/19] Updating xslt3-functions repo to latest --- support/pattern-test.xsl | 23 +++++++++++++++++++++++ support/refresh-lib.sh | 34 ++++++++++++++++++++++++++++++++++ support/xslt3-functions | 2 +- 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 support/pattern-test.xsl create mode 100644 support/refresh-lib.sh diff --git a/support/pattern-test.xsl b/support/pattern-test.xsl new file mode 100644 index 00000000..d79ff1cd --- /dev/null +++ b/support/pattern-test.xsl @@ -0,0 +1,23 @@ + + + + + + + + + + C + g + I + + + + + + + + + + \ No newline at end of file diff --git a/support/refresh-lib.sh b/support/refresh-lib.sh new file mode 100644 index 00000000..4dc2b488 --- /dev/null +++ b/support/refresh-lib.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# This script attempts to download MorganaXProcIII + + +mkdir -p lib + +pushd lib + +morgana=MorganaXProc-IIIse-1.3.6 + +morgana_download="https://sourceforge.net/projects/morganaxproc-iiise/files/${morgana}/${morgana}.zip/download" + +if [ ! -f "${morgana}.zip" ]; then + echo "Downloading Morgana XProc III SE ..." + curl -L -o "${morgana}.zip" "${morgana_download}" + unzip -qo "${morgana}.zip" -x __MACOSX/** +fi + + +if [ ! -f MorganaXProc-IIIse-1.3.6/MorganaXProc-IIIse_lib/saxon-he-12.3.jar ]; then + echo "Downloading Saxon 12.3 ..." + curl -s -L -o SaxonHE12-3J.zip https://www.saxonica.com/download/SaxonHE12-3J.zip + unzip -q -o SaxonHE12-3J.zip "*.jar" + rm -f SaxonHE12-3J.zip saxon-he-test*.jar saxon-he-xqj*.jar lib/* + rmdir lib + mv -f saxon-he-12.3.jar MorganaXProc-IIIse-1.3.6/MorganaXProc-IIIse_lib + +fi + +# C:\Users\wap1\Documents\usnistgov\metaschema-xslt\support\lib\MorganaXProc-IIIse-1.3.6\MorganaXProc-IIIse_lib + +popd + diff --git a/support/xslt3-functions b/support/xslt3-functions index bc3f7a90..c528c506 160000 --- a/support/xslt3-functions +++ b/support/xslt3-functions @@ -1 +1 @@ -Subproject commit bc3f7a90707beeb685564461e404d0158037cb1a +Subproject commit c528c506a4ee3f87cd508795b3965def9bd49815 From 7a2d54bde942d43d8a0ef4829904a715dfa2ca6d Mon Sep 17 00:00:00 2001 From: Wendell Piez Date: Thu, 6 Jun 2024 12:18:49 -0400 Subject: [PATCH 16/19] Changing gha setting to pull submodules recursively --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ac6e0ee9..af6d4644 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/checkout@v3 with: - submodules: true + submodules: recursive fetch-depth: 0 - uses: actions/setup-java@v3 with: From 59b99dcdb581f32e0f410c6317b645b4049abaa7 Mon Sep 17 00:00:00 2001 From: Wendell Piez Date: Thu, 6 Jun 2024 12:48:39 -0400 Subject: [PATCH 17/19] Small changes to copy, mainly to refresh --- README.md | 4 +++- TESTING.md | 1 - .../choice-splitting.xspec | 22 +++++++++---------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index d8129dd6..566d47af 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,9 @@ Additionally, we care about, but do not prioritize: Formerly housed in the [Metaschema repository](https://github.com/usnistgov/metaschema), this code base traces the history of development of the Metaschema concept in the context of the OSCAL project. It was originally conceived as a demonstration and proof of concept, providing a bridge enabling JSON- and XML-based development in parallel over common problem sets and common data. Success in this effort led to a determination that multiple implementations of a platform-independent specification were needed, at which point this implementation was carved out into its own repository. -### Project sunset +### Maturity and project sunset + +Software in this repository remains 'experimental' in status until it can be demonstrated with public conformance testing, which in turn depends on the maturity of the Metaschema initiative. The NIST team has no long-term plan to maintain this project outside the context of the initiatives it supports, [OSCAL](https://pages.nist.gov/OSCAL) and [Metaschema](https://pages.nist.gov/metaschema), while we reserve the right to change and adapt to community needs in alignment with NIST's mission. A project goal is to enable the stabilization and socialization of the Metaschema technology, as evidenced by the use and support of *other* Metaschema implementations. diff --git a/TESTING.md b/TESTING.md index 2b2f7b0a..e165cbf2 100644 --- a/TESTING.md +++ b/TESTING.md @@ -40,7 +40,6 @@ Currently we are emulating and re-engineering some specific XSpec capabilities i These efforts are focused on producing and refining XSpec runtimes for various use cases and scenarios with specialized requirements faced by this project, such as arbitrary batching and iXML support. Tools we develop here are released under the same terms as Metaschema-XSLT (as open-source software). - ## Test-driven development Almost all testing in this repository falls into the category of either XSLT transformations, or runtimes that embed transformations. diff --git a/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/choice-splitting.xspec b/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/choice-splitting.xspec index c744927b..38c94ca5 100644 --- a/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/choice-splitting.xspec +++ b/src/schema-gen/JSON-schema/testing/tests/jsonschemagen-mapping-xspec/choice-splitting.xspec @@ -25,7 +25,7 @@ - + @@ -194,17 +194,17 @@ - - - - + - - + + + + + + - - - + + @@ -223,7 +223,7 @@ - + From 7d7e5155df76b09dbece325feefe19737f3dc6a7 Mon Sep 17 00:00:00 2001 From: Wendell Piez Date: Thu, 6 Jun 2024 12:57:21 -0400 Subject: [PATCH 18/19] Trying with quotes this time --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index af6d4644..8314335d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/checkout@v3 with: - submodules: recursive + submodules: "recursive" fetch-depth: 0 - uses: actions/setup-java@v3 with: From 89838bb4f6f11ff71a98446d1b631fd6857a94e7 Mon Sep 17 00:00:00 2001 From: Wendell Piez Date: Thu, 6 Jun 2024 13:19:31 -0400 Subject: [PATCH 19/19] Removing unwanted testing files --- src/testing/issue105/CHOICES-MAKE-JSON.xpl | 71 ------ src/testing/issue105/XSD-VALIDATE-CHOICES.xpl | 196 --------------- .../issue105/choices-invalid/colors03.xml | 19 -- .../issue105/choices-invalid/colors05.xml | 19 -- .../issue105/choices-invalid/colors06.xml | 17 -- .../issue105/choices-invalid/colors07.xml | 11 - .../issue105/choices-invalid/colors08.xml | 10 - src/testing/issue105/choices-json-validate.sh | 27 --- .../issue105/choices-valid/colors01.xml | 10 - .../issue105/choices-valid/colors02.xml | 16 -- .../issue105/choices-valid/colors04.xml | 28 --- src/testing/issue105/choices_metaschema.xml | 94 -------- .../issue105/choices_xml-converter.xsl | 17 -- .../current/choices_schema-proposed.json | 202 ---------------- .../issue105/current/choices_schema.json | 127 ---------- .../issue105/current/choices_schema.xsd | 223 ------------------ .../json-schema-crosscheck-choices.sh | 47 ---- .../jsonv7-validate/JSON-VALIDATE-CHOICES.xp3 | 67 ------ .../json-validation-screener.xsl | 39 --- .../json-validation-summarizer.xsl | 42 ---- .../jsonv7-validate/summary-plaintext.xsl | 26 -- .../issue105/refresh-choices-converters.sh | 73 ------ .../issue105/refresh-choices-schemas.sh | 70 ------ src/testing/issue105/run-xproc3.sh | 24 -- .../issue105/xsd-crosscheck-choices.sh | 45 ---- 25 files changed, 1520 deletions(-) delete mode 100644 src/testing/issue105/CHOICES-MAKE-JSON.xpl delete mode 100644 src/testing/issue105/XSD-VALIDATE-CHOICES.xpl delete mode 100644 src/testing/issue105/choices-invalid/colors03.xml delete mode 100644 src/testing/issue105/choices-invalid/colors05.xml delete mode 100644 src/testing/issue105/choices-invalid/colors06.xml delete mode 100644 src/testing/issue105/choices-invalid/colors07.xml delete mode 100644 src/testing/issue105/choices-invalid/colors08.xml delete mode 100644 src/testing/issue105/choices-json-validate.sh delete mode 100644 src/testing/issue105/choices-valid/colors01.xml delete mode 100644 src/testing/issue105/choices-valid/colors02.xml delete mode 100644 src/testing/issue105/choices-valid/colors04.xml delete mode 100644 src/testing/issue105/choices_metaschema.xml delete mode 100644 src/testing/issue105/choices_xml-converter.xsl delete mode 100644 src/testing/issue105/current/choices_schema-proposed.json delete mode 100644 src/testing/issue105/current/choices_schema.json delete mode 100644 src/testing/issue105/current/choices_schema.xsd delete mode 100644 src/testing/issue105/json-schema-crosscheck-choices.sh delete mode 100644 src/testing/issue105/jsonv7-validate/JSON-VALIDATE-CHOICES.xp3 delete mode 100644 src/testing/issue105/jsonv7-validate/json-validation-screener.xsl delete mode 100644 src/testing/issue105/jsonv7-validate/json-validation-summarizer.xsl delete mode 100644 src/testing/issue105/jsonv7-validate/summary-plaintext.xsl delete mode 100644 src/testing/issue105/refresh-choices-converters.sh delete mode 100644 src/testing/issue105/refresh-choices-schemas.sh delete mode 100644 src/testing/issue105/run-xproc3.sh delete mode 100644 src/testing/issue105/xsd-crosscheck-choices.sh diff --git a/src/testing/issue105/CHOICES-MAKE-JSON.xpl b/src/testing/issue105/CHOICES-MAKE-JSON.xpl deleted file mode 100644 index da0224b6..00000000 --- a/src/testing/issue105/CHOICES-MAKE-JSON.xpl +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/testing/issue105/XSD-VALIDATE-CHOICES.xpl b/src/testing/issue105/XSD-VALIDATE-CHOICES.xpl deleted file mode 100644 index 9372d03a..00000000 --- a/src/testing/issue105/XSD-VALIDATE-CHOICES.xpl +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Checking { count(*/*) }{ if (count(*/*) eq 1) then ' document' else ' documents' } against a 'choices' XSD ... - - - - ALL GOOD - confirming expected results from XSD validation - - - - - - VALIDATION ANOMALY: a document expected to be valid is found to be INVALID - - - - VALIDATION ANOMALY: a marked document ('<?EXPECT ERROR?>') is found to be VALID - - - - CONFIRMED (invalid) - - - - CONFIRMED (valid) - - - - - - - - - - - - - - - - - { (1 to 12) ! ':::::' } - - - - - - - - - - : { . } - - - - - - - \ No newline at end of file diff --git a/src/testing/issue105/choices-invalid/colors03.xml b/src/testing/issue105/choices-invalid/colors03.xml deleted file mode 100644 index 5089a445..00000000 --- a/src/testing/issue105/choices-invalid/colors03.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - Family of Choices - - - - - - - - Another family - - - - - - - - \ No newline at end of file diff --git a/src/testing/issue105/choices-invalid/colors05.xml b/src/testing/issue105/choices-invalid/colors05.xml deleted file mode 100644 index 5089a445..00000000 --- a/src/testing/issue105/choices-invalid/colors05.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - Family of Choices - - - - - - - - Another family - - - - - - - - \ No newline at end of file diff --git a/src/testing/issue105/choices-invalid/colors06.xml b/src/testing/issue105/choices-invalid/colors06.xml deleted file mode 100644 index e7bc9488..00000000 --- a/src/testing/issue105/choices-invalid/colors06.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - Family of Choices - - - - - - - - Another family - - - - - - \ No newline at end of file diff --git a/src/testing/issue105/choices-invalid/colors07.xml b/src/testing/issue105/choices-invalid/colors07.xml deleted file mode 100644 index 97204593..00000000 --- a/src/testing/issue105/choices-invalid/colors07.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - Family of Choices - - Another family - - - - - - \ No newline at end of file diff --git a/src/testing/issue105/choices-invalid/colors08.xml b/src/testing/issue105/choices-invalid/colors08.xml deleted file mode 100644 index 9af70386..00000000 --- a/src/testing/issue105/choices-invalid/colors08.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - Family of Choices - - Another family - - - - - \ No newline at end of file diff --git a/src/testing/issue105/choices-json-validate.sh b/src/testing/issue105/choices-json-validate.sh deleted file mode 100644 index 3061c473..00000000 --- a/src/testing/issue105/choices-json-validate.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# shellcheck source=../common/subcommand_common.bash - -source "$SCRIPT_DIR/../../common/subcommand_common.bash" - -usage() { - cat < - - Family of Choices - - - - - - - \ No newline at end of file diff --git a/src/testing/issue105/choices-valid/colors02.xml b/src/testing/issue105/choices-valid/colors02.xml deleted file mode 100644 index ce1c5dca..00000000 --- a/src/testing/issue105/choices-valid/colors02.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - Family of Choices - - - - - - - - Another family - - - - - \ No newline at end of file diff --git a/src/testing/issue105/choices-valid/colors04.xml b/src/testing/issue105/choices-valid/colors04.xml deleted file mode 100644 index eaef0855..00000000 --- a/src/testing/issue105/choices-valid/colors04.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - Families of Choices - - A - - - - - - B group - - - - - - C group - - - - - - D group - - - - - \ No newline at end of file diff --git a/src/testing/issue105/choices_metaschema.xml b/src/testing/issue105/choices_metaschema.xml deleted file mode 100644 index 8aaeb7b3..00000000 --- a/src/testing/issue105/choices_metaschema.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - Choices Model - 0.0.1 - choices - http://example.com/ns/choices - http://example.com/ns/choices - - - Choices - Colors and patterns. - CHOICES - - Vendor Identifier - An identifier for classifying a unique computer parts vendor. - - - - Color family - A name for your selection. - - - - - - - - - - - - Group - A grouping. - - - Color family - A name or identifying code for your selection. - - - - - - - - - - - - - - - Blue - A blue color. - - - - Aquamarine - Peace and tranquility. - - - Midnight - Calmly resting. - - - Lapis - In repose. - - - - - - - Red - A red color. - - - - Firetruck - Heading for an emergeny. - - - Flame - Hot as heck. - - - Rooster - Cock-a-doodle-doo. - - - - - - diff --git a/src/testing/issue105/choices_xml-converter.xsl b/src/testing/issue105/choices_xml-converter.xsl deleted file mode 100644 index 9ca5f05f..00000000 --- a/src/testing/issue105/choices_xml-converter.xsl +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - yes - - - - - - - diff --git a/src/testing/issue105/current/choices_schema-proposed.json b/src/testing/issue105/current/choices_schema-proposed.json deleted file mode 100644 index 5b1a99d8..00000000 --- a/src/testing/issue105/current/choices_schema-proposed.json +++ /dev/null @@ -1,202 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://example.com/ns/choices/0.0.1/choices-schema.json", - "$comment": "Choices Model: JSON Schema", - "type": "object", - "definitions": { - "json-schema-directive": { - "title": "Schema Directive", - "description": "A JSON Schema directive to bind a specific schema to its document instance.", - "$id": "#/definitions/json-schema-directive", - "$ref": "#/definitions/URIReferenceDatatype" - }, - "choices-choices:CHOICES": { - "title": "Choices", - "description": "Colors and patterns.", - "$id": "#/definitions/choices-choices:CHOICES", - "type": "object", - "properties": { - "id": { - "title": "Vendor Identifier", - "description": "An identifier for classifying a unique computer parts vendor.", - "$ref": "#/definitions/StringDatatype" - }, - "family": { - "title": "Color family", - "description": "A name for your selection.", - "$ref": "#/definitions/StringDatatype" - }, - "blue": {"$ref": "#/definitions/choices-choices:blue"}, - "red": {"$ref": "#/definitions/choices-choices:red"}, - "groups": { - "anyOf": [ - {"$ref": "#/definitions/choices-choices:group"}, - { - "type": "array", - "minItems": 1, - "items": {"$ref": "#/definitions/choices-choices:group"} - } - ] - } - }, - "required": ["family"], - "additionalProperties": false - }, - "choices-choices:group": { - "title": "Group", - "description": "A grouping.", - "$id": "#/definitions/choices-choices:group", - "type": "object", - "anyOf": [ - { - "properties": { - "family": { - "title": "Color family", - "description": "A name or identifying code for your selection.", - "$ref": "#/definitions/StringDatatype" - }, - "blue": {"$ref": "#/definitions/choices-choices:blue"}, - "subgroups": { - "anyOf": [ - {"$ref": "#/definitions/choices-choices:group"}, - { - "type": "array", - "minItems": 1, - "items": {"$ref": "#/definitions/choices-choices:group"} - } - ] - } - }, - "required": ["family"], - "additionalProperties": false - }, - { - "properties": { - "family": { - "title": "Color family", - "description": "A name or identifying code for your selection.", - "$ref": "#/definitions/StringDatatype" - }, - "red": {"$ref": "#/definitions/choices-choices:red"}, - "subgroups": { - "anyOf": [ - {"$ref": "#/definitions/choices-choices:group"}, - { - "type": "array", - "minItems": 1, - "items": {"$ref": "#/definitions/choices-choices:group"} - } - ] - } - }, - "required": ["family"], - "additionalProperties": false - } - ] - }, - "choices-choices:blue": { - "title": "Blue", - "description": "A blue color.", - "$id": "#/definitions/choices-choices:blue", - "type": "object", - "anyOf": [ - { - "properties": { - "aquamarine": { - "title": "Aquamarine", - "description": "Peace and tranquility.", - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false, - "minProperties": 1 - }, - { - "properties": { - "midnight": { - "title": "Midnight", - "description": "Calmly resting.", - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false, - "minProperties": 1 - }, - { - "properties": { - "lapis": { - "title": "Lapis", - "description": "In repose.", - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false, - "minProperties": 1 - } - ] - }, - "choices-choices:red": { - "title": "Red", - "description": "A red color.", - "$id": "#/definitions/choices-choices:red", - "type": "object", - "anyOf": [ - { - "properties": { - "firetruck": { - "title": "Firetruck", - "description": "Heading for an emergeny.", - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false, - "minProperties": 1 - }, - { - "properties": { - "flame": { - "title": "Flame", - "description": "Hot as heck.", - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false, - "minProperties": 1 - }, - { - "properties": { - "rooster": { - "title": "Rooster", - "description": "Cock-a-doodle-doo.", - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false, - "minProperties": 1 - } - ] - }, - "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)?$" - }, - "URIReferenceDatatype": { - "description": "A URI Reference, either a URI or a relative-reference, formatted according to section 4.1 of RFC3986.", - "type": "string", - "format": "uri-reference" - } - }, - "properties": { - "$schema": {"$ref": "#/definitions/json-schema-directive"}, - "CHOICES": {"$ref": "#/definitions/choices-choices:CHOICES"} - }, - "required": ["CHOICES"], - "additionalProperties": false -} \ No newline at end of file diff --git a/src/testing/issue105/current/choices_schema.json b/src/testing/issue105/current/choices_schema.json deleted file mode 100644 index a1367106..00000000 --- a/src/testing/issue105/current/choices_schema.json +++ /dev/null @@ -1,127 +0,0 @@ - - { "$schema" : "http://json-schema.org/draft-07/schema#", - "$id" : "http://example.com/ns/choices/0.0.1/choices-schema.json", - "$comment" : "Choices Model: JSON Schema", - "type" : "object", - "definitions" : - { "json-schema-directive" : - { "title" : "Schema Directive", - "description" : "A JSON Schema directive to bind a specific schema to its document instance.", - "$id" : "#/definitions/json-schema-directive", - "$ref" : "#/definitions/URIReferenceDatatype" }, - "choices-choices:CHOICES" : - { "title" : "Choices", - "description" : "Colors and patterns.", - "$id" : "#/definitions/choices-choices:CHOICES", - "type" : "object", - "properties" : - { "id" : - { "title" : "Vendor Identifier", - "description" : "An identifier for classifying a unique computer parts vendor.", - "$ref" : "#/definitions/StringDatatype" }, - "family" : - { "title" : "Color family", - "description" : "A name for your selection.", - "$ref" : "#/definitions/StringDatatype" }, - "blue" : - { "$ref" : "#/definitions/choices-choices:blue" }, - "red" : - { "$ref" : "#/definitions/choices-choices:red" }, - "groups" : - { "anyOf" : - [ - { "$ref" : "#/definitions/choices-choices:group" }, - - { "type" : "array", - "minItems" : 1, - "items" : - { "$ref" : "#/definitions/choices-choices:group" } } ] } }, - "required" : - [ "family" ], - "additionalProperties" : false }, - "choices-choices:group" : - { "title" : "Group", - "description" : "A grouping.", - "$id" : "#/definitions/choices-choices:group", - "type" : "object", - "properties" : - { "family" : - { "title" : "Color family", - "description" : "A name or identifying code for your selection.", - "$ref" : "#/definitions/StringDatatype" }, - "blue" : - { "$ref" : "#/definitions/choices-choices:blue" }, - "red" : - { "$ref" : "#/definitions/choices-choices:red" }, - "subgroups" : - { "anyOf" : - [ - { "$ref" : "#/definitions/choices-choices:group" }, - - { "type" : "array", - "minItems" : 1, - "items" : - { "$ref" : "#/definitions/choices-choices:group" } } ] } }, - "required" : - [ "family" ], - "additionalProperties" : false }, - "choices-choices:blue" : - { "title" : "Blue", - "description" : "A blue color.", - "$id" : "#/definitions/choices-choices:blue", - "type" : "object", - "properties" : - { "aquamarine" : - { "title" : "Aquamarine", - "description" : "Peace and tranquility.", - "type" : "object", - "additionalProperties" : false }, - "midnight" : - { "title" : "Midnight", - "description" : "Calmly resting.", - "type" : "object", - "additionalProperties" : false }, - "lapis" : - { "title" : "Lapis", - "description" : "In repose.", - "type" : "object", - "additionalProperties" : false } }, - "additionalProperties" : false }, - "choices-choices:red" : - { "title" : "Red", - "description" : "A red color.", - "$id" : "#/definitions/choices-choices:red", - "type" : "object", - "properties" : - { "firetruck" : - { "title" : "Firetruck", - "description" : "Heading for an emergeny.", - "type" : "object", - "additionalProperties" : false }, - "flame" : - { "title" : "Flame", - "description" : "Hot as heck.", - "type" : "object", - "additionalProperties" : false }, - "rooster" : - { "title" : "Rooster", - "description" : "Cock-a-doodle-doo.", - "type" : "object", - "additionalProperties" : false } }, - "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)?$" }, - "URIReferenceDatatype" : - { "description" : "A URI Reference, either a URI or a relative-reference, formatted according to section 4.1 of RFC3986.", - "type" : "string", - "format" : "uri-reference" } }, - "properties" : - { "$schema" : - { "$ref" : "#/definitions/json-schema-directive" }, - "CHOICES" : - { "$ref" : "#/definitions/choices-choices:CHOICES" } }, - "required" : - [ "CHOICES" ], - "additionalProperties" : false } \ No newline at end of file diff --git a/src/testing/issue105/current/choices_schema.xsd b/src/testing/issue105/current/choices_schema.xsd deleted file mode 100644 index 457e651d..00000000 --- a/src/testing/issue105/current/choices_schema.xsd +++ /dev/null @@ -1,223 +0,0 @@ - - - - Choices Model - 0.0.1 - choices - CHOICES - - - - - - - Choices - Colors and patterns. - - - Choices: Colors and patterns. - - - - - - - Color family - A name for your selection. - - - Color family: A name for your selection. - - - - - - - - - - - - Vendor Identifier - An identifier for classifying a unique computer parts vendor. - - - Vendor Identifier: An identifier for classifying a unique computer parts vendor. - - - - - - - Group - A grouping. - - - Group: A grouping. - - - - - - - Color family - A name or identifying code for your selection. - - - Color family: A name or identifying code for your selection. - - - - - - - - - - - - - - - Blue - A blue color. - - - Blue: A blue color. - - - - - - - - Aquamarine - Peace and tranquility. - - - Aquamarine: Peace and tranquility. - - - - - - - - Midnight - Calmly resting. - - - Midnight: Calmly resting. - - - - - - - - Lapis - In repose. - - - Lapis: In repose. - - - - - - - - - - Red - A red color. - - - Red: A red color. - - - - - - - - Firetruck - Heading for an emergeny. - - - Firetruck: Heading for an emergeny. - - - - - - - - Flame - Hot as heck. - - - Flame: Hot as heck. - - - - - - - - Rooster - Cock-a-doodle-doo. - - - Rooster: Cock-a-doodle-doo. - - - - - - - - - A non-empty string of Unicode characters with leading and trailing whitespace - disallowed. Whitespace is: U+9, U+10, U+32 or [ \n\t]+ - - - - The 'string' datatype restricts the XSD type by prohibiting leading - and trailing whitespace, and something (not only whitespace) is required. - - - - - This pattern ensures that leading and trailing whitespace is - disallowed. This helps to even the user experience between implementations - related to whitespace. - - - - - diff --git a/src/testing/issue105/json-schema-crosscheck-choices.sh b/src/testing/issue105/json-schema-crosscheck-choices.sh deleted file mode 100644 index 1528bd4e..00000000 --- a/src/testing/issue105/json-schema-crosscheck-choices.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# shellcheck source=../common/subcommand_common.bash - -# source "$SCRIPT_DIR/../common/subcommand_common.bash" - -# XProc produces Inspector XSLT with a fail-safe check by compiling and running it -XPROC_FILE="${SCRIPT_DIR}/XSD-VALIDATE-OSCAL-SAMPLES.xpl" - -usage() { - cat < - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/testing/issue105/jsonv7-validate/json-validation-screener.xsl b/src/testing/issue105/jsonv7-validate/json-validation-screener.xsl deleted file mode 100644 index 0f3ebb6e..00000000 --- a/src/testing/issue105/jsonv7-validate/json-validation-screener.xsl +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/testing/issue105/jsonv7-validate/json-validation-summarizer.xsl b/src/testing/issue105/jsonv7-validate/json-validation-summarizer.xsl deleted file mode 100644 index 581ba287..00000000 --- a/src/testing/issue105/jsonv7-validate/json-validation-summarizer.xsl +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - Checking { count(*/*) }{ if (count(*/*) eq 1) then ' document' else ' documents' } against a 'choices' JSON Schema ... - - - - ALL GOOD - confirming expected results from JSON Schema validation - - - - - - VALIDATION ANOMALY: a document collected as 'valid' is found to be INVALID - - - - VALIDATION ANOMALY: a document collected as 'invalid' is found to be VALID - - - - CONFIRMED (invalid) - - - - CONFIRMED (valid) - - - \ No newline at end of file diff --git a/src/testing/issue105/jsonv7-validate/summary-plaintext.xsl b/src/testing/issue105/jsonv7-validate/summary-plaintext.xsl deleted file mode 100644 index 21921469..00000000 --- a/src/testing/issue105/jsonv7-validate/summary-plaintext.xsl +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - { (1 to 12) ! ':::::' } - - - - - - - - - : { . } - - \ No newline at end of file diff --git a/src/testing/issue105/refresh-choices-converters.sh b/src/testing/issue105/refresh-choices-converters.sh deleted file mode 100644 index d3c5d45d..00000000 --- a/src/testing/issue105/refresh-choices-converters.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env bash - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# shellcheck source=../common/subcommand_common.bash - -source "$SCRIPT_DIR/../../common/subcommand_common.bash" - -usage() { - cat <&2 - rm -f "$XJ_CONVERTER" -fi - -if [ -e "$JX_CONVERTER" ]; then - echo "Overwriting prior $JX_CONVERTER..." >&2 - rm -f "$JX_CONVERTER" -fi - -invoke_calabash "${CALABASH_ARGS}" - -if [ -e "$XJ_CONVERTER" ] && [ -e "$JX_CONVERTER" ]; then - echo "Wrote fresh XML/JSON conversion XSLTs into ${OUTPUT_DIR}" >&2 -fi - -fi diff --git a/src/testing/issue105/refresh-choices-schemas.sh b/src/testing/issue105/refresh-choices-schemas.sh deleted file mode 100644 index 1136f426..00000000 --- a/src/testing/issue105/refresh-choices-schemas.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env bash - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# shellcheck source=../common/subcommand_common.bash - -source "$SCRIPT_DIR/../../common/subcommand_common.bash" - -usage() { - cat <&2 - rm -f "$XSD_FILE" -fi - -if [ -e "$JSONSCHEMA_FILE" ]; then - echo "Overwriting prior $JSONSCHEMA_FILE..." >&2 - rm -f "$JSONSCHEMA_FILE" -fi - -invoke_calabash "${CALABASH_ARGS}" - -if [ -e "$XSD_FILE" ] && [ -e "$JSONSCHEMA_FILE" ]; then - echo "Wrote XSD to $XSD_FILE" >&2 - echo "Wrote JSON schema to $JSONSCHEMA_FILE" >&2 -fi - -fi diff --git a/src/testing/issue105/run-xproc3.sh b/src/testing/issue105/run-xproc3.sh deleted file mode 100644 index f2e48673..00000000 --- a/src/testing/issue105/run-xproc3.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# shellcheck source=../common/subcommand_common.bash - -source "$SCRIPT_DIR/../../common/subcommand_common.bash" - -usage() { - cat <