Skip to content
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

Completed work reflecting schema version in XSD and JSON schema (#57) #415

Merged
merged 2 commits into from
Jun 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
1 change: 1 addition & 0 deletions src/metaschema/oscal_metadata_metaschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
root="VALIDATION_root">

<schema-name>OSCAL Document Metadata Description</schema-name>
<schema-version>1.0-M1</schema-version>
<short-name>oscal-metadata</short-name>
<namespace>http://csrc.nist.gov/ns/oscal/metadata/1.0/</namespace>

Expand Down
1 change: 1 addition & 0 deletions src/metaschema/oscal_profile_metaschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
xmlns="http://csrc.nist.gov/ns/oscal/metaschema/1.0"
root="profile">
<schema-name>OSCAL Profile Metaschema</schema-name>
<schema-version>1.0-M1</schema-version>
<short-name>oscal-profile</short-name>
<namespace>http://csrc.nist.gov/ns/oscal/1.0</namespace>
<remarks>
Expand Down
1 change: 1 addition & 0 deletions src/metaschema/oscal_ssp_metaschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
root="system-security-plan">

<schema-name>OSCAL System Security Plan (SSP) Format</schema-name>
<schema-version>1.0-M1</schema-version>
<short-name>oscal-ssp</short-name>
<namespace>urn:OSCAL-SSP-metaschema</namespace>

Expand Down