Emit intrinsic @TypeSpec.example for model properties in autorest (OpenAPI2)#4393
Open
Emit intrinsic @TypeSpec.example for model properties in autorest (OpenAPI2)#4393
@TypeSpec.example for model properties in autorest (OpenAPI2)#4393Conversation
Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/62390e1f-dd88-44dd-b821-5652a379c428 Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix @example not working on model property
Emit intrinsic May 7, 2026
@TypeSpec.example for model properties in autorest (OpenAPI2)
Member
|
@copilot add changelog |
commit: |
Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/94acf26e-2990-4756-b804-ad6866bddcb0 Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Contributor
Author
Added the changelog entry in |
Member
|
@copilot run formatter |
Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/e6374227-21d0-4c22-9898-63224d996ac5 Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Contributor
Author
Ran formatter and pushed the formatting update in commit |
Collaborator
|
All changed packages have been documented.
Show changes
|
Agent-Logs-Url: https://github.com/Azure/typespec-azure/sessions/a6349b38-dccf-4bbf-8155-c2bfa915ff99 Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Collaborator
|
You can try these changes here
|
markcowl
reviewed
May 7, 2026
Member
markcowl
left a comment
There was a problem hiding this comment.
Looks good. Want to see the impact on azure-specs (if any) , so added the label.
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.
@exampleon model properties was being dropped by the autorest (Swagger 2.0) emitter, causing schema-level example metadata loss during conversion. OpenAPI3 already preserved this, so OpenAPI2 behavior was inconsistent.Emitter behavior update
typespec-autorestOpenAPI2 emission, property-level intrinsic examples are now applied when present.applyIntrinsicDecorators(...)now reads intrinsic TypeSpec examples and writesexampleon property schemas.Type surface alignment
OpenAPI2Schemato includeexample?: unknownso emitted property examples are modeled in the document types.Regression coverage
@TypeSpec.example(...)on a property emitsdefinitions.<Model>.properties.<prop>.example.Expected emitted schema fragment: