KaiZen-OpenAPI-Editor icon indicating copy to clipboard operation
KaiZen-OpenAPI-Editor copied to clipboard

oneOf Schema Violations: name contained properties and elements that failed validation

Open tedepstein opened this issue 9 years ago • 0 comments

This is another way to improve the validation error message for oneOf schema validations: #60 contains an example of a Swagger spec with a oneOf schema violation, and also includes the returned Error Report object. Within the hierarchy, there are some nested report objects whose instance is a property within the root context. For example:

                  {
                    "level": "error",
                    "schema": {
                      "loadingURI": "http://swagger.io/v2/schema.json#",
                      "pointer": "/definitions/headerParameterSubSchema/properties/in"
                    },
                    "instance": {
                      "pointer": "/paths/~1taxFilings~1{id}/put/parameters/0/in"
                    },
                    "domain": "validation",
                    "keyword": "enum",
                    "message": "instance value (\"body\") not found in enum (possible values: [\"header\"])",
                    "value": "body",
                    "enum": [
                      "header"
                    ]
                  }

I assume the same thing can happen when nested array elements fail validation.

In these cases, our error message should identify the contained object that failed the validation.

tedepstein avatar Jan 23 '16 16:01 tedepstein