Git Product home page Git Product logo

jsonschema's People

Contributors

noha avatar sergestinckwich avatar stephaneggermont avatar udoschneider avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

jsonschema's Issues

Reify referenced schemas

In large specs where schemas are reused within the spec schemas are stored at a central place. In JSON schema this is in defintions. At the moment schemas are resolved to objects. That opens the problem that schema with definitions can be parsed but on writing the definitions are gone and the schemas are written everywhere again where they are used

Deprecated: JSONSchema>>#enum: implies String type

The JSONSchema>>#enum: helper method creates a string schema although enum can be defined on all types. As this is maybe used in existing code it might make sense to add a deprecation notice once the "fix" path is clear.

"Invalid" Schema created if type is unset

If the schema does not provide a type property an invalid schema JSONSchemaAnyObject might be produced. I.e. the following code does not raise an exception as required:

|schema|
schema := JSONSchema fromString: '{"exclusiveMaximum":10}'.
schema validate: 11.

Adding a type property leads to the right schema being produced (JSONSchemaNumber) incl. matching constraints:

|schema|
schema := JSONSchema fromString: '{"type":"number","exclusiveMaximum":10}'.
schema validate: 11.

I'm not 100% sure if type is a required property and thus schemas not specifing it might be invalid. However from reading the spec (and the test cases) I strongly assume that a schema without a type property is indeed valid. If this is the case the complete framework might have to be reorganized because it's (type) existence seems to be a very basic low-level assumption the framwork relies on.

Add formats from spec to string type

The following is the list of formats specified in the JSON Schema specification.

"date-time": Date representation, as defined by RFC 3339, section 5.6.
"email": Internet email address, see RFC 5322, section 3.4.1.
"hostname": Internet host name, see RFC 1034, section 3.1.
"ipv4": IPv4 address, according to dotted-quad ABNF syntax as defined in RFC 2673, section 3.2.
"ipv6": IPv6 address, as defined in RFC 2373, section 2.2.
"uri": A universal resource identifier (URI), according to RFC3986.
"uri-reference": New in draft 6 A URI Reference (either a URI or a relative-reference), according to RFC3986, section 4.1.
"json-pointer": New in draft 6 A JSON Pointer, according to RFC6901. There is more discussion on the use of JSON Pointer within JSON Schema in Structuring a complex schema. Note that this should be used only when the entire string contains only JSON Pointer content, e.g. /foo/bar. JSON Pointer URI fragments, e.g. #/foo/bar/ should use "uri" or "uri-reference".
"uri-template": New in draft 6 A URI Template (of any level) according to RFC6570. If you don’t already know what a URI Template is, you probably don’t need this value.

Separate #read: selector to regarding types

Reading behaviour in schema objects is incoherent and misleading. Needs separation to read from string or from dictionary. Interface should be same for primitive, objects and lists

long filename in test suite does not load in win 10 environment

This package is throwing an error when being loaded in pharo 9 Win 64 (windows 10) as part of pharo-nosql/voyage baseline

failed to stat "C:/Users/xxxx/xxxxxxxx/Pharo/images/p9-xxxxx/pharo-local/iceberg/zweidenker/JSONSchema/source/JSONSchema-Testsuite-Tests.package/JSONSchemaAdditionalPropertiesBeingFalseDoesNotAllowOtherPropertiesTests.class/instance/testPatternPropertiesAreNotAdditionalProperties.st': The filename or extension is too long.
"

but strangely this seems to work in Pharo 8 Win 64 (Windows 10)

Array validation fails if items is not set

Currently array validation fails if items is not set:

|schema|
schema := JSONSchema fromString: '{
  "type": "array"
}'.
schema validate: #(1 2)

The code works if you have items set however:

|schema|
schema := JSONSchema fromString: '{
  "type": "array",
  "items": { "type":"number" }
}'.
schema validate: #(1 2).

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.