-
Notifications
You must be signed in to change notification settings - Fork 10.3k
OpenApi ApiVersionAttribute.Deprecated not reflected in schema #57853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This looks like a feature request for dotnet/aspnet-api-versioning - |
might be related: dotnet/aspnet-api-versioning#1044 |
Transformers etc. are only used with |
@JTeeuwissen Yes, as @martincostello mentioned, the As to why this behavior isn't built in at the moment, there is actually an issue about adding support for an In the past, I've been meh about adding a specific property for this in the There admittedly hasn't been much traction on that issue since the defacto approach has long been "use workarounds in the Open API implementation" to add this support. I'll leave this issue to track interest in supporting this feature. We'll definitely want to spend some time reasoning through whether a metadata-based approach or a new property on |
Thank you for the elaborate response. I'm trying to migrate from nswag to m.a.openapi in dotnet 9, and nswag (afaik) supports api deprecation. I'll have a look at the eShop example, but I'm somewhat surprised this relatively simple example does not work out of the box. |
I feel you. 😕 Unfortunately, this is one of those things that appears simple on the surface but has some implications to consider if we were to figure out the best way to address this issue in the framework itself. NSwag models its support for this using an IOperationProcessor implementation that makes heavy use of private reflection to access types defined in Asp.Versioning. That means that NSwag doesn't have to solve any problems related to exposing a more stable public API for the information that is being accessed via private reflection or working through the limitation we have of not being able to reference external dependencies in the shared framework (where ApiExplorer lives). |
Is there an existing issue for this?
Describe the bug
When adding an
ApiVersionAttribute
withDeprecated = true
to a controller, the operation schema is not marked as"deprecated": true
Expected Behavior
When adding an
ApiVersionAttribute
withDeprecated = true
to a controller, the operation schema should be marked with"deprecated": true
Steps To Reproduce
Services
Controller
Result
Exceptions (if any)
No response
.NET Version
9.0.100-rc.1.24452.12
Anything else?
An
IOpenApiOperationTransformer
like below could serve as a workaround, but I would prefer this functionality to be built in.The text was updated successfully, but these errors were encountered: