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/')
app.add_api('Contato.yaml')
app.run(port=8080)

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

0
Kevin Martins On

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

https://github.com/Yelp/swagger_spec_validator/issues/50

Add in your requirements file:

swagger-spec-validator == 2.4.0

I believe it will solve