Skip to content

format attribute "date" not supported #286

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

Closed
vidyac410 opened this issue Jan 30, 2019 · 3 comments
Closed

format attribute "date" not supported #286

vidyac410 opened this issue Jan 30, 2019 · 3 comments

Comments

@vidyac410
Copy link

vidyac410 commented Jan 30, 2019

Hi,
I have a JSON schema which has a property "InvoiceDate" of type "string" with format as "date".
"InvoiceDate" : {
"type" : "string",
"format" : "date"
}
And I have a JSON payload as below:
{
"invoiceDate":"blah"
}
I am trying to validate the json payload against the above schema , the validator succeeds but shows up a warning:

warning: format attribute "date" not supported
level: "warning"
schema: {"loadingURI":"#","pointer":"/definitions/IntegrationTest/properties/invoiceDate"}
domain: "validation"
keyword: "format"
attribute: "date"

Seems like the Json-schema-validator is not supporting 'date' format.

I tried solving the above issue by following the steps specified in the similar issue : #103

This is what i gave in my code:

         final Library library = DraftV4Library.get().thaw()
				        .addFormatAttribute("date", DateAttribute.getInstance())
				        .freeze();                        

	 final ValidationConfiguration cfg = ValidationConfiguration
				        .newBuilder()
				        .setDefaultLibrary("file:///Users/vidya/Desktop/DocSchema.json", library)
				        .freeze();
	
        final JsonSchemaFactory factory = JsonSchemaFactory.newBuilder()
				        .setValidationConfiguration(cfg).freeze();

Apparantly this again is skipping the date validation , the the validator is succeeding and showing the warning.
Am I doing anything wrong here? What value needs to be provided in the setDefaultLibrary? i tried providing my schema link ("file:///Users/vidya/Desktop/DocSchema.json"), and some random URL's as well. The validator keeps succeding.

@vidyac410
Copy link
Author

Working fine

@jepoyoy
Copy link

jepoyoy commented Feb 26, 2019

what did you do to make this work? Thanks!

@vidyac410
Copy link
Author

vidyac410 commented Feb 26, 2019

Hi @jepoyoy, I followed the steps as pointed out in issue : #103 (comment)

@vidyac410 vidyac410 reopened this Feb 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants