Skip to content

Commit db69e5a

Browse files
Merge pull request #316 from oasis-tcs/csdl2openapi/create-key
2 parents 861be30 + fa34567 commit db69e5a

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

tools/V4-CSDL-to-OpenAPI.xsl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@
9999
<xsl:variable name="coreAcceptableMediaTypesAliased" select="concat($coreAlias,'.AcceptableMediaTypes')" />
100100
<xsl:variable name="coreComputed" select="concat($coreNamespace,'.Computed')" />
101101
<xsl:variable name="coreComputedAliased" select="concat($coreAlias,'.Computed')" />
102+
<xsl:variable name="coreComputedDefaultValue" select="concat($coreNamespace,'.ComputedDefaultValue')" />
103+
<xsl:variable name="coreComputedDefaultValueAliased" select="concat($coreAlias,'.ComputedDefaultValue')" />
102104
<xsl:variable name="coreDefaultNamespace" select="concat($coreNamespace,'.DefaultNamespace')" />
103105
<xsl:variable name="coreDefaultNamespaceAliased" select="concat($coreAlias,'.DefaultNamespace')" />
104106
<xsl:variable name="coreDescription" select="concat($coreNamespace,'.Description')" />
@@ -1496,6 +1498,9 @@
14961498
<xsl:variable name="computed" select="$structuredType/edm:Property[edm:Annotation[@Term=$coreComputed or @Term=$coreComputedAliased]]/@Name" />
14971499
<xsl:variable name="computed-ext" select="(key('externalPropertyAnnotations',$qualifiedName)|key('externalPropertyAnnotations',$aliasQualifiedName))
14981500
[edm:Annotation[@Term=$coreComputed or @Term=$coreComputedAliased]]/@Target" />
1501+
<xsl:variable name="computeddefaultvalue" select="$structuredType/edm:Property[edm:Annotation[@Term=$coreComputedDefaultValue or @Term=$coreComputedDefaultValueAliased]]/@Name" />
1502+
<xsl:variable name="computeddefaultvalue-ext" select="(key('externalPropertyAnnotations',$qualifiedName)|key('externalPropertyAnnotations',$aliasQualifiedName))
1503+
[edm:Annotation[@Term=$coreComputedDefaultValue or @Term=$coreComputedDefaultValueAliased]]/@Target" />
14991504

15001505
<xsl:variable name="immutable" select="$structuredType/edm:Property[edm:Annotation[@Term=$coreImmutable or @Term=$coreImmutableAliased]]/@Name" />
15011506
<xsl:variable name="immutable-ext" select="(key('externalPropertyAnnotations',$qualifiedName)|key('externalPropertyAnnotations',$aliasQualifiedName))
@@ -1577,8 +1582,11 @@
15771582
and not(
15781583
@Name = $read-only
15791584
or @Name = $computed
1585+
or @Name = $computeddefaultvalue
15801586
or concat($qualifiedName, '/', @Name) = $computed-ext
15811587
or concat($aliasQualifiedName, '/', @Name) = $computed-ext
1588+
or concat($qualifiedName, '/', @Name) = $computeddefaultvalue-ext
1589+
or concat($aliasQualifiedName, '/', @Name) = $computeddefaultvalue-ext
15821590
)
15831591
)
15841592
or concat($qualifiedName, '/', @Name) = $mandatory

tools/tests/csdl-16.1.openapi3.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2194,9 +2194,6 @@
21942194
}
21952195
}
21962196
},
2197-
"required": [
2198-
"ID"
2199-
],
22002197
"title": "Supplier (for create)"
22012198
},
22022199
"ODataDemo.Supplier-update": {

tools/tests/csdl-16.1.swagger.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,9 +1961,6 @@
19611961
}
19621962
}
19631963
},
1964-
"required": [
1965-
"ID"
1966-
],
19671964
"title": "Supplier (for create)"
19681965
},
19691966
"ODataDemo.Supplier-update": {

tools/tests/csdl-16.1.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848
<Key>
4949
<PropertyRef Name="ID" />
5050
</Key>
51-
<Property Name="ID" Type="Edm.String" Nullable="false" />
51+
<Property Name="ID" Type="Edm.String" Nullable="false">
52+
<Annotation Term="Org.OData.Core.V1.ComputedDefaultValue" />
53+
</Property>
5254
<Property Name="Name" Type="Edm.String" />
5355
<Property Name="Address" Type="ODataDemo.Address" Nullable="false" />
5456
<Property Name="Concurrency" Type="Edm.Int32" Nullable="false" />

0 commit comments

Comments
 (0)