[autorest] XML annotation support#3290
Merged
witemple-msft merged 9 commits intoAzure:mainfrom Sep 26, 2025
Merged
Conversation
Collaborator
|
All changed packages have been documented.
Show changes
|
Collaborator
|
You can try these changes here
|
timotheeguerin
approved these changes
Sep 26, 2025
markcowl
pushed a commit
to markcowl/typespec-azure
that referenced
this pull request
Sep 26, 2025
This PR adds support for XML metadata annotations to typespec-autorest: - Changes the logic around top-level produces/consumes. It will now allow JSON or XML, rather than always using JSON only. If a service uses both, then it will pick both. It maintains the logic of only emitting operation-level produces/consumes if an operation differs from the top-level. - Optionally depends on `@typespec/xml`. If it is not installed, all XML emit functionality is disabled. - Emits `xml.name` for processed schemas if the XML name differs from the schema name. - Emits `xml.namespace` and `xml.prefix` as needed. - Emits `xml.attribute` for properties that are marked as attributes. - Prefers XML names for properties if the service is only XML. - Emits `x-ms-text` for properties that are `@unwrapped` if the property's effective encoded type is or extends `TypeSpec.string`. - Emits `xml.wrapped: true` by default for all properties that have array types, unless the property is marked `@unwrapped`. - Adds several validation tests for XML and hybrid XML/json services. Closes Azure#1682
markcowl
pushed a commit
to markcowl/typespec-azure
that referenced
this pull request
Sep 27, 2025
This PR adds support for XML metadata annotations to typespec-autorest: - Changes the logic around top-level produces/consumes. It will now allow JSON or XML, rather than always using JSON only. If a service uses both, then it will pick both. It maintains the logic of only emitting operation-level produces/consumes if an operation differs from the top-level. - Optionally depends on `@typespec/xml`. If it is not installed, all XML emit functionality is disabled. - Emits `xml.name` for processed schemas if the XML name differs from the schema name. - Emits `xml.namespace` and `xml.prefix` as needed. - Emits `xml.attribute` for properties that are marked as attributes. - Prefers XML names for properties if the service is only XML. - Emits `x-ms-text` for properties that are `@unwrapped` if the property's effective encoded type is or extends `TypeSpec.string`. - Emits `xml.wrapped: true` by default for all properties that have array types, unless the property is marked `@unwrapped`. - Adds several validation tests for XML and hybrid XML/json services. Closes Azure#1682
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for XML metadata annotations to typespec-autorest:
@typespec/xml. If it is not installed, all XML emit functionality is disabled.xml.namefor processed schemas if the XML name differs from the schema name.xml.namespaceandxml.prefixas needed.xml.attributefor properties that are marked as attributes.x-ms-textfor properties that are@unwrappedif the property's effective encoded type is or extendsTypeSpec.string.xml.wrapped: trueby default for all properties that have array types, unless the property is marked@unwrapped.Closes #1682