-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Field Deprecation in Schema Objects #701
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
@ePaul Thanks for the answer. I browsed through the above but i find only the following:
For 3, how do i deprecate just one field in the schema? Thanks |
The problem is that a field in a schema doesn't have any location where data could be added, other than the field's schema. So you'll need to put it there: definititions:
Person:
type: object
properties:
name:
type: string
age:
type: integer
deprecated: true
description: The age of the person in years. This property is deprecated because you shouldn't care about someone's age. Of course, this gets ugly when you are using $ref and one of the properties referring a schema is deprecated and another one not – you need to duplicate. Maybe a better way to do this would be a list of deprecated properties in a schema, just like |
As @ePaul mentioned, you can deprecate a property because it's an instance of the Schema Object. @ePaul - you've mentioned the |
Please no more "property" arrays like
I like the idea of the |
The readability is better when we define it as an array like But you can support both at property level and as an array too. |
It's got nothing to do with readability - it's got to do with the ability to control what's required/deprecate when it comes to using |
Great. Thanks for the clarification. |
Hi, Feature request on deprecation specification: Can the declaration of deprecation be in the form of an object instead of a boolean field? Something in the line of Java. "deprecated": {
Such decoration would help deprecation, warning and then removal progressively. Thanks, |
Thinking about this more, I think the complexity of adding something like this outweighs the benefits. At the field level, the schema would start to become flooded with non-API specific indicators for purely reference, rather than of actual value. The deprecation flag doesn't actually have a functional impact. Can you imagine attempting to reuse the same schema object across API versions and methods, where depending on the method and version a field may or may not be deprecated. At the different API levels, I feel like deprecation is already implied by the existence of a later version. I.e. Publishing two versions of the API, of course the earlier one is deprecated and the newer one is preferred, or at least that is what I always interpreted that to mean. I do see the benefit of a way to indicate |
When you say API versions, do you mean MAJORor MINOR?
|
From your answer though it seems like you have some strict API implementation guidelines you follow which are not enforced by the spec. Given that it begs the question, should I'm tempted to say, leave it out of the spec, as there are already existing ways of representing this data (arguably in a meaningful way), however, maybe reviewing the guidelines you follow would be a good opportunity to understand why these other ways aren't sufficient for handling deprecation. |
Hello, I was browsing through the spec docs to find out how to mark deprecation at various levels for an API. I could find docs/prs specifying how to mark deprecation of an operation and deprecation of a parameter (query, header or an entire Schema Object) but its not clear how can we mark a field in a Schema Object deprecated? Is there a plan to add support for this?
Appreciate any clarification around this.
Thanks,
Jayadeba Jena
The text was updated successfully, but these errors were encountered: