Comments (13)
I've just finished and merged "format" keyword support (and added docs to readme ), tagged as version 1.2.0 .
@balazs-zsoldos please release version 1.2.0 on maven central.
Thank you.
from json-schema.
@balazs-zsoldos now yes, please, I've just fixed it and re-released 1.2.0 on github
@rcillo thanks for the fast feedback
from json-schema.
I can fork and create a pull request if you like.
from json-schema.
@Antares42 yes, supporting the "format" keyword is optional and this validator currently does not support it. But you are not the first user asking for it, so we may add it. I'd be thankful if you could create a PR for it.
Thanks.
from json-schema.
I shouldn't be worried that my PR is flagged red as "tests failed" by Travis, right? Because that's the entire point. :-)
from json-schema.
@Antares42 I've made some investigations about this issue. The json schema spec mandates an implementation supporting the "format" keyword to handle the following values:
- date-time: this seems to be simple to implement
- ipv4 and ipv6: I'll take the same approach as the fge/json-schema-validator library does (it uses guava)
- hostname and uri: I'll look after these
- email: looks tricky, because email address validation is not as straightforward as it seems to be. I've tried to follow the way how fge/json-schema-validator works, but it doesn't seem to be perfect. For example it accepts [email protected], while it is not a valid email address (the local part shouldn't end with a period). I could find a decent test suite in this library , I will use these tests to evaluate some java libraries if they work as expected.
To sum up, this issue is more complicated than I expected, so I can't promise any ETA.
from json-schema.
I understand. I think we use the Apache Commons email validator in our projects, which appears to conform pretty closely to the RFC.
from json-schema.
Maybe it would be easier to implement something like tv4 addFormat(format, validationFunction)
. This way one could provide formats as a separate library.
I think it would require a lower commitment from the library contributors and maintainers and provide a more powerful extension point.
What do you think?
from json-schema.
Yes, I also thought about providing a way for users to implement their own format validators. By the way currently the built-in formats are supported (see this branch ) but I won't have time to finish it until the middle of April, so 1.2.0 will be released in a month (hopefully).
from json-schema.
When you have the time to merge it I'll definitely use it. Great job with the library 👍
from json-schema.
I tested the release 1.2.0 and it seems that the format for date-time is not strict. For example, the following string would be accepted "1996-60-15T16:39:57-08:00"
or even "1996-60-999T16:39:57-08:00"
.
I took a look at the docs for SimpleDateFormat and it seems that it's lenient by default. But I'm afraid that the RFC doesn't allow such heuristics to take place.
Maybe the code should be changed to setLenient(false)
?
from json-schema.
@erosb Shall I upload the release to maven-central? I am asking back because of the comment of @rcillo.
from json-schema.
@erosb Released to maven central
from json-schema.
Related Issues (20)
- How to stabilize output of Schema#toString() HOT 1
- Valid number with step(scale) HOT 4
- $ref limitation in complex schemas HOT 2
- Invalid date-time fails validation HOT 5
- oneOf required is not working correctly HOT 4
- How to validate if the schema itself is valid? HOT 7
- ObjectSchema.getRegexpPatternProperties method is not public. HOT 1
- CombinedSchema.isSynthetic is not public. HOT 2
- Issue with 'minLength' and 'maxLength' property HOT 3
- $ref resolution issue when referencing an external schema HOT 3
- Performance and functional comparison HOT 1
- define a custom property HOT 1
- Support custom keywords and corresponding verification logic
- Incorrect org.json Version in Release 1.14.3
- Two CombinedSchema don't equals after loading the same json schema HOT 9
- Support for specs 2020-12 and 2019-09 HOT 2
- Is unevaluatedProperties keyword supported? HOT 2
- "required" validation for the referenced schema not working HOT 1
- StringSchema.hashCode inconsistent across executions HOT 3
- "default" is not working inside $ref
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-schema.