Giter Club home page Giter Club logo

Comments (13)

erosb avatar erosb commented on July 17, 2024 1

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.

erosb avatar erosb commented on July 17, 2024 1

@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.

Antares42 avatar Antares42 commented on July 17, 2024

I can fork and create a pull request if you like.

from json-schema.

erosb avatar erosb commented on July 17, 2024

@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.

Antares42 avatar Antares42 commented on July 17, 2024

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.

erosb avatar erosb commented on July 17, 2024

@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.

Antares42 avatar Antares42 commented on July 17, 2024

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.

rcillo avatar rcillo commented on July 17, 2024

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.

erosb avatar erosb commented on July 17, 2024

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.

rcillo avatar rcillo commented on July 17, 2024

When you have the time to merge it I'll definitely use it. Great job with the library 👍

from json-schema.

rcillo avatar rcillo commented on July 17, 2024

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.

balazs-zsoldos avatar balazs-zsoldos commented on July 17, 2024

@erosb Shall I upload the release to maven-central? I am asking back because of the comment of @rcillo.

from json-schema.

balazs-zsoldos avatar balazs-zsoldos commented on July 17, 2024

@erosb Released to maven central

from json-schema.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.