Coder Social home page Coder Social logo

JsonSchema validation about frisby HOT 5 CLOSED

vlucas avatar vlucas commented on August 29, 2024
JsonSchema validation

from frisby.

Comments (5)

vlucas avatar vlucas commented on August 29, 2024

Unfortunately, this is all the JSONSchema validation library provides. I would love to provide more detail like I do for all the other expectJSON* functions, but currently all the expectJSONSchema method does is display the errors returned from the validation library, which are not specific at all.

Frisby currently uses: json-schema: https://github.com/kriszyp/json-schema

If you want to investigate some other libraries that provide the level of detail you are looking for, I can integrate one of those instead. What other JSONSchema validation library would you like me to use?

NPM Search: https://npmjs.org/search?q=json+schema

from frisby.

damehta avatar damehta commented on August 29, 2024

Thanks for quick response.
I could find solution to log output values along with type. I could not get the property name yet. I made pull request to json-schema. Lets hope to get it accepted soon.

from frisby.

vlucas avatar vlucas commented on August 29, 2024

Good deal. Hopefully the library author merges that one in or we will have to look elsewhere. 👍

from frisby.

dbashford avatar dbashford commented on August 29, 2024
   [ { property: 'instance.firstName',
       message: 'is not of a type(s) string',
       schema: [Object],
       stack: 'instance.firstName is not of a type(s) string' },
     { property: 'instance.lastName',
       message: 'is not of a type(s) string',
       schema: [Object],
       stack: 'instance.lastName is not of a type(s) string' } ],

Guessing the library has changed, because that is what is in the errors object now. Currently the error message is using the message property, but if you usestack` you pretty much get what you need.

    Error: JSONSchema validation failed with the following errors: 
    > instance.firstName is not of a type(s) string
    > instance.lastName is not of a type(s) string

from frisby.

vlucas avatar vlucas commented on August 29, 2024

Yes, I switched JSON Validation libraries, and Frisby now gives you the full error message including path and property: https://github.com/vlucas/frisby/blob/master/lib/frisby.js#L731

from frisby.

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.