Search code examples
pythonflaskswaggerconnexion

Error while linking yaml files in connexion


I'm working on custom microservice which will be doing sort of authentication for a web service. Microservice is under development using flask, swagger and connexion. Since swagger.yaml file getting huge(due to load of urls) to reduces the complexity of the file, I tried to break things up.

W/D
├── paths
│   └── users.yml
├── server.sh
├── src
│   ...
└── swagger.yml

In the main swagger file I tried to link the users.yml and the swagger.yml by

paths:
  /users:
    $ref: ./paths/users.yml

So when I ran the project, It gives me this error..

jsonschema.exceptions.RefResolutionError: unknown url type: './paths/users.yml'

What could be the reason for this? Is this problem due to connexion?


Solution

  • Splitting swagger files it's not supported right now in Connexion https://github.com/zalando/connexion/issues/254 . https://github.com/zalando/connexion/issues/254#issuecomment-497194240 you can use prance to merge separate OpenAPI files into one before feeding it into connexion.