...

Text file src/github.com/go-openapi/validate/fixtures/jsonschema_suite/additionalProperties.json

Documentation: github.com/go-openapi/validate/fixtures/jsonschema_suite

     1[
     2    {
     3        "description":
     4            "additionalProperties being false does not allow other properties",
     5        "schema": {
     6            "properties": {"foo": {}, "bar": {}},
     7            "patternProperties": { "^v": {} },
     8            "additionalProperties": false
     9        },
    10        "tests": [
    11            {
    12                "description": "no additional properties is valid",
    13                "data": {"foo": 1},
    14                "valid": true
    15            },
    16            {
    17                "description": "an additional property is invalid",
    18                "data": {"foo" : 1, "bar" : 2, "quux" : "boom"},
    19                "valid": false
    20            },
    21            {
    22                "description": "ignores arrays",
    23                "data": [1, 2, 3],
    24                "valid": true
    25            },
    26            {
    27                "description": "ignores strings",
    28                "data": "foobarbaz",
    29                "valid": true
    30            },
    31            {
    32                "description": "ignores other non-objects",
    33                "data": 12,
    34                "valid": true
    35            },
    36            {
    37                "description": "patternProperties are not additional properties",
    38                "data": {"foo":1, "vroom": 2},
    39                "valid": true
    40            }
    41        ]
    42    },
    43    {
    44        "description":
    45            "additionalProperties allows a schema which should validate",
    46        "schema": {
    47            "properties": {"foo": {}, "bar": {}},
    48            "additionalProperties": {"type": "boolean"}
    49        },
    50        "tests": [
    51            {
    52                "description": "no additional properties is valid",
    53                "data": {"foo": 1},
    54                "valid": true
    55            },
    56            {
    57                "description": "an additional valid property is valid",
    58                "data": {"foo" : 1, "bar" : 2, "quux" : true},
    59                "valid": true
    60            },
    61            {
    62                "description": "an additional invalid property is invalid",
    63                "data": {"foo" : 1, "bar" : 2, "quux" : 12},
    64                "valid": false
    65            }
    66        ]
    67    },
    68    {
    69        "description":
    70            "additionalProperties can exist by itself",
    71        "schema": {
    72            "additionalProperties": {"type": "boolean"}
    73        },
    74        "tests": [
    75            {
    76                "description": "an additional valid property is valid",
    77                "data": {"foo" : true},
    78                "valid": true
    79            },
    80            {
    81                "description": "an additional invalid property is invalid",
    82                "data": {"foo" : 1},
    83                "valid": false
    84            }
    85        ]
    86    },
    87    {
    88        "description": "additionalProperties are allowed by default",
    89        "schema": {"properties": {"foo": {}, "bar": {}}},
    90        "tests": [
    91            {
    92                "description": "additional properties are allowed",
    93                "data": {"foo": 1, "bar": 2, "quux": true},
    94                "valid": true
    95            }
    96        ]
    97    }
    98]

View as plain text