-
Notifications
You must be signed in to change notification settings - Fork 23
oneOf in path params is causing validation errors #458
Copy link
Copy link
Open
Description
I have the following spec:
openapi: 3.0.1
paths:
/accounts/{id}:
get:
operationId: getAccountId
summary: Get the details of an account
parameters:
- name: id
in: path
required: true
schema:
oneOf:
- type: integer
- type: string
enum: [current]When validating e.g. GET /accounts/1 request, I get an Path segment is invalid: value at '/id' is not an integer. value at '/id' is not one of: ["current"] error.
The following schema for the path parameter already reproduces the issue:
oneOf:
- type: integerThe following schema does not give a validation error:
type: integerThe parsed_request in /lib/openapi_first/validators/request_parameters.rb:15 in the case of a schema using oneOf:
#<data OpenapiFirst::ParsedRequest path={"id"=>"1"}, ...>, without oneOf: #<data OpenapiFirst::ParsedRequest path={"id"=>1}, ...>, that could cause the path param to be invalid.
I believe the spec above using the schema with the oneOf is valid and should not give validation errors for requests like GET /accounts/1.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels