You may use jsonSchemaLint for testing purposes.
I have this JsonSchema, which sets format as "full-date". All Draft-6 validators (Json.Net) accepts the schema as valid.
{
"title": "MyTestSchema",
"type": "object",
"properties": {
"MyDateValue": {
"type": "string",
"format": "full-date",
"description": "We expect yyyy-MM-dd"
}
}
}
But it is unable to identify this Json object is wrong:
{
"MyDateValue": "2017-10-1"
}
When I switch the schema from "full-date" to "date" only, it works:
{
"title": "MyTestSchema",
"type": "object",
"properties": {
"MyDateValue": {
"type": "string",
"format": "date",
"description": "We expect yyyy-MM-dd"
}
}
}
Is the one on the top ("full-date") correct term as Json rules? Please refer some documentation.
The value should be date
and not full-date
please refer
this documentation
Following are the valid values
date-time : This SHOULD be a date in ISO 8601 format of YYYY-MM- DDThh:mm:ssZ in UTC time. This is the recommended form of date/ timestamp.
date : This SHOULD be a date in the format of YYYY-MM-DD. It is recommended that you use the "date-time" format instead of "date" unless you need to transfer only the date part.
time : This SHOULD be a time in the format of hh:mm:ss. It is recommended that you use the "date-time" format instead of "time" unless you need to transfer only the time part.
utc-millisec : This SHOULD be the difference, measured in milliseconds, between the specified time and midnight, 00:00 of January 1, 1970 UTC. The value SHOULD be a number (integer or float).
source : here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With