Skip to content

Commit

Permalink
Adding new datatypes as aliases for old names #1186
Browse files Browse the repository at this point in the history
  • Loading branch information
wendellpiez committed Mar 23, 2022
1 parent 41d3f69 commit 26a66e9
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions toolchains/xslt-M4/schema-gen/oscal-datatypes.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,34 @@
</xs:appinfo>
</xs:annotation>

<xs:simpleType name="non-negative-integer">
<xs:annotation>
<xs:documentation>OSCAL reference for native type</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:nonNegativeInteger"/>
</xs:simpleType>

<xs:simpleType name="positive-integer">
<xs:annotation>
<xs:documentation>OSCAL reference for native type</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:positiveInteger"/>
</xs:simpleType>

<xs:simpleType name="date-time">
<xs:annotation>
<xs:documentation>OSCAL reference for native type</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:dateTime"/>
</xs:simpleType>

<xs:simpleType name="base64">
<xs:annotation>
<xs:documentation>OSCAL reference for native type</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:base64Binary"/>
</xs:simpleType>

<!-- The OSCAL 'string' datatype restricts the XSD type by prohibiting leading and trailing whitespace, and something
(not only whitespace) is required. -->
<xs:simpleType name="string">
Expand Down Expand Up @@ -78,6 +106,17 @@
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="date-time-with-timezone">
<!-- alias for dateTime-with-timezone -->
<xs:annotation>
<xs:documentation>The xs:dateTime with a required timezone.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:dateTime"><!-- restricts both lexical form and value space -->
<xs:pattern value=".+T.+(Z|[+-].+)"/>
<!-- JSON pattern does not support Leap Days <xs:pattern value="^((2000|2400|2800|(19|2[0-9](0[48]|[2468][048]|[13579][26])))-02-29)|(((19|2[0-9])[0-9]{2})-02-(0[1-9]|1[0-9]|2[0-8]))|(((19|2[0-9])[0-9]{2})-(0[13578]|10|12)-(0[1-9]|[12][0-9]|3[01]))|(((19|2[0-9])[0-9]{2})-(0[469]|11)-(0[1-9]|[12][0-9]|30))T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?(Z|[+-][0-9]{2}:[0-9]{2})$"/>-->
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="date-with-timezone">
<xs:annotation>
<xs:documentation>The xs:date with a required timezone.</xs:documentation>
Expand All @@ -98,6 +137,18 @@
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="email-address">
<!-- alias for email -->
<xs:annotation>
<xs:documentation>An email address</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:whiteSpace value="collapse"/>
<xs:pattern value=".+@.+"/><!-- XSD regexes implicitly anchored -->
</xs:restriction>
</xs:simpleType>


<xs:simpleType name="hostname">
<xs:annotation>
<xs:documentation>A host name</xs:documentation>
Expand Down Expand Up @@ -169,6 +220,19 @@
and they all restrict strings. Additionally their regexes are typically wrong for XSD, showing anchors ^ and $.
-->

<xs:simpleType name="Base64Datatype">
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve"/>
<!-- type: string -->
<xs:pattern value="^[0-9A-Fa-f]+$"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="BooleanDatatype">
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve"/>
<!-- type: boolean -->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="DateDatatype">
<xs:restriction base="xs:string">
<xs:whiteSpace value="preserve"/>
Expand Down

0 comments on commit 26a66e9

Please sign in to comment.