Skip to content

Commit

Permalink
Completed work reflecting schema version in XSD and JSON schema (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
wendellpiez committed Jun 10, 2019
1 parent 7e0effe commit 087bdef
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build/metaschema/json/json-schema-metamap.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<xsl:template match="/METASCHEMA" expand-text="true">
<map>
<string key="$schema">http://json-schema.org/draft-07/schema#</string>
<string key="$id">http://csrc.nist.gov/ns/oscal/1.0/{ short-name }-schema.json</string>
<string key="$id">http://csrc.nist.gov/ns/oscal/{ $composed-metaschema/METASCHEMA/schema-version }/{ short-name }-schema.json</string>
<xsl:for-each select="schema-name">
<string key="$comment">{ . }: JSON Schema</string>
</xsl:for-each>
Expand Down
2 changes: 1 addition & 1 deletion build/metaschema/lib/metaschema-check.sch
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
<sch:pattern>
<sch:rule context="/m:METASCHEMA">
<sch:assert test="@root=*/@name">METASCHEMA/@root should be one of <sch:value-of select="string-join(*/@name,', ')"/></sch:assert>
<sch:assert test="exists(m:schema-version)" role="warning">Metaschema schema version must be set for any top-level metaschema</sch:assert>
</sch:rule>
<sch:rule context="/m:METASCHEMA/m:title"/>
<sch:rule context="/m:METASCHEMA/m:import">
Expand All @@ -122,7 +123,6 @@
<!--<sch:report test="empty($imported-schemas/m:METASCHEMA)">Don't see imported schemas</sch:report>-->
</sch:rule>

<sch:rule context="/m:METASCHEMA/*[matches(@acquire-from,'\S')]"/>
<sch:rule context="m:define-assembly">
<sch:assert role="warning" test="@name = ($composed-metaschema//m:assembly/@named | $composed-metaschema//m:assemblies/@named | /m:METASCHEMA/@root)">Definition for assembly '<sch:value-of select="@name"/>' is not used.</sch:assert>
</sch:rule>
Expand Down
4 changes: 4 additions & 0 deletions build/metaschema/lib/metaschema.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

<xs:sequence>
<xs:element ref="m:schema-name"/>
<xs:element ref="m:schema-version" minOccurs="0"/>
<xs:element ref="m:short-name"/>
<xs:element ref="m:namespace" minOccurs="1"/>
<xs:element ref="m:remarks" minOccurs="0"/>
Expand Down Expand Up @@ -134,6 +135,9 @@
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="schema-version">
<xs:complexType mixed="true"/>
</xs:element>
<xs:element name="short-name">
<xs:complexType mixed="true">
<xs:choice maxOccurs="unbounded">
Expand Down
4 changes: 3 additions & 1 deletion build/metaschema/xml/produce-xsd.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@

<xsl:template match="/METASCHEMA">
<xs:schema elementFormDefault="qualified" targetNamespace="{ $target-namespace }">

<xsl:for-each select="$composed-metaschema/METASCHEMA/schema-version">
<xsl:attribute name="version" select="normalize-space(.)"/>
</xsl:for-each>
<xsl:apply-templates select="$composed-metaschema/METASCHEMA/*"/>
<!--<xsl:apply-templates select="*"/>-->

Expand Down
1 change: 1 addition & 0 deletions src/metaschema/oscal_catalog_metaschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
root="catalog">

<schema-name>OSCAL Control Catalog Format</schema-name>
<schema-version>1.0-M1</schema-version>
<short-name>oscal-catalog</short-name>
<namespace>http://csrc.nist.gov/ns/oscal/1.0</namespace>

Expand Down

0 comments on commit 087bdef

Please sign in to comment.