json-schema-spec
json-schema-spec copied to clipboard
How to declare deprecation date and reason
With JSON-Schema I can flag a field or my entire document by setting the deprecated meta-data attribute to true. Besides flagging the field as deprecated I would like to add a date and a reason (particularly useful when I would like to suggest to use another field replacing the deprecated ones). Is there any way to do it by following JSON-Schema specification? If it is not the case, is there any best practice/pattern to follow? Thanks
The latest draft specifies that unknown keywords are to be collected as annotations. This means that you should be free to add "keywords" that you want (e.g. deprecation-date) and you should get their values as annotations in the output.
The latest draft specifies that unknown keywords are to be collected as annotations. This means that you should be free to add "keywords" that you want (e.g.
deprecation-date) and you should get their values as annotations in the output.
thanks for your suggestion. This official document discusses annotations but it does not explictily state whether you can use custom "keywords". Moreover I use AJV and Newtonsoft validation libraries and none of them seems to support annotations in the output, only valid and errors. Do you know any existing library that has already implemented support for annotations?
I just happen to know of one! Check out mine: https://www.nuget.org/packages/JsonSchema.Net/