Skip to content

Commit

Permalink
Abolish qname prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
HeikoTheissen committed Apr 18, 2024
1 parent fbc42c9 commit 545ecba
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
9 changes: 4 additions & 5 deletions tools/V4-CSDL-to-OpenAPI.xsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" xmlns:edm="http://docs.oasis-open.org/odata/ns/edm"
xmlns:qname="http://docs.oasis-open.org/odata/ns/edm/qname"
xmlns:p0="http://docs.oasis-open.org/odata/ns/edm/non-final-segments"
xmlns:p1="http://docs.oasis-open.org/odata/ns/edm/final-segment"
xmlns:p2="http://docs.oasis-open.org/odata/ns/edm/termcast-segment">
Expand Down Expand Up @@ -1535,10 +1534,10 @@
<xsl:when test="$suffix='-update'">
<!-- only updatable non-key properties -->
<xsl:for-each select="$structuredType/edm:Property[not(
@id=//edm:Annotation[@qname:Term='Org.OData.Core.V1.Immutable']/@target
and not(@id=//edm:Annotation[@qname:Term='Org.OData.Measures.V1.Unit'
or @qname:Term='Org.OData.Measures.V1.ISOCurrency']//@p1:*)
or @id=//edm:Annotation[@qname:Term='Org.OData.Core.V1.Computed']/@target
@id=//edm:Annotation[@p2:Term='Org.OData.Core.V1.Immutable']/@target
and not(@id=//edm:Annotation[@p2:Term='Org.OData.Measures.V1.Unit'
or @p2:Term='Org.OData.Measures.V1.ISOCurrency']//@p1:*)
or @id=//edm:Annotation[@p2:Term='Org.OData.Core.V1.Computed']/@target
or @Name=$read-only or @Name=../edm:Key/edm:PropertyRef/@Name)]">
<xsl:call-template name="property">
<xsl:with-param name="suffix" select="'-update'" />
Expand Down
20 changes: 17 additions & 3 deletions tools/resolve-paths.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"
xmlns:edm="http://docs.oasis-open.org/odata/ns/edm"
xmlns:qname="http://docs.oasis-open.org/odata/ns/edm/qname"
xmlns:p0="http://docs.oasis-open.org/odata/ns/edm/non-final-segments"
xmlns:p1="http://docs.oasis-open.org/odata/ns/edm/final-segment"
xmlns:p2="http://docs.oasis-open.org/odata/ns/edm/termcast-segment"
Expand Down Expand Up @@ -114,7 +113,7 @@
</xsl:call-template>
</xsl:variable>
<xsl:copy-of select="." />
<xsl:attribute name="qname:Term">
<xsl:attribute name="p2:Term">
<xsl:value-of
select="concat(//edmx:Include[@Alias=$namespace or @Namespace=$namespace]
/@Namespace,'.')" />
Expand Down Expand Up @@ -382,8 +381,23 @@
</xsl:if>
<xsl:choose>
<xsl:when test="starts-with($final-segment,'@')">
<xsl:variable name="term"
select="substring-after(substring-before(concat($final-segment,'/'),'/'),'@')" />
<xsl:variable name="namespace">
<xsl:call-template name="namespace">
<xsl:with-param name="qname" select="$term" />
</xsl:call-template>
</xsl:variable>
<xsl:attribute name="p2:{name()}">
<xsl:value-of select="$final-segment" />
<xsl:value-of
select="concat(//edmx:Include[@Alias=$namespace or @Namespace=$namespace]
/@Namespace,'.')" />
<xsl:call-template name="name">
<xsl:with-param name="qname" select="$term" />
</xsl:call-template>
<xsl:if test="contains($final-segment,'/')">
<xsl:value-of select="concat('/',$final-segment)" />
</xsl:if>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
Expand Down

0 comments on commit 545ecba

Please sign in to comment.