Skip to content

Commit

Permalink
Added test case
Browse files Browse the repository at this point in the history
  • Loading branch information
HeikoTheissen committed Nov 27, 2024
1 parent ec2358c commit cbfb3a4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
11 changes: 8 additions & 3 deletions tools/V4-CSDL-to-OpenAPI.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -1492,9 +1492,12 @@
<xsl:variable name="qualifiedName" select="concat($structuredType/../@Namespace,'.',$structuredType/@Name)" />
<xsl:variable name="aliasQualifiedName" select="concat($structuredType/../@Alias,'.',$structuredType/@Name)" />

<xsl:variable name="computed" select="$structuredType/edm:Property[edm:Annotation[@Term=$coreComputed or @Term=$coreComputedAliased or @Term=$coreComputedDefaultValue or @Term=$coreComputedDefaultValueAliased]]/@Name" />
<xsl:variable name="computed" select="$structuredType/edm:Property[edm:Annotation[@Term=$coreComputed or @Term=$coreComputedAliased]]/@Name" />
<xsl:variable name="computed-ext" select="(key('externalPropertyAnnotations',$qualifiedName)|key('externalPropertyAnnotations',$aliasQualifiedName))
[edm:Annotation[@Term=$coreComputed or @Term=$coreComputedAliased or @Term=$coreComputedDefaultValue or @Term=$coreComputedDefaultValueAliased]]/@Target" />
[edm:Annotation[@Term=$coreComputed or @Term=$coreComputedAliased]]/@Target" />
<xsl:variable name="computeddefaultvalue" select="$structuredType/edm:Property[edm:Annotation[@Term=$coreComputedDefaultValue or @Term=$coreComputedDefaultValueAliased]]/@Name" />
<xsl:variable name="computeddefaultvalue-ext" select="(key('externalPropertyAnnotations',$qualifiedName)|key('externalPropertyAnnotations',$aliasQualifiedName))
[edm:Annotation[@Term=$coreComputedDefaultValue or @Term=$coreComputedDefaultValueAliased]]/@Target" />

<xsl:variable name="immutable" select="$structuredType/edm:Property[edm:Annotation[@Term=$coreImmutable or @Term=$coreImmutableAliased]]/@Name" />
<xsl:variable name="immutable-ext" select="(key('externalPropertyAnnotations',$qualifiedName)|key('externalPropertyAnnotations',$aliasQualifiedName))
Expand Down Expand Up @@ -1560,7 +1563,9 @@
<xsl:if test="$suffix='-create'">
<!-- non-computed key properties are required, as are properties marked with Common.FieldControl=Mandatory -->
<xsl:for-each select="$structuredType/edm:Property[
(@Name=../edm:Key/edm:PropertyRef/@Name and not(@Name=$read-only or @Name=$computed or concat($qualifiedName,'/',@Name) = $computed-ext or concat($aliasQualifiedName,'/',@Name) = $computed-ext))
(@Name=../edm:Key/edm:PropertyRef/@Name and not(@Name=$read-only
or @Name=$computed or concat($qualifiedName,'/',@Name) = $computed-ext or concat($aliasQualifiedName,'/',@Name) = $computed-ext
or @Name=$computeddefaultvalue or concat($qualifiedName,'/',@Name) = $computeddefaultvalue-ext or concat($aliasQualifiedName,'/',@Name) = $computeddefaultvalue-ext))
or concat($qualifiedName,'/',@Name)=$mandatory or concat($aliasQualifiedName,'/',@Name)=$mandatory]">
<xsl:if test="position()>1">
<xsl:text>,</xsl:text>
Expand Down
3 changes: 0 additions & 3 deletions tools/tests/csdl-16.1.openapi3.json
Original file line number Diff line number Diff line change
Expand Up @@ -2043,9 +2043,6 @@
]
}
},
"required": [
"ID"
],
"title": "Product (for create)"
},
"ODataDemo.Product-update": {
Expand Down
3 changes: 0 additions & 3 deletions tools/tests/csdl-16.1.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1796,9 +1796,6 @@
"$ref": "#/definitions/ODataDemo.Supplier-create"
}
},
"required": [
"ID"
],
"title": "Product (for create)"
},
"ODataDemo.Product-update": {
Expand Down
4 changes: 3 additions & 1 deletion tools/tests/csdl-16.1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="Edm.String" Nullable="false" />
<Property Name="ID" Type="Edm.String" Nullable="false">
<Annotation Term="Org.OData.Core.V1.ComputedDefaultValue" />
</Property>
<Property Name="Description" Type="Edm.String">
<Annotation Term="Core.IsLanguageDependent" />
</Property>
Expand Down

0 comments on commit cbfb3a4

Please sign in to comment.