-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for data types based on what can be supported in XML and JSON schema #436
Comments
Managing "simple-markdown" and "complex-markdown" (we need better names since the XML side won't have Markdown) will allow us to document the features supporting prose in the context not of a modeling construct (which perhaps confusingly is shared by all the models), but of datatypes. This bears on #357. |
Changed "markdown" to "markup". |
Per today's meeting, consider adding numeric types to this list. I am aware of the need for integers and percentages within FedRAMP content. To be complete, we may want also consider decimal as well. |
Noting some specifications still incomplete -- tbd define lexical constraints (validable in XSD) for:
|
… metaschema update XSLT - will break the build for now
Support for datatypes has now been added to both XSD and JSON Schema, but some alignment still remains. For example, the JSON Schema date type does not appear to permit a time zone, so requiring the time zone (as we have it in the current spec) won't work in JSON. The best way to flush out and reconcile these discrepancies is with unit testing for each of the defined types in both XSD and JSON validation. Let's make a new Issue for this? The unit tests could demonstrate coverage as well as show go/no-go testing for values expected to conform. |
Pending:
Otherwise this Issue is ready for review. The feature set continues to be tested along with other features, and appears to be working as intended. |
… metaschema update XSLT - will break the build for now
… metaschema update XSLT - will break the build for now
… metaschema update XSLT - will break the build for now
* Supporting enumerated value lists on flags in XSD and JSON Schema #437 * Metaschema improvements and remodeling flags support (local definitions; moving w/in the model; valid values) * More Metaschema syntax remodeling: now using max-occurs and min-occurs for cardinality indicators #441 * Updating schemas to current model (transitional); updated docs in resulting XSD per #448; some updates to markdown documentation * Small updates to authoring CSS. * Added design notes on JSON schema bindings. * Including an initial set of unit tests for group-by, some data types, etc. * Updated to new design (#436): Metaschema schema, Schematron, metaschema update XSLT - will break the build for now * Work on datatyping #436 including support in XML and JSON Schema * Addressed #451: parameter insertion syntax in Markdown * Schema documentation improvements #423 #424 #428 * Addressed feature request #438 * Improving handling of JSON 'key' and 'value-key' settings in docs #428 * Now producing XML and JSON model maps from metaschemas. * Now escaping {{ for Jekyll * Updated component metaschema based on design notes * Fixed schematron assertions to properly work with @ref. * Refactoring of component and SSP metachema. * Fixed website side navigation. Added component and SSP metaschema to site generation process. * Addressed comments in issue #445 * Added site content generation to runall.sh * Started documenting model changes in release notes. More work is still needed to complete this.
* Supporting enumerated value lists on flags in XSD and JSON Schema usnistgov#437 * Metaschema improvements and remodeling flags support (local definitions; moving w/in the model; valid values) * More Metaschema syntax remodeling: now using max-occurs and min-occurs for cardinality indicators usnistgov#441 * Updating schemas to current model (transitional); updated docs in resulting XSD per usnistgov#448; some updates to markdown documentation * Small updates to authoring CSS. * Added design notes on JSON schema bindings. * Including an initial set of unit tests for group-by, some data types, etc. * Updated to new design (usnistgov#436): Metaschema schema, Schematron, metaschema update XSLT - will break the build for now * Work on datatyping usnistgov#436 including support in XML and JSON Schema * Addressed usnistgov#451: parameter insertion syntax in Markdown * Schema documentation improvements usnistgov#423 usnistgov#424 usnistgov#428 * Addressed feature request usnistgov#438 * Improving handling of JSON 'key' and 'value-key' settings in docs usnistgov#428 * Now producing XML and JSON model maps from metaschemas. * Now escaping {{ for Jekyll * Updated component metaschema based on design notes * Fixed schematron assertions to properly work with @ref. * Refactoring of component and SSP metachema. * Fixed website side navigation. Added component and SSP metaschema to site generation process. * Addressed comments in issue usnistgov#445 * Added site content generation to runall.sh * Started documenting model changes in release notes. More work is still needed to complete this.
This has been completed in PR #464. |
* Supporting enumerated value lists on flags in XSD and JSON Schema usnistgov#437 * Metaschema improvements and remodeling flags support (local definitions; moving w/in the model; valid values) * More Metaschema syntax remodeling: now using max-occurs and min-occurs for cardinality indicators usnistgov#441 * Updating schemas to current model (transitional); updated docs in resulting XSD per usnistgov#448; some updates to markdown documentation * Small updates to authoring CSS. * Added design notes on JSON schema bindings. * Including an initial set of unit tests for group-by, some data types, etc. * Updated to new design (usnistgov#436): Metaschema schema, Schematron, metaschema update XSLT - will break the build for now * Work on datatyping usnistgov#436 including support in XML and JSON Schema * Addressed usnistgov#451: parameter insertion syntax in Markdown * Schema documentation improvements usnistgov#423 usnistgov#424 usnistgov#428 * Addressed feature request usnistgov#438 * Improving handling of JSON 'key' and 'value-key' settings in docs usnistgov#428 * Now producing XML and JSON model maps from metaschemas. * Now escaping {{ for Jekyll * Updated component metaschema based on design notes * Fixed schematron assertions to properly work with @ref. * Refactoring of component and SSP metachema. * Fixed website side navigation. Added component and SSP metaschema to site generation process. * Addressed comments in issue usnistgov#445 * Added site content generation to runall.sh * Started documenting model changes in release notes. More work is still needed to complete this.
* Supporting enumerated value lists on flags in XSD and JSON Schema usnistgov#437 * Metaschema improvements and remodeling flags support (local definitions; moving w/in the model; valid values) * More Metaschema syntax remodeling: now using max-occurs and min-occurs for cardinality indicators usnistgov#441 * Updating schemas to current model (transitional); updated docs in resulting XSD per usnistgov#448; some updates to markdown documentation * Small updates to authoring CSS. * Added design notes on JSON schema bindings. * Including an initial set of unit tests for group-by, some data types, etc. * Updated to new design (usnistgov#436): Metaschema schema, Schematron, metaschema update XSLT - will break the build for now * Work on datatyping usnistgov#436 including support in XML and JSON Schema * Addressed usnistgov#451: parameter insertion syntax in Markdown * Schema documentation improvements usnistgov#423 usnistgov#424 usnistgov#428 * Addressed feature request usnistgov#438 * Improving handling of JSON 'key' and 'value-key' settings in docs usnistgov#428 * Now producing XML and JSON model maps from metaschemas. * Now escaping {{ for Jekyll * Updated component metaschema based on design notes * Fixed schematron assertions to properly work with @ref. * Refactoring of component and SSP metachema. * Fixed website side navigation. Added component and SSP metaschema to site generation process. * Addressed comments in issue usnistgov#445 * Added site content generation to runall.sh * Started documenting model changes in release notes. More work is still needed to complete this.
User Story:
As an OSCAL model developer, I need to be able to define strict data types for information elements within my models that translate to validation of these types in XML and JSON schema.
Goals:
There are three major goals for this issue:
First, it would be good to make definition of datatypes more uniform across the Metaschema constructs. Data types are defined inconsistently across various OSCAL Metaschema constructs. In
define-field
anddefine-flag
the @as attribute is used to define the data type. The value "mixed" is used to indicate that simple markup is allowed, which excludes the use of tables and lists. Ondefine-assembly
the<prose>
element is used to indicate that complex markup can be included, that allows the use of tables and lists.The following changes will allow data typing to be made more consistent:
A new attribute
@as-type
will be allowed ondefine-flag
,define-field
, andflag
(see Allow flags to be defined within a field or assembly #435), which will define the data type of the field or flag value. The attribute@as-type
is preferred over the current@as
since it is more human-readable.The
<prose>
element in the Metaschema can be replaced with use of<field named="prose" as-type="markup-multiline" @xml-unwrap="yes">
.The new attribute
@xml-unwrap
allows for the content model to be "unwrapped" in XML, if desired, by omitting the outer element based on the fieldname
. The default behavior is to wrap in XML if the@xml-unwrap
attribute is ommitted or set to the value@xml-unwrap="no"
.A side effect of this feature is that two adjacent Metaschema
fields
cannot have the@xml-unwrap="yes"
, since in XML a parser will not be able to differentiate where one field ends and the other starts. The metaschema-check.sch needs to be updated to raise an error when this check fails.Given the following Metaschema:
When
@xml-unwrap="no"
or no@xml-unwrap
attribute is provided the resulting XML content will look like this:When
@xml-unwrap="yes"
is provided the resulting XML content will look like this:Second, the following new datatypes need to be supported:
For HTML, this would be OSCAL XML mapped HTML minus the outer <p> tags, or OSCAL JSON mapped Markdown as single line (no newlines). Support for lists and tables is also excluded from both the HTML and Markdown forms. This is consistent with the current HTML/Markdown support in OSCAL in a
<field/>
.For HTML, this would be OSCAL XML mapped HTML with the outer <p> tags, or OSCAL JSON mapped Markdown as a multi-line string. This is consistent with the current HTML/Markdown support in OSCAL in a
<prose/>
.For XML, a pattern needs to be included that makes the timezone required. This will follow the format of:
Where
Z
is equivalent to+00:00
or-00:00
Suitable patterns need to be defined for email, hostname, ipv4, and ipv6
Suitable patterns need to be defined for a full URI, vs a fragment
A value that is base64 encoded in JSON can be specified as base64 as follows:
In JSON, a given format can be defined as follows:
Finally, the
markup-line
andmarkup-multiline
data types can only be used on adefine-field
. In XML theflag
content model are not compatible with HTML contents. Where HTML content is needed afield
needs to be used. For cased where<field unwrapped="yes"/>
use of themarkup-line
data type needs to be disallowed, as the content model ofmarkup-line
lacks a wrapping<p>
in XML. These constraints need to be implemented in the metaschema-check.sch.A way of looking at this is for a
field
:Dependencies:
This issue will address issue #323. This issue will also partially address issue #390, by providing for more data type validation.
Acceptance Criteria
The text was updated successfully, but these errors were encountered: