-
Notifications
You must be signed in to change notification settings - Fork 398
warning: format attribute "date" not supported #103
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
Hello, This is a poor choice on my part when writing draft v4; of all the date/time attributes, only date-time is supported; date and time were pulled out. They will be back in draft v5 however. So, this message is normal. However, you can add them back programmatically: final Library library = DraftV4Library.get().thaw()
.addFormatAttribute("date", DateAttribute.getInstance())
.freeze();
final ValidationConfiguration cfg = ValidationConfiguration.newBuilder()
.setDefaultLibrary("http://some.site/myschema#", library).freeze();
final JsonSchemaFactory factory = JsonSchemaFactory.newBuilder()
.setValidationConfiguration(cfg).freeze(); You can then build schemas from this factory: they will support this format attribute. |
Hi, I still see the same warning after adding the code that you mentioned. |
Can you post your full code? |
Apologizes for the late response. Here is my code and I think there is something wrong with the way I am adding the default library. I copied draft4 schema in my local drive and referring the same (in the below code)
|
Hi, Any update on this? |
I got this to work. I needed to change the value of the $schema field in the JSON schema file to not be "http://json-schema.org/draft-04/schema#" or any of the supported schemas. Change it to the same value as what you use in the setDefaultLibrary (I used "http://mycompany.com/myschema#"). |
Thanks Jeegar. I shall try this. Regards, Ritesh From: Jeegar Maru [mailto:[email protected]] I got this to work. I needed to change the value of the $schema field in the JSON schema file to not be "http://json-schema.org/draft-04/schema# http://json-schema.org/draft-04/schema " or any of the supported schemas. Change it to the same value as what you use in the setDefaultLibrary (I used "http://mycompany.com/myschema# http://mycompany.com/myschema "). — |
(sorry for the long delay) What @jeegarmaru said; see also the examples as to how to modify your library to add a format attribute. |
Hi @fge this is still giving me the same error even after changing the $schema.Please help. |
Hi,
I have a JSON schema which has a property "BIRTH_DATE" with format as "date".
"BIRTH_DATE" : {
"description" : "BIRTH DATE",
"format" : "date",
"type" : "string"
},
Whenever I try to validate a json payload after this schema, the validator succeeds but shows up a warning:
warning: format attribute "date" not supported
level: "warning"
schema: {"loadingURI":"#","pointer":"/definitions/MemberDemographicJsSchema/properties/BIRTH_DATE"}
domain: "validation"
keyword: "format"
attribute: "date"
Am I doing anything wrong here? Or json validator does not support date format? If later, then how do I validate the date?
Regards,
Ritesh
The text was updated successfully, but these errors were encountered: