spec-first/connexion

`json_schema` `resolve_refs` throws a confusing error

MatthiasDurivet opened this issue · 3 comments

Description

I had accidentally put $ref: "string" instead of type: string in my openapi.yaml.
This resulted in the confusing error No such file or directory: '/my/local/directory/configs/string'

Expected behaviour

I would have liked a clear error message that instructed me to take a look at my openapi.yaml.

Actual behaviour

Instead I went on a deep dive to follow the logic to see where "openapi.yaml" got turned into string.
I though it was likely that some package had been updated and some bug replaced the actual filename with type(filename), resulting in string.

Steps to reproduce

Create a connexion app and include $ref: "string" in your openapi.yaml file.
I believe it doesn't really matter where or how since everything get recursively parsed/resolved.
I'm using spec version 3.0.3

Additional info:

Output of the commands:

  • python --version
    Python 3.11.8
    Also occurs on 3.10, probably not related to python version.
  • pip show connexion | grep "^Version\:"
    Version: 3.0.6

Greetings, are you still having this issue? I just opened a separate issue that seems related: #1909

Hi, I logged this as an issue but never looked back.
In my case just knowing that the error message is confusing and that I was doing something wrong in my api-specification was enough to continue working.

If you're curious you should be able to replicate my issue and check if it still exists.
My guess would be that this has not been improved yet.

Apologies, I didn't read this one well enough. Makes complete sense now. Thanks!