Skip to content

Failed validating 'oneOf' in schema['properties']['paths']['patternProperties']['^\\/']['patternProperties']['^(get|put|post|delete|options|head|patch|trace)$']['properties']['parameters']['items']: #116

Description

@spaceone

I get:

{'in': 'query', 'name': 'bar', 'example': '1', 'examples': {'1': {'summary': '1', 'value': '1'}, '2': {'summary': '2', 'value': '2'}}, 'schema': {'type': 'string'}} is not valid under any of the given schemas

Failed validating 'oneOf' in schema['properties']['paths']['patternProperties']['^\\/']['patternProperties']['^(get|put|post|delete|options|head|patch|trace)$']['properties']['parameters']['items']:
    {'oneOf': [{'$ref': '#/definitions/Parameter'},
               {'$ref': '#/definitions/Reference'}]}

On instance['paths']['/']['get']['parameters'][0]:
    {'$ref': '#/components/parameters/foo',
     'x-scope': ['file:///usr/share/ucs-test/73_udm-rest/openapi2.json']}

for

{
    "components": {
        "parameters": {
            "foo": {
                "in": "query",
                "name": "bar",
                "example": "1",
                "examples": {
                    "1": {
                        "summary": "1",
                        "value": "1"
                    },
                    "2": {
                        "summary": "2",
                        "value": "2"
                    }
                },
                "schema": {
                    "type": "string"
                }
            }
        }
    },
    "info": {
        "description": "",
        "title": "",
        "version": "1.0.0"
    },
    "openapi": "3.0.0",
    "paths": {
       "/": {
            "get": {
                "parameters": [
                    {
                        "$ref": "#/components/parameters/foo"
                    }
                ],
                "responses": { "200": {"description": "", "content": {"text/plain": {"schema": {"type": "string"}}}} }
            }
        }
    }
}

since openapi-spec-validator==0.3.0. It succeeded to validate with openapi-spec-validator==0.2.10.
If I remove one of example or examples from #/components/parameters/foo the validation succeeds.

Does openapi define them as mutually exclusive?
https://swagger.io/docs/specification/adding-examples/ doesn't seem to contain a mix. The swagger UI just sucks in displaying examples.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions