I am attempting to generate Flask code, using Connexion, from a .yaml file containing OpenAPI 3.0.0 specifications.

When I execute this:

I get

import connexion

app = connexion.App(__name__, specification_dir='swagger/')

and I get this exception:

connexion.exceptions.InvalidSpecification: {'content': {'application/json': {'schema': {'$ref': '#/components/schemas/Contato', 'x-scope': ['']}}}} is not valid under any of the given schemas

Failed validating 'oneOf' in schema['properties']['paths']['patternProperties']['^/']['properties']['get']['properties']['responses']['patternProperties']['^([0-9X]{3})$']:
    {'oneOf': [{'$ref': '#/definitions/response'},
               {'$ref': '#/definitions/reference'}]}

On instance['paths']['/{idContato}']['get']['responses']['200']:
    {'content': {'application/json': {'schema': {'$ref': '#/components/schemas/Contato',
                                                 'x-scope': ['']}}}}

The .yaml file does not include 'x-scope'. Where is this definition coming from? How can I overcome this exception?

1 Answers

Kevin Martins On

I could not reproduce the error, I need more information but I believe this error was corrected in:


Add in your requirements file:

swagger-spec-validator == 2.4.0

I believe it will solve