JuliaComputing/OpenAPI.jl

Sparse fields

Opened this issue · 1 comments

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?

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.