Skip to content

Commit

Permalink
ODATA-1552 (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
HeikoTheissen authored Nov 10, 2022
1 parent e17284f commit fb764fa
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 9 deletions.
3 changes: 3 additions & 0 deletions examples/counterexamples/test.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
test1.xml.line=9
test1.xml.col=14
test1.xml.rule=cvc-complex-type.2.4.a
test2.xml.line=11
test2.xml.col=82
test2.xml.rule=cvc-datatype-valid.1.2.3
annotationtarget1.xml.line=5
annotationtarget1.xml.col=71
annotationtarget1.xml.rule=cvc-pattern-valid
15 changes: 15 additions & 0 deletions examples/counterexamples/test2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" xmlns="http://docs.oasis-open.org/odata/ns/edm" Version="4.01">
<edmx:DataServices>
<Schema Namespace="org.example">
<EntityType Name="PrimitiveNavigation">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Edm.String" Nullable="false" />
<Property Name="FirstName" Type="Edm.String" Nullable="false" />
<NavigationProperty Name="LastName" Type="Edm.String" Nullable="false" />
</EntityType>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
56 changes: 47 additions & 9 deletions schemas/edm.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
</xs:sequence>
</xs:sequence>
<xs:attribute name="Name" type="edm:TSimpleIdentifier" use="required" />
<xs:attribute name="Type" type="edm:TTypeName" use="required" />
<xs:attribute name="Type" type="edm:TNavigationPropertyType" use="required" />
<xs:attribute name="Nullable" type="xs:boolean" use="optional" />
<xs:attribute name="Partner" type="edm:TPath" use="optional" />
<xs:attribute name="ContainsTarget" type="xs:boolean" use="optional" />
Expand Down Expand Up @@ -172,7 +172,7 @@
</xs:sequence>
<xs:attributeGroup ref="edm:TTypeAttributes" />
<xs:attribute name="IsFlags" type="xs:boolean" use="optional" />
<xs:attribute name="UnderlyingType" type="edm:TTypeName" use="optional" />
<xs:attribute name="UnderlyingType" type="edm:TPrimitiveEnumType" use="optional" />
</xs:complexType>
<xs:complexType name="TEnumTypeMember">
<xs:sequence>
Expand Down Expand Up @@ -557,7 +557,7 @@
</xs:complexType>
<xs:attributeGroup name="TEntitySetAttributes">
<xs:attribute name="Name" type="edm:TSimpleIdentifier" use="required" />
<xs:attribute name="EntityType" type="edm:TQualifiedName" use="required" />
<xs:attribute name="EntityType" type="edm:TNonEdmQualifiedName" use="required" />
<xs:attribute name="IncludeInServiceDocument" type="xs:boolean" use="optional" default="true" />
</xs:attributeGroup>
<xs:complexType name="TSingleton">
Expand All @@ -566,7 +566,7 @@
<xs:element ref="edm:Annotation" />
</xs:choice>
<xs:attribute name="Name" type="edm:TSimpleIdentifier" use="required" />
<xs:attribute name="Type" type="edm:TQualifiedName" use="required" />
<xs:attribute name="Type" type="edm:TNonEdmQualifiedName" use="required" />
<xs:attribute name="Nullable" type="xs:boolean" use="optional" />
</xs:complexType>
<xs:complexType name="TActionImport">
Expand Down Expand Up @@ -614,16 +614,41 @@
<xs:pattern value="[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}(\.[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}){1,}" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TNonEdmQualifiedName">
<xs:restriction base="edm:TQualifiedName">
<xs:pattern value="[^E].*" />
<xs:pattern value="E[^d].*" />
<xs:pattern value="Ed[^m].*" />
<xs:pattern value="Edm[^.].*" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TEnumMemberList">
<xs:list itemType="edm:TPath" />
</xs:simpleType>
<xs:simpleType name="TTypeName">
<xs:union memberTypes="edm:TPrimitiveType edm:TAbstractType edm:TQualifiedName">
<xs:union memberTypes="edm:TPrimitiveType edm:TAbstractType edm:TQualifiedName edm:TCollQualifiedName" />
</xs:simpleType>
<xs:simpleType name="TCollQualifiedName">
<xs:restriction base="xs:string">
<!-- The below pattern represents the allowed identifiers in the ECMAScript specification plus the '.' for namespace qualification
and the Collection() wrapper -->
<xs:pattern value="Collection\([\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}(\.[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}){1,}\)" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TNavigationPropertyType">
<xs:union memberTypes="edm:TNonEdmQualifiedName">
<xs:simpleType>
<xs:restriction base="xs:string">
<!-- The below pattern represents the allowed identifiers in the ECMAScript specification plus the '.' for namespace qualification
and the Collection() wrapper -->
<xs:pattern value="Collection\([\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}(\.[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}){1,}\)" />
<xs:restriction base="edm:TQualifiedName">
<xs:pattern value="Edm\.EntityType" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="edm:TCollQualifiedName">
<xs:pattern value="Collection\([^E].*" />
<xs:pattern value="Collection\(E[^d].*" />
<xs:pattern value="Collection\(Ed[^m].*" />
<xs:pattern value="Collection\(Edm[^.].*" />
<xs:pattern value="Collection\(Edm\.EntityType\)" />
</xs:restriction>
</xs:simpleType>
</xs:union>
Expand Down Expand Up @@ -699,6 +724,19 @@
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:simpleType name="TPrimitiveEnumType">
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Edm.Byte" />
<xs:enumeration value="Edm.Int16" />
<xs:enumeration value="Edm.Int32" />
<xs:enumeration value="Edm.Int64" />
<xs:enumeration value="Edm.SByte" />
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:simpleType name="TPrimitiveType">
<xs:union>
<xs:simpleType>
Expand Down

0 comments on commit fb764fa

Please sign in to comment.