- edited description
[MockMvc] [OpenAPI 3.0] Type of enum parameter not picked up when $ref is used
Issue #161
new
I'm experiencing the following problem: if in my open api definition, I have a parameter that refers to an enum, swagger-request-validation
will throw an error like this:
"Unable to parse JSON - Unrecognized token 'ro': was expecting ('true', 'false' or 'null')\n at [Source: (String)\"ro\"; line: 1, column: 5]."
The work-around is to add type explicitly in addition to $ref
which is totally redundant.
Steps to reproduce:
- Declare an endpoint with a (path or query) parameter that refers to an enum from components section. For example, take a look at "Reusable Enums" from https://swagger.io/docs/specification/data-models/enums/
- Try using
openApi().isValid
request matcher in Spring MockMvc test.
example definition (does not work):
parameters:
- in: query
name: color
required: true
schema:
$ref: '#/components/schemas/Color'
example of workaround:
parameters:
- in: query
name: color
required: true
schema:
type: string
$ref: '#/components/schemas/Color'
Comments (1)
-
Account Deactivated reporter - Log in to comment