Skip to content

Commit

Permalink
Implement default values for flags and fields. (#220)
Browse files Browse the repository at this point in the history
During pairing on usnistgov/OSCAL#1160, we determined there will be a
lot of utility to have default values when enhancing the draft version
of the Rules Model. This PR implements that functionality in the Metaschema
core syntax defined in the XSD.

Co-authored-by: David Waltermire <[email protected]>
  • Loading branch information
aj-stein-nist and david-waltermire authored Jul 28, 2022
1 parent 6c15452 commit 4185764
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions schema/xml/metaschema.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
<xs:element name="remarks" type="RemarksType" minOccurs="0"/>
<xs:element name="example" type="ExampleType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="as-type" type="FieldDatatypesType" default="string"/>
<xs:attributeGroup ref="FieldValueAttributeGroup"/>
<xs:attribute name="collapsible" type="YesNoType" default="no"/>
<xs:attribute name="name" use="required" type="ModelNameType"/>
<xs:attribute name="scope" type="ScopeType" default="global"/>
Expand All @@ -286,8 +286,7 @@
<xs:element name="example" type="ExampleType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" use="required" type="ModelNameType"/>
<!-- datatype should default to 'string' -->
<xs:attribute name="as-type" type="SimpleDatatypesType" default="string"/>
<xs:attributeGroup ref="FlagValueAttributeGroup"/>
<xs:attribute name="scope" type="ScopeType" default="global"/>
<xs:attributeGroup ref="DeprecationAttributeGroup"/>
</xs:complexType>
Expand Down Expand Up @@ -318,7 +317,6 @@
<xs:attributeGroup ref="DeprecationAttributeGroup"/>
</xs:complexType>


<xs:complexType name="InlineFieldDefinitionType">
<xs:annotation>
<xs:documentation>In JSON, an object with a nominal string value (potentially with internal
Expand All @@ -339,7 +337,7 @@
<xs:element name="remarks" type="RemarksType" minOccurs="0"/>
<xs:element name="example" type="ExampleType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="as-type" type="FieldDatatypesType" default="string"/>
<xs:attributeGroup ref="FieldValueAttributeGroup"/>
<xs:attribute name="collapsible" type="YesNoType" default="no"/>
<xs:attributeGroup ref="CardinalitySpecificationGroup"/>
<xs:attribute name="name" use="required" type="ModelNameType"/>
Expand All @@ -363,8 +361,7 @@
<xs:element name="example" type="ExampleType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" use="required" type="ModelNameType"/>
<!-- datatype should default to 'string' -->
<xs:attribute name="as-type" type="SimpleDatatypesType" default="string"/>
<xs:attributeGroup ref="FlagValueAttributeGroup"/>
<xs:attribute name="required" type="YesNoType" default="no"/>
<xs:attributeGroup ref="DeprecationAttributeGroup"/>
</xs:complexType>
Expand Down Expand Up @@ -507,6 +504,17 @@
</xs:attribute>
</xs:attributeGroup>

<xs:attributeGroup name="FieldValueAttributeGroup">
<xs:attribute name="as-type" type="FieldDatatypesType" default="string"/>
<xs:attribute name="default" type="StringDatatype" default="string"/>
</xs:attributeGroup>

<xs:attributeGroup name="FlagValueAttributeGroup">
<!-- datatype should default to 'string' -->
<xs:attribute name="as-type" type="SimpleDatatypesType" default="string"/>
<xs:attribute name="default" type="StringDatatype"/>
</xs:attributeGroup>

<xs:simpleType name="NaturalNumberOrUnboundedType">
<xs:union memberTypes="PositiveIntegerDatatype">
<xs:simpleType>
Expand Down

0 comments on commit 4185764

Please sign in to comment.