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

Sparse fields #26

Open
jaakkor2 opened this issue May 6, 2023 · 1 comment
Open

Sparse fields #26

jaakkor2 opened this issue May 6, 2023 · 1 comment

Comments

@jaakkor2
Copy link

jaakkor2 commented May 6, 2023

Code generated by https://github.com/OpenAPITools/openapi-generator julia-client generates code like this

OpenAPI.Clients.set_param(_ctx.query, "fields", fields)  # type SparseFields

but I cannot set the fields in the interface to produce a query like this in https://jsonapi.org/format/#fetching-sparse-fieldsets (uudecoded)

GET /articles?include=author&fields[articles]=title,body&fields[people]=name HTTP/1.1

do_request-function https://github.com/JuliaComputing/OpenAPI.jl/blob/v0.1.9/src/client.jl#L331-L343 does not seem to handle sparse fields? What should the fields argument above for the set_param be to produce correctly formed request?

@tanmaykm
Copy link
Member

These are what the OpenAPI specification mentions as the deepObject style of passing query parameters. Unfortunately OpenAPI.jl does not support deepObject yet. Contributions to add missing features are welcome!

One way to work around this could possibly to use a pre_request_hook with the client, which could somehow recreate the query string based on the value.

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