Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing some serious features #95

Open
mershal opened this issue Jan 29, 2015 · 3 comments
Open

Missing some serious features #95

mershal opened this issue Jan 29, 2015 · 3 comments

Comments

@mershal
Copy link

mershal commented Jan 29, 2015

I've just started using this package due to the need of custom messages, but unfortunately I'd probably stop using it, because it lacks some features that are critical.

  1. An array of required properties can't be stated inside the object itself, but only inside the property.
    It means that this is schema is not valid
{
    "type": "object",
    "properties": {
        "name": {
            "type": "string"
        },
        "type": {
            "type": "string"
        }
    },
    "required": ["name", "type"]
}

and instead I have to write it like that:

{
    "type": "object",
    "properties": {
        "name": {
            "type": "string",
            "required": true
        },
        "type": {
            "type": "string",
            "required": true
        }
    }
}
  1. anyOf, allOf, oneOf and not are not supported, and are simply ignored, so many of my objects cannot be validated against their schema
@Swaagie
Copy link
Member

Swaagie commented May 20, 2015

  1. I don't really see a problem with writing the required properties inline with the actually property vs the array. This seems more like a personal preference, correct me if I'm wrong
  2. PR's are welcomed

@Marak
Copy link
Contributor

Marak commented May 20, 2015

@mershal -

You might find http://github.com/mschema/mschema a better alternative. It supports the syntax you require.

@seburgi
Copy link

seburgi commented Dec 2, 2015

I think @mershal is right, the JSON schema specification says, that there should be a property "required" in the schema that holds an array of the required properties.

http://json-schema.org/latest/json-schema-validation.html#anchor61

Example:
http://json-schema.org/examples.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants