Related Feature
Feature request: n/a
Description
The Annotation Modeler registers the DocumentFormattingEditProvider for annotation.xml.
When the document is formatted, it rewrites the text content of an edm:String that contains
an & entity: the text is split at the entity and padded with spaces.
For a literal that carries a URL this silently corrupts the annotation — the link generated at
runtime is broken, and nothing reports a problem at any point.
The standard XML mechanism to prevent this, xml:space="preserve", does work. However the same
extension then reports attribute-not-allowed-here on that attribute. xml: is reserved by the
XML specification and is permitted on any element, so this looks like a false positive: the
attribute validation appears to consider the EDMX schema only, with no notion of the reserved
namespace.
The two behaviours combine badly — the formatter corrupts the annotation, and the only
mechanism that stops it is flagged as an error.
Steps to Reproduce
-
In a Fiori Elements app (OData V4), add a UI.DataFieldWithUrl whose Url is an
odata.concat containing a literal with an entity reference:
<Record Type="UI.DataFieldWithUrl">
<PropertyValue Property="Value" Path="name" />
<PropertyValue Property="Url">
<Apply Function="odata.concat">
<String>https://www.example.com/search/?api=1&query=</String>
<Path>name</Path>
</Apply>
</PropertyValue>
</Record>
-
Format the document — e.g. save it with editor.formatOnSave enabled.
-
Look at the literal.
Expected results
The text content of an edm:String is preserved verbatim. It is data, not prose: any inserted
whitespace changes the value the annotation evaluates to.
xml:space="preserve" on an edm:String is accepted without a diagnostic.
Actual results
The literal is rewritten to:
<String>
https://www.example.com/search/?api=1 & query=
</String>
At runtime the URL becomes https://www.example.com/search/?api=1 & query=<value>. The query
parameter is therefore named query (with a leading space) and api has the value 1 , so
the target application receives neither parameter as intended. There is no warning anywhere —
the corruption is silent and only surfaces when a user clicks the link.
This is not driven by line length. It was first observed on a 104-character line; after
splitting the URL into two shorter literals to stay below the usual 100-character threshold, it
happened again on a 64-character line.
Adding xml:space="preserve" to the edm:String does stop the rewrite — verified over
repeated saves and a ui5 build, with UI5 parsing the annotation normally and the generated
URL correct. But the extension then reports:
'xml:space' attribute is not allowed here. [attribute-not-allowed-here]
There appears to be no way to suppress this: the extension contributes only
sap.ux.annotationModeler.enableTelemetry (deprecated) and
sap.ux.annotationModeler.semanticHighlighting.enabled.
Suggested fix
- Treat the content of
edm:String as opaque when formatting — at minimum, never insert
whitespace around an entity reference.
- Accept attributes in the reserved
xml: namespace (xml:space, xml:lang, xml:base)
on any element, as the XML specification allows.
Screenshots
n/a
Version/Components/Environment
sapse.sap-ux-annotation-modeler-extension 1.30.0 (SAP Fiori tools extension pack 1.30.0)
- VS Code on macOS 15
- UI5 1.150.0, OData V4, Fiori Elements List Report / Object Page
redhat.vscode-xml is not installed, so formatting is performed by the Annotation Modeler
itself and xml.format.* settings have no effect (VS Code reports those keys as unknown).
Related Feature
Feature request: n/a
Description
The Annotation Modeler registers the
DocumentFormattingEditProviderforannotation.xml.When the document is formatted, it rewrites the text content of an
edm:Stringthat containsan
&entity: the text is split at the entity and padded with spaces.For a literal that carries a URL this silently corrupts the annotation — the link generated at
runtime is broken, and nothing reports a problem at any point.
The standard XML mechanism to prevent this,
xml:space="preserve", does work. However the sameextension then reports
attribute-not-allowed-hereon that attribute.xml:is reserved by theXML specification and is permitted on any element, so this looks like a false positive: the
attribute validation appears to consider the EDMX schema only, with no notion of the reserved
namespace.
The two behaviours combine badly — the formatter corrupts the annotation, and the only
mechanism that stops it is flagged as an error.
Steps to Reproduce
In a Fiori Elements app (OData V4), add a
UI.DataFieldWithUrlwhoseUrlis anodata.concatcontaining a literal with an entity reference:Format the document — e.g. save it with
editor.formatOnSaveenabled.Look at the literal.
Expected results
The text content of an
edm:Stringis preserved verbatim. It is data, not prose: any insertedwhitespace changes the value the annotation evaluates to.
xml:space="preserve"on anedm:Stringis accepted without a diagnostic.Actual results
The literal is rewritten to:
At runtime the URL becomes
https://www.example.com/search/?api=1 & query=<value>. The queryparameter is therefore named
query(with a leading space) andapihas the value1, sothe target application receives neither parameter as intended. There is no warning anywhere —
the corruption is silent and only surfaces when a user clicks the link.
This is not driven by line length. It was first observed on a 104-character line; after
splitting the URL into two shorter literals to stay below the usual 100-character threshold, it
happened again on a 64-character line.
Adding
xml:space="preserve"to theedm:Stringdoes stop the rewrite — verified overrepeated saves and a
ui5 build, with UI5 parsing the annotation normally and the generatedURL correct. But the extension then reports:
There appears to be no way to suppress this: the extension contributes only
sap.ux.annotationModeler.enableTelemetry(deprecated) andsap.ux.annotationModeler.semanticHighlighting.enabled.Suggested fix
edm:Stringas opaque when formatting — at minimum, never insertwhitespace around an entity reference.
xml:namespace (xml:space,xml:lang,xml:base)on any element, as the XML specification allows.
Screenshots
n/a
Version/Components/Environment
sapse.sap-ux-annotation-modeler-extension1.30.0 (SAP Fiori tools extension pack 1.30.0)redhat.vscode-xmlis not installed, so formatting is performed by the Annotation Modeleritself and
xml.format.*settings have no effect (VS Code reports those keys as unknown).