Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json_schema resolve_refs throws a confusing error #1897

Open
MatthiasDurivet opened this issue Mar 14, 2024 · 3 comments
Open

json_schema resolve_refs throws a confusing error #1897

MatthiasDurivet opened this issue Mar 14, 2024 · 3 comments

Comments

@MatthiasDurivet
Copy link
Contributor

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
@eharvey71
Copy link

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

@MatthiasDurivet
Copy link
Contributor Author

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.

@eharvey71
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants