Skip to content

Instantly share code, notes, and snippets.

@aj-stein-nist
Created February 23, 2024 22:58
Show Gist options
  • Save aj-stein-nist/2b0b1076d6828cc97710ae2dd3e201c0 to your computer and use it in GitHub Desktop.
Save aj-stein-nist/2b0b1076d6828cc97710ae2dd3e201c0 to your computer and use it in GitHub Desktop.
Basic sample model in module without external constraints
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://raw.githubusercontent.com/usnistgov/metaschema/develop/schema/xml/metaschema.xsd" type="application/xml" schematypens="http://www.w3.org/2001/XMLSchema"?>
<METASCHEMA xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://csrc.nist.gov/ns/oscal/metaschema/1.0">
<schema-name>Let Experiment Model</schema-name>
<schema-version>0.1.0</schema-version>
<short-name>experiment</short-name>
<namespace>https://github.com/usnistgov/metaschema/issues/548</namespace>
<json-base-uri>https://github.com/usnistgov/metaschema/issues/548</json-base-uri>
<define-assembly name="package">
<root-name>outer-package</root-name>
<define-flag name="id" as-type="positiveInteger"/>
<model>
<define-field name="color" as-type="string" min-occurs="1" max-occurs="1"/>
<define-field name="height" as-type="positive-integer"/>
<define-field name="width" as-type="positive-integer"/>
<define-field name="depth" as-type="positive-integer" />
<assembly ref="package" max-occurs="unbounded">
<use-name>inner-package</use-name>
<group-as name="inner-packages" in-json="ARRAY"/>
</assembly>
</model>
<constraint>
<let var="all-approved-colors" expression="('red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet')"/>
<let var="inner-approved-colors" expression="('blue', 'indigo', 'violet')"/>
<expect target="color" test=".=('red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet')"/>
<expect target="inner-package/color" test=".=('blue', 'indigo', 'violet')"/>
</constraint>
</define-assembly>
</METASCHEMA>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment