-
Notifications
You must be signed in to change notification settings - Fork 2
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: use schemas only from request body #146
fix: use schemas only from request body #146
Conversation
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.
Thanks for catching this.
A test is absolutely necessary to prevent future changes from accidentally reverting the fix.
Preferably the logic is not duplicated with the code above, since it is exactly the same and only operates on a different part of the spec.
Can I go ahead and implement a test to check if openapi-typescript will build without problems?
Could you comment more about this? |
Yes that would be nice, I thought about extending our current checks against existing repos by running openapi-typescript inside them if they use it. That should at least prevent regressions.
The logic is the same as a few lines above but complex enough that it should not be implemented twice. |
What you think about put this in a separated PR to don't mix with the context of this PR? I understand that tests are very important but would be best separate the scope to merge this fix more quickly. |
Did you have any suggestion to this? This file isn't object oriented, is a point that make the reuse of code a bit complex. To prevent a duplication of code, maybe the both loop could be moved to Helper class. |
Yes, but a simple test for this fix still needs to be added to this fix.
Can be done easily by putting all elements into a single array and then looping over them instead of looping over them separately. |
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.
I had a look at the implementation of Helpers::collectUsedRefs
and since it just walks any array structure recursively it can be used directly instead of iterating over the media types first.
This makes everything a lot simpler.
Signed-off-by: Vitor Mattos <[email protected]> Signed-off-by: provokateurin <[email protected]>
1408162
to
b73c587
Compare
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Scope
Have schemas that only exists at requestBody and at this case, if we don't fetch from body will throw an error "Can't resolve $ref" when run openapi-typescript build.
How to reproduce
Expected behavior
Actual behavior
Artifacts
Without fix
With fix
Tests
Considering that the test only build the json files and not the ts files, I didn't implemented tests.