Skip to content

Commit

Permalink
Merge branch 'main' into feat/keep
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfhandl authored Dec 14, 2023
2 parents d97770e + 1d2c52a commit 82f5f7b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
17 changes: 17 additions & 0 deletions tools/V4-CSDL-to-OpenAPI.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@
<xsl:variable name="odmEntityNameAliased" select="concat($odmAlias,'.entityName')" />
<xsl:variable name="odmOid" select="concat($odmNamespace,'.oid')" />
<xsl:variable name="odmOidAliased" select="concat($odmAlias,'.oid')" />
<xsl:variable name="odmOidReference" select="concat($odmNamespace,'.oidReference')" />
<xsl:variable name="odmOidReferenceAliased" select="concat($odmAlias,'.oidReference')" />

<xsl:variable name="defaultResponse">
<xsl:text>"</xsl:text>
Expand Down Expand Up @@ -2226,6 +2228,9 @@
<xsl:call-template name="Common.SAPObjectNodeTypeReference">
<xsl:with-param name="annos" select="$annos" />
</xsl:call-template>
<xsl:call-template name="ODM.oidReference">
<xsl:with-param name="annos" select="$annos" />
</xsl:call-template>
</xsl:if>
</xsl:template>

Expand Down Expand Up @@ -2349,6 +2354,17 @@
</xsl:if>
</xsl:template>

<xsl:template name="ODM.oidReference">
<xsl:param name="annos" />
<xsl:variable name="anno" select="$annos/edm:Annotation[not(@Qualifier) and (@Term=$odmOidReference or @Term=$odmOidReferenceAliased)]" />
<xsl:if test="$anno/edm:Record">
<xsl:variable name="name" select="$anno/edm:Record/edm:PropertyValue[@Property='entityName']" />
<xsl:text>,"x-sap-odm-oid-reference-entity-name":"</xsl:text>
<xsl:value-of select="$name/@String|$name/edm:String" />
<xsl:text>"</xsl:text>
</xsl:if>
</xsl:template>

<xsl:template name="ref">
<xsl:param name="qualifier" />
<xsl:param name="name" />
Expand Down Expand Up @@ -3317,6 +3333,7 @@
<xsl:with-param name="node" select="$target" />
</xsl:call-template>
</xsl:variable>

<xsl:variable name="target-path-aliased">
<xsl:call-template name="annotation-target">
<xsl:with-param name="node" select="$target" />
Expand Down
3 changes: 2 additions & 1 deletion tools/tests/annotations.openapi3.json
Original file line number Diff line number Diff line change
Expand Up @@ -2856,7 +2856,8 @@
{
"$ref": "#/components/schemas/Supported.Annotations.TwoPartKey"
}
]
],
"x-sap-odm-oid-reference-entity-name": "odmTwo"
},
"AllMany": {
"type": "array",
Expand Down
3 changes: 2 additions & 1 deletion tools/tests/annotations.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2544,7 +2544,8 @@
]
},
"AllOne": {
"$ref": "#/definitions/Supported.Annotations.TwoPartKey"
"$ref": "#/definitions/Supported.Annotations.TwoPartKey",
"x-sap-odm-oid-reference-entity-name": "odmTwo"
},
"AllMany": {
"type": "array",
Expand Down
8 changes: 8 additions & 0 deletions tools/tests/annotations.xml
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,14 @@
<Annotation Term="ODM.oid" PropertyPath="Computed" />
</Annotations>

<Annotations Target="self.SinglePartKey/AllOne">
<Annotation Term="ODM.oidReference">
<Record Type="ODM.oidReferenceType">
<PropertyValue Property="entityName" String="odmTwo" />
</Record>
</Annotation>
</Annotations>

<Annotations Target="self.TwoPartKey/One">
<Annotation Term="Common.SAPObjectNodeTypeReference" String="SontOne" />
</Annotations>
Expand Down

0 comments on commit 82f5f7b

Please sign in to comment.