Coder Social home page Coder Social logo

Comments (8)

awwright avatar awwright commented on May 16, 2024

You're probably looking for the uri format, JSON Schema doesn't provide for a "url" format. I'll take a look at why it seems there is one, though.

from jsonschema.

tdegrunt avatar tdegrunt commented on May 16, 2024

Can you provide me with the original schema and object you validated?

from jsonschema.

awwright avatar awwright commented on May 16, 2024

it should be right there in the "errors" list:

{
    "schema": {
      "type": "string",
      "description": "The link for onboarding onto this feature.",
      "format": "url"
    }
    "instance": "http://getStartedWithAce.com/go"
}

It looks like validating against a format that doesn't exist always fails.

from jsonschema.

tdegrunt avatar tdegrunt commented on May 16, 2024

Ah missed that, I'm on mobile. It's the url vs uri thing alright. We should probably error out on an invalid format then ... :)

from jsonschema.

tdegrunt avatar tdegrunt commented on May 16, 2024

Reading here: http://json-schema.org/latest/json-schema-validation.html#anchor105

"The value of this keyword is called a format attribute. It MUST be a string. A format attribute can generally only validate a given set of instance types. If the type of the instance to validate is not in this set, validation for this format attribute and instance SHOULD succeed."

Should we just say it's valid?
If not .. and we want to error out: I have code ready to throw an SchemaError if an invalid format is passed, including test.

from jsonschema.

awwright avatar awwright commented on May 16, 2024

Yeah, it should probably normally succeed, same as unknown properties.

I'll make a PR for this as a test to the official test suite over the weekend, to formally run this behavior by other implementations.

from jsonschema.

tdegrunt avatar tdegrunt commented on May 16, 2024

I think I have this fixed with the following (in develop branch):
14a8429

from jsonschema.

acusti avatar acusti commented on May 16, 2024

Seems like @tdegrunt’s fix for this has been orphaned in develop. Regarding whether unrecognized formats should fail or pass, I believe it is correct behavior that it passes, though I couldn’t find a test for it in the suite. Other validators (like tv4) take that approach, so I’m guessing that is correct.

I think a PR from develop into master would do the trick.

from jsonschema.

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.