Giter Club home page Giter Club logo

Comments (4)

HugoCapocci avatar HugoCapocci commented on August 10, 2024

(shema was invalid by the way, I forgot to mention that... )

from z-schema.

zaggino avatar zaggino commented on August 10, 2024

can you submit the invalid schema?

from z-schema.

kachok avatar kachok commented on August 10, 2024

Same problem, here is schema generated by
http://jsonschema.net/reboot/#/

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "id": "http://jsonschema.net#",
    "type": "array",
    "required": false,
    "items": {
        "id": "http://jsonschema.net/5#",
        "type": "object",
        "required": false,
        "properties": {
            "identifiers": {
                "id": "http://jsonschema.net/5/identifiers#",
                "type": "array",
                "required": false,
                "items": {
                    "id": "http://jsonschema.net/5/identifiers/0#",
                    "type": "object",
                    "required": false,
                    "properties": {
                        "identifier": {
                            "id": "http://jsonschema.net/5/identifiers/0/identifier#",
                            "type": "string",
                            "required": false
                        }
                    }
                }
            },
            "vital": {
                "id": "http://jsonschema.net/5/vital#",
                "type": "object",
                "required": false,
                "properties": {
                    "name": {
                        "id": "http://jsonschema.net/5/vital/name#",
                        "type": "string",
                        "required": false
                    },
                    "code": {
                        "id": "http://jsonschema.net/5/vital/code#",
                        "type": "string",
                        "required": false
                    },
                    "code_system_name": {
                        "id": "http://jsonschema.net/5/vital/code_system_name#",
                        "type": "string",
                        "required": false
                    }
                }
            },
            "status": {
                "id": "http://jsonschema.net/5/status#",
                "type": "string",
                "required": false
            },
            "date": {
                "id": "http://jsonschema.net/5/date#",
                "type": "array",
                "required": false,
                "items": {
                    "id": "http://jsonschema.net/5/date/0#",
                    "type": "object",
                    "required": false,
                    "properties": {
                        "date": {
                            "id": "http://jsonschema.net/5/date/0/date#",
                            "type": "string",
                            "required": false
                        },
                        "precision": {
                            "id": "http://jsonschema.net/5/date/0/precision#",
                            "type": "string",
                            "required": false
                        }
                    }
                }
            },
            "interpretations": {
                "id": "http://jsonschema.net/5/interpretations#",
                "type": "array",
                "required": false,
                "items": {
                    "id": "http://jsonschema.net/5/interpretations/0#",
                    "type": "string",
                    "required": false
                }
            },
            "value": {
                "id": "http://jsonschema.net/5/value#",
                "type": "integer",
                "required": false
            },
            "unit": {
                "id": "http://jsonschema.net/5/unit#",
                "type": "string",
                "required": false
            }
        }
    }
}

from z-schema.

zaggino avatar zaggino commented on August 10, 2024

@kachok That's not a valid version 4 schema (4 is currently the latest version, which this validator validates for, see http://json-schema.org/). What'd you expect to happen with an invalid schema? I'm correctly getting a list of errors when I try to compile it like this:

        var validator = new ZSchema({ sync: true });
        try {
            validator.compileSchema(schema);
        } catch (e) {
            console.log(e);
        }

Errors:

{ [Error: Validation failed]
errors:
 [ { [Error: Keyword "required" is expected to be of type "array"]
     code: 'KEYWORD_TYPE_EXPECTED',
     message: 'Keyword "required" is expected to be of type "array"',
     path: '#/',
     params: [Object] },
   { [Error: Keyword "required" is expected to be of type "array"]
     code: 'KEYWORD_TYPE_EXPECTED',
     message: 'Keyword "required" is expected to be of type "array"',
     path: '#/items',
     params: [Object] },
   { [Error: Keyword "required" is expected to be of type "array"]
     code: 'KEYWORD_TYPE_EXPECTED',
     message: 'Keyword "required" is expected to be of type "array"',
     path: '#/items/properties[identifiers]',
     params: [Object] },
   { [Error: Keyword "required" is expected to be of type "array"]
     code: 'KEYWORD_TYPE_EXPECTED',
     message: 'Keyword "required" is expected to be of type "array"',
     path: '#/items/properties[identifiers]/items',
     params: [Object] },
   { [Error: Keyword "required" is expected to be of type "array"]
     code: 'KEYWORD_TYPE_EXPECTED',
     message: 'Keyword "required" is expected to be of type "array"',
     path: '#/items/properties[identifiers]/items/properties[identifier]',
     params: [Object] },
   { [Error: Keyword "required" is expected to be of type "array"]
     code: 'KEYWORD_TYPE_EXPECTED',
     message: 'Keyword "required" is expected to be of type "array"',
     path: '#/items/properties[vital]',
     params: [Object] },
   { [Error: Keyword "required" is expected to be of type "array"]
     code: 'KEYWORD_TYPE_EXPECTED',
     message: 'Keyword "required" is expected to be of type "array"',
     path: '#/items/properties[vital]/properties[name]',
     params: [Object] },
   { [Error: Keyword "required" is expected to be of type "array"]
     code: 'KEYWORD_TYPE_EXPECTED',
     message: 'Keyword "required" is expected to be of type "array"',
     path: '#/items/properties[vital]/properties[code]',
     params: [Object] },
   { [Error: Keyword "required" is expected to be of type "array"]
     code: 'KEYWORD_TYPE_EXPECTED',
     message: 'Keyword "required" is expected to be of type "array"',
     path: '#/items/properties[vital]/properties[code_system_name]',
     params: [Object] },
   { [Error: Keyword "required" is expected to be of type "array"]
     code: 'KEYWORD_TYPE_EXPECTED',
     message: 'Keyword "required" is expected to be of type "array"',
     path: '#/items/properties[status]',
     params: [Object] },
   { [Error: Keyword "required" is expected to be of type "array"]
     code: 'KEYWORD_TYPE_EXPECTED',
     message: 'Keyword "required" is expected to be of type "array"',
     path: '#/items/properties[date]',
     params: [Object] },
   { [Error: Keyword "required" is expected to be of type "array"]
     code: 'KEYWORD_TYPE_EXPECTED',
     message: 'Keyword "required" is expected to be of type "array"',
     path: '#/items/properties[date]/items',
     params: [Object] },
   { [Error: Keyword "required" is expected to be of type "array"]
     code: 'KEYWORD_TYPE_EXPECTED',
     message: 'Keyword "required" is expected to be of type "array"',
     path: '#/items/properties[date]/items/properties[date]',
     params: [Object] },
   { [Error: Keyword "required" is expected to be of type "array"]
     code: 'KEYWORD_TYPE_EXPECTED',
     message: 'Keyword "required" is expected to be of type "array"',
     path: '#/items/properties[date]/items/properties[precision]',
     params: [Object] },
   { [Error: Keyword "required" is expected to be of type "array"]
     code: 'KEYWORD_TYPE_EXPECTED',
     message: 'Keyword "required" is expected to be of type "array"',
     path: '#/items/properties[interpretations]',
     params: [Object] },
   { [Error: Keyword "required" is expected to be of type "array"]
     code: 'KEYWORD_TYPE_EXPECTED',
     message: 'Keyword "required" is expected to be of type "array"',
     path: '#/items/properties[interpretations]/items',
     params: [Object] },
   { [Error: Keyword "required" is expected to be of type "array"]
     code: 'KEYWORD_TYPE_EXPECTED',
     message: 'Keyword "required" is expected to be of type "array"',
     path: '#/items/properties[value]',
     params: [Object] },
   { [Error: Keyword "required" is expected to be of type "array"]
     code: 'KEYWORD_TYPE_EXPECTED',
     message: 'Keyword "required" is expected to be of type "array"',
     path: '#/items/properties[unit]',
     params: [Object] } ],
warnings: [] }

from z-schema.

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.