-
Notifications
You must be signed in to change notification settings - Fork 10
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 set_param #68
fix set_param #68
Conversation
Could you give some more context, regarding what is the issue you faced? |
Hi @tanmaykm , sorry for the delayed response. Here comes some more context. The current implementation of I do not know if there is an official way to handle For the particular function linked above, and this code example:
The resulting query string is given by the code before this pr as (see the
which gives 400 Bad Request Error. Whereas, with the changes proposed here, the resulting query string is:
which works. |
On second thought I am a bit unsure about the '$(name).' prefix I think it is specific to my case and not general (i.e. that prefix should be put explicitly into the input dict). |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #68 +/- ##
==========================================
- Coverage 81.74% 80.63% -1.11%
==========================================
Files 7 6 -1
Lines 619 594 -25
==========================================
- Hits 506 479 -27
- Misses 113 115 +2 ☔ View full report in Codecov by Sentry. |
I think what you describe fits into the The specification mentions this format though to serialize |
Dear @tanmaykm , I don't think that is right. The spec I used in my example does not specify style (https://github.com/jonalm/BenchlingRestApi.jl/blob/0294435467c1d57124d2d85956d383839fc3dd21/openapi.yaml#L26129) and should default to AFAIU the query parameters in an object (i.e. Dict in the julia generated code) should expand into ampersand (or comma) separated "key=value" elements (i.e. as the rightmost column of the first row in the table example under "Query Parameters" in the link you provided https://swagger.io/docs/specification/serialization/). This is what this PR fixes. |
Yes, thanks for pointing out. I would like to leave a little comment in the code there to remind ourselves of what was done. |
Also, do you intend to also add support for parsing back the same on the server side in this PR? Or add support for more formats? Happy to merge it as it is though, if you need only this much for your specific case. |
Co-authored-by: Tanmay Mohapatra <[email protected]>
Thanks @tanmaykm, it would be great if you could merge this minimal PR, even though it only contains a minor improvement. I figured this out by reverse engineering, and I have no prior expericence with OpenAPI so I wouldn't know where to start on the server side implementation. I would be happy to contribute to more formats at a later stage, but I would need to grok the test setup first. How easy is it to create a minimal OpenAPI spec, simulate a server and test the generated code? |
Sure! The CI I think was failing because of an unrelated issue, which I've fixed in master. Let's merge this one and also tag a release soon after. There are some example specs and their client and server implementations in the test code, maybe those can serve as examples for writing new ones. Please feel free to ping me whenever you are planning to contribute next time. |
Version v0.1.22 is now registered (JuliaRegistries/General#102908). |
I do not know how this is indended to work, so I don't know if this fix is general or only works in my case.