-
Notifications
You must be signed in to change notification settings - Fork 9.1k
added deprecated fields #637
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned by @IvanGoncharov, this needs more clarification.
You don't actually deprecate a schema, you deprecate a property in a object model (or you deprecate a parameter, or a whole path/operation, but this is a different issue).
The problem (inherited from JSON Schema) is that an object's property consists of just a name and a schema of its value, and thus we can only add stuff to the value schema, as done here.
Maybe add something similar to the "schemaXml" cited above:
An alternative would be to do this similar to
required
and add a property to the containing schema, with a list of deprecated properties.In addition, when something is deprecated I often feel the need to mention why it is deprecated, and what to use instead. Of course this can be put into the description, but maybe it is better to make this a string property, with the value being the deprecation documentation? (When using the alternative mentioned above, it could be made an object mapping property name → deprecation info, instead of an array of property names.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ePaul It was discussed here: #540
And it's a slippery slope since next thing people will ask to implement is the date of deprecation.
IMHO it's very simple rule of thumb if you can programmatically act based on field value; but if it's a text for a user to read then why not use description for that.
One thing that could be added to Swagger spec is a recommendation to add full content of description field into the text of deprecation warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the link. You are right, I guess putting it in the description is enough. (And the recommendation to do so should be here.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think such recommendations should be covered outside the spec and within some best practice docs - #589.