-
Notifications
You must be signed in to change notification settings - Fork 479
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
fix: Don't URI encode schema keys when using $ref #1468
fix: Don't URI encode schema keys when using $ref #1468
Conversation
This fixes an isssue where using `$` in type names leads to invalid OpenAPI specs. This would happen because the `refName` property that is used as the object key for refs and to create `$ref` attributes is URI encoded on creation, when it only needs to be URI encoded when used in a `$ref` attribute. Fixes lukeautry#1461 Signed-off-by: Lucian Buzzo <lucian.buzzo@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello there LucianBuzzo 👋
Thank you and congrats 🎉 for opening your first PR on this project.✨
We will review the following PR soon! 👀
Does this only affect the OpenAPI v2 generator? I think we should be consistent and also adapt the OpenAPI v3 Spec Generator. |
That said, I think #1469 would also address this. I'm not sure if you can URI Encode the ref value, but use the unencoded name as the components/definition key, is that specified somewhere? |
@WoH I updated my PR to also fix the problem for the v3 generator. AFAICT, what happens is that when the |
LGTM |
Is the PR merged to version 5.1.1? |
@amrbahaa360 It looks like v5.1.1 was released in February, which won't include this change. A new version needs to be released. @WoH would you be able to cut a new version that includes this fix? v5.1.2 perhaps? |
Awesome thanks @WoH ! |
This fixes an isssue where using
$
in type names leads to invalid OpenAPI specs. This would happen because therefName
property that is used as the object key for refs and to create$ref
attributes is URI encoded on creation, when it only needs to be URI encoded when used in a$ref
attribute.Fixes #1461
Test plan
I had a hard time configuring a unit test to check this behaviour, if anyone can provide some guidance on how to do it please let me know, as the test cases in this repo are hard to follow.