`oneOf` in path params is causing validation errors when using OAS 3.0
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
The bug is in path parameter handling: lib/openapi_first/validators/request_parameters.rb around line 15 receives the path as a string when the schema uses oneOf, but as an integer when it uses type: integer. Start by reproducing with the spec in the issue and checking how the path value is coerced before validation. Done means GET /accounts/1 passes for a oneOf integer/enum path parameter, with a regression test added to the request validation specs.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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: integer
The following schema does not give a validation error:
type: integer
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.
- Lingua principale
- Ruby
- Stelle
- 222
- Fork
- 27
- Merge medio
- 17h 15m
- PR unite (30g)
- 6
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ahx/openapi_first
-
Multipart file uploads fail validation with ActionDispatch::Request (UploadedFile isn't a Hash)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ahx/openapi_first#516 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
ahx/openapi_first#484 · 4 commenti · 1 reazione ·
-
OpenAPI 3.2 supportForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertaenhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
ahx/openapi_first#469 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 12/100
ahx/openapi_first#425 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
ahx/openapi_first#418 · 1 commento · 1 reazione ·
Tutte le issue di ahx/openapi_first
Issue simili
-
Bug Ruby
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
getsentry/sentry-ruby#3211 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
internetee/registry#2984 ·
I maintainer di solito rispondono entro 6 giorni
-
interest-zsv
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
hitobito/hitobito_zsv#6 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
ecosyste-ms/issues#862 ·
I maintainer di solito rispondono entro 1 giorno
-
Redis Lua error `@user_script:52: ERR value is not an integer or out of range` when `window_size` is configuredForse già presa @mimosa l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno