Code Monkey home page Code Monkey logo

Comments (4)

tlivings avatar tlivings commented on August 26, 2024

Could you not do this by simply using refineType with a more custom format ?

from enjoi.

maldimirov avatar maldimirov commented on August 26, 2024

You are right. It can be done using refineType and a custom type. The only downside I see to this is that you need to recreate the same joi validation schema as what enjoi already provides and then add the extra needed validation on top of it. Which is not a deal breaker, just a note.

So, we will probably go with refineType. But as the PR was almost ready if you still think an addition like the suggested one would add value to enjoi I will be happy to finish the code.

from enjoi.

tlivings avatar tlivings commented on August 26, 2024

You can also use the extensions feature. That might behave more like you are wanting because you can fully extend joi that way.

I’m happy to look at a PR still. Depending on how it fits in with the theme of enjoi I don’t see an issue with accepting such a change.

from enjoi.

maldimirov avatar maldimirov commented on August 26, 2024

The PR is ready.
This functionality would be more viable than refineType in the cases where you want to change the default validation per instance, not globally for a specified type. Also e.g. for objects you can add boolean logic rules between the keys/properties of the object.

from enjoi.

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.