Ask questionsWrong value range for string type as QUERY parameter
@Parameter( in = QUERY, style = SIMPLE, name = "title", description = "Search for a title with a left and right wildcard" )
consumed in the controller as
final @RequestParam(name = "title", required = false) String title,
with the openAPI description
parameters: - name: "title" in: "query" description: "Search for a title with a left and right wildcard" required: false style: "simple" schema: type: "string"
title string Search for a title with a left and right wildcard Comma Separated Values
There is no reason it should be an
Comma Separated Values right?
Answer questions philsturgeon
If you look at 188.8.131.52 Style Values you will see those style values only apply to particular types. Primitive is shorthand for string, integer, bool, and if you see next to simple I’d say array. This means an array should actually be treated like a string, which in OAS3.x means CSV yeah.
I don’t really consider this a bug but we could harden against this unexpected usage. I’m not sure why type: string would be defined with simple, it doesn’t need it at all, but we should treat it like a noop.
Can we generally toughen our style logic to only apply it to types that the OAS spec defines as being relevant, and ignore any that are not relevant?
Bonus points if we can get spectral to point out irrelevant usage of styles too?
-- Phil Sturgeon Product @ Stoplight.io
On Jul 28, 2021, at 10:19, Eugen Mayer ***@***.***> wrote:
@mallachari thank you. your last part is exactly what needs to probably be discussed - right now with 'simple' you basically combine two different display methods of the same, which do not merge.
I understand that this is somewhat a miss-configuration, using simple and then defining the format manually.
I'm fine with both - let it be known I never was able to find https://spec.openapis.org/oas/latest.html#style-examples for this case to understand that this is the cause. It was debugging, try and error, and reducing until I found the cause. So maybe it is me, or it is not as simple for others to back-trace the problem to this.
You guys decide :)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Related questionsNo questions were found.