문제

I am working of JSON Schema Validation. I wanted to know if it is possible to impose number constraints, and if it is possible, how.

For example:

{
    "$schema": "http://json-schema.org/simpleSchema",
    "properties": {
        "birthYear": {
            "type":"number"
        },
        "deathYear": {
            "type":"number"
        },
        "name": {
            "type":"string"
        }
    }
}

I want to do something like this:

birthYear <= deathYear

How can I do this? Is there a specific keyword for constraints like these?

Thank you very much.

João

도움이 되었습니까?

해결책

JSON Schema does not support constraints that refer to other properties.

See 5.1. Validation keywords for numeric instances (number and integer) for what is possible.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top