Skip to content

Conversation

witemple-msft
Copy link
Member

Closes #8677

  • Adds a manuallyTrack method to the usage tracker, allowing the emitter to bind the usage of synthetic discriminated union envelopes to the union type's usage (this influences how the emitter decides to rename models, which it only does if a type has multiple usage).
  • Caches the types of created envelopes by visibility if the union variant is transformed by the visibility.
    • If a variant is subject to visibility, but not transformed, the default envelope model is used so that all untransformed variants will share a schema.
    • This system is just to ensure that the correct number of envelope models are created, one for each active visibility transform that will result in a different schema.
  • Adds a test against regressions that validates the envelopes are created with the correct structure, binding to the correct transformed models of the underlying variant types.

Copy link
Contributor

All changed packages have been documented.

  • @typespec/openapi3
Show changes

@typespec/openapi3 - fix ✏️

Addressed an issue where @discriminated union envelope schemas could sometimes have duplicate names in the context of visibility transforms.

@azure-sdk
Copy link
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@witemple-msft witemple-msft added this pull request to the merge queue Oct 20, 2025
Merged via the queue into microsoft:main with commit d1bf776 Oct 20, 2025
26 checks passed
@witemple-msft witemple-msft deleted the witemple-msft/oapi3-discriminated-visibility-variant branch October 20, 2025 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Implicit visibility with @discriminated unions can create duplicate type names

3 participants