-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Allow additional field deprecatedMessage for operation #540
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
For simplicity, why not allow the |
Are you suggesting |
Yes, it takes a boolean or a string. The idea is for simple cases, turning it on ( Processing rules:
Just an idea... |
@whitlockjc @lieldulev I think we already have two nice fields for that |
Well, I figure this proposal is more for a general property and not just for the overall API itself. Imagine being able to mark operations, paths, parameters, ... as deprecated as your API evolves. |
IMHO, I think Swagger should have minimal amount features which allow to describe API. Deprecation attribute for parameter can be useful, but parameters also have |
The issue with relying on description is now you have to parse it for special tokens and that is just more work. (It's work all around, I know.) We could easily get away with this using a vendor extension but to me, deprecating various parts of your API design is something that is globally useful which makes it a good candidate for core specification support. |
Why you need to parse anything?
If it some docs, you need deprecation notice in So no need for special tokens just write deprecation notice as part of documenting method, parameter, ... |
I used |
Marking something as deprecated is more than just a display issue. Sure, if I was just rendering a Markdown view I could just throw in some special text and things would look nice. But really, marking something as deprecated is a piece of state, something that other tooling might want to use. For that case, you do have to parse things to identify the deprecated components. |
Imagine I want to create an object model around the specification. I wanted to have a |
Yes exactly, that is why |
@IvanGoncharov I suggested a special field because I found current description/title not enough. I have 2 main reasons: Specifically - in our swagger-ui - I'd like to present the deprecation message in a different way than endpoint description, currently I have to "dirty" my description with html tags to do that. I also don't like the fact that a method "usage/description" changes because of deprecation. Deprecation doesn't change how to use an endpoint/parameter or what it does (or supposed to do), it (usually) means that the thing will be removed in the near future - and suggest that the developer will move away from it while pointing me to an alternative solution. |
One of example of how it could be represented in docs is Stripe API: Could it be better represented with separate field? Probably yes. |
My stance has been based on the original request to add another field for the deprecation message. I'd rather not add another field so that's why I suggested extending the |
I fully agree 👍 |
+1 on @whitlockjc 's revision - extend the |
I tend to believe the structure should stay as-is now. @lieldulev - if you change your documentation marking that a method is deprecated, then yes, it would make perfect sense to change its description as well. You can say that it doesn't change how the operation is to be used, but that's not entirely true. You're pretty much redirecting the user to a different operation, or give them an entirely different description of what they should be doing. Can't say that swagger-ui is a reason for this change as well. You have the information that the method is deprecated and can present it as such. If you must do some additional display magic to present the additional details in a different manner, you can even do it in the current implementation, all with some html/css/javascript magic. It may not be pretty, but it is doable. Lastly, while @whitlockjc's suggestion is relatively elegant, I'm not a big fan of type overloading and for that reason I'm not in favor of this solution. |
After reading your arguments and thinking more about it, I changed my mind. Although I still believe we should be able to define more data regarding deprecation (e.g. version, date), I actually don't think bloating the spec with a very custom use case by adding Unless anyone has a more elegant solution than what I do today (custom HTML inside the endpoint's description) - for now let's close this issue. Thank you for your remarks. |
Thanks for the feedback, @lieldulev. I'd suggest we close it for now, and revisit if needed. |
field name
deprecatedMessage
type
string
.optional.
default
""
.Meaningful only if
depreacted
is true.Usually deprecating a command/function/endpoint comes with a message, helping user to migrate to alternative endpoint/api/service.
https://en.wikipedia.org/wiki/Deprecation#Software_deprecation
The text was updated successfully, but these errors were encountered: