You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[@typespec/xml] Validate XML element, attribute, and prefix names against W3C XML Name grammar #12663
@Xml.name (in @typespec/xml) and @encodedName("application/xml", ...) currently accept arbitrary strings without checking whether the value is a valid XML Name per the W3C XML 1.0 specification (Name production):
Similarly, @Xml.ns(namespace, prefix) validates that namespace is a valid URI (ns-not-uri), but does not validate that a string prefix is a valid XML NCName.
Today this compiles with zero diagnostics even though none of "part\"number", "attr`tick", "123-leading-digit", or "bad prefix" can form well-formed XML markup on the wire, and invalid names propagate downstream into emitters (see Azure/typespec-azure#5936 for background).
Proposal
Add validation in @typespec/xml (and/or @encodedName for XML media types such as application/xml and text/xml) to check XML element names, attribute names, and namespace prefixes against the W3C XML Name / NCName productions and report a diagnostic when an invalid XML name is provided.
🎯 Issue Triage @Xml.name, XML-targeted @encodedName, and string prefixes passed to @Xml.ns accept values that cannot form valid XML names. The request is to validate XML Name/NCName syntax before invalid names reach emitters. Category: Feature Request Area: Unable to determine
🔍 Analysis
The primary component is @typespec/xml, but the configured repository labels do not include an XML library area. XML-targeted @encodedName may also involve compiler encoding-name handling.
The apparent gap is that these decorators validate argument types, and @Xml.ns validates the namespace URI, but none enforce the XML 1.0 lexical grammar for element names, attribute names, or namespace prefixes. This allows invalid wire names to propagate to emitters. No strong duplicate was found; microsoft/typespec-azure#5936 is related downstream context rather than the same request.
📝 Suggested next steps
Decide whether XML-name validation belongs exclusively in @typespec/xml or also in XML-media-type handling for @encodedName.
Add shared XML Name and NCName validation with targeted diagnostics.
Activity
github-actions commentedon Nov 25, 2026
🎯 Issue Triage
@Xml.name, XML-targeted@encodedName, and string prefixes passed to@Xml.nsaccept values that cannot form valid XML names. The request is to validate XMLName/NCNamesyntax before invalid names reach emitters.Category: Feature Request
Area: Unable to determine
🔍 Analysis
The primary component is
@typespec/xml, but the configured repository labels do not include an XML library area. XML-targeted@encodedNamemay also involve compiler encoding-name handling.The apparent gap is that these decorators validate argument types, and
@Xml.nsvalidates the namespace URI, but none enforce the XML 1.0 lexical grammar for element names, attribute names, or namespace prefixes. This allows invalid wire names to propagate to emitters. No strong duplicate was found; microsoft/typespec-azure#5936 is related downstream context rather than the same request.📝 Suggested next steps
@typespec/xmlor also in XML-media-type handling for@encodedName.NameandNCNamevalidation with targeted diagnostics.