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:
The following schema does not give a validation error:
The 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.
I have the following spec:
When validating e.g.
GET /accounts/1request, I get anPath 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:
The following schema does not give a validation error:
The
parsed_requestin/lib/openapi_first/validators/request_parameters.rb:15in the case of a schema usingoneOf:#<data OpenapiFirst::ParsedRequest path={"id"=>"1"}, ...>, withoutoneOf:#<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
oneOfis valid and should not give validation errors for requests likeGET /accounts/1.