Open matheuscamarques opened 7 months ago
Hey, I'm not a maintainer but I have had an issue that might be useful to your use case as well, it depends on how you want your query params to look like:
1.?page[limit]=1&page[before]=token&filter[status_not]=done
solution is something like:
parameter(
:page,
:query,
%Schema{
type: :object,
properties: %{
limit: %Schema{type: :integer, default: 20},
before: %Schema{type: :string}},
after: %Schema{type: :string}}
},
"Page params",
required: true
),
parameter(
:filter,
:query,
%Schema{
....
?limit=10&before=token&status_not=done
in this case you want to specify that your parameter is
explode: true
like this:parameter(
:some,
:query,
%Schema{
type: :object,
oneOf: [
%Schema{
type: :object,
properties: %{foo: %Schema{type: :string}, bar: %Schema{type: :string}},
required: [:foo]
},
%Schema{
type: :object,
properties: %{foo: %Schema{type: :string}, baz: %Schema{type: :string}},
required: [:baz]
}
]
},
"Some query parameter ",
explode: true,
style: :form,
required: true
)
The 2nd approach currently does not work but there is a pending PR
How can I do it when a parameter (in: query) is composed
example