Giter VIP home page Giter VIP logo

Comments (6)

FrederikP avatar FrederikP commented on July 19, 2024

This is the current regex:

^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]{1,62}[A-Za-z0-9])$

As far as I see it, this means, the last part can never be exactly 2 chars long. This is a huge problem, as there are many tlds with 2 chars. (.de, .fr, etc.)

In the PR I'll probably use a different regex. But: As I said in the other issue today: I don't think regexes are a good solution for formats that can easily be validated using python standard library means (other than re).

from python-fastjsonschema.

horejsek avatar horejsek commented on July 19, 2024

I agree, some formats would be better to validate by some extra library than by regexps. Also, some regexps are are not super correct for some cases. But it brings dependencies which I want to avoid until it's not really necessary. :-)

But maybe, if license allows it, I could copy-paste some code into this library to keep an eye on performance and avoid problems with changing dependencies. Will put on my todo list to check possibilities.

from python-fastjsonschema.

FrederikP avatar FrederikP commented on July 19, 2024

I agree, some formats would be better to validate by some extra library than by regexps. Also, some regexps are are not super correct for some cases. But it brings dependencies which I want to avoid until it's not really necessary. :-)

In some cases, like ipv4 and ipv6, you could use functionality like the ipaddress module that doesn't require additional dependencies.
But for some other formats you might need other dependencies and I understand that you'd like to avoid them. You could start with the formats that are covered by the standard python library.

from python-fastjsonschema.

FrederikP avatar FrederikP commented on July 19, 2024

@horejsek Thanks for merging! I would be very happy if you can do a bugfix release with this in the near future, because this issue keeps us from rolling out a component that we switched from jsonschema to your library (because of draft7 support, performance and I like it better :) )

from python-fastjsonschema.

horejsek avatar horejsek commented on July 19, 2024

Done, v2.3 :-)

from python-fastjsonschema.

horejsek avatar horejsek commented on July 19, 2024

Glad it helped your component! :-)

from python-fastjsonschema.

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.