Conditionally Excluding Properties from OpenAPI Specs #5659
Labels
compiler:core
Issues for @typespec/compiler
design:needed
A design request has been raised that needs a proposal
triaged:core
Milestone
Problem Statement:
In our API definitions, we have enums and model properties where some values or attributes are intended for internal use only or are restricted to partner teams. These values and properties should be excluded from the OpenAPI specification generated for external users, while still being available in internal or partner-facing code generation.
Solution:
Introduce a compilation check to optionally skip rendering specified enum values or model properties based on visibility annotations. This approach will allow us to define visibility rules directly in the API schema, enabling conditional exclusion during OpenAPI spec generation or code emission.
Implementation:
Enhance the existing @visibility annotation (or introduce a similar annotation) to support compile time visibility rules.
tspconfig.yaml
main.tsp
Checklist
The text was updated successfully, but these errors were encountered: