fix: cast OAS3 schema-typed parameters at runtime#1970
Merged
pmcelhaney merged 2 commits intomainfrom Apr 28, 2026
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix parameter type conversions in OpenAPI spec
fix: cast OAS3 schema-typed parameters at runtime
Apr 28, 2026
pmcelhaney
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OAS3 places parameter types under
parameter.schema.typerather than the OAS2 top-levelparameter.type. The dispatcher'sparameterTypes()only read the OAS2 field, so path/query/header parameters declared OAS3-style were never cast — e.g.$.path.petIdremained"1"(string) instead of1(number).Fix: one-line fallback in
Dispatcher.parameterTypes():Test: new dispatcher test mirrors the existing OAS2 casting test but uses
schema: { type: "integer" }etc. to cover the OAS3 path end-to-end.Original Prompt
When a parameter is not a string per the OpenAPI spec the server should perform type conversions as necessary.
For example when GET /pet/1 is called, $.path.petId should be a number not a string.
Manual acceptance tests
GET /pet/1wherepetIdis declared as OAS3schema: { type: "integer" }—$.path.petIdis the number1, not the string"1"GET /pets?limit=10wherelimitis declared as OAS3schema: { type: "integer" }—$.query.limitis the number10, not"10"schema: { type: "boolean" }with raw value"true"arrives as the booleantruein the handlertype: "integer"path/query/header parameters still cast correctly (regression)Tasks
Dispatcher.parameterTypes()insrc/server/dispatcher.tsto fall back toparameter.schema?.typewhenparameter.typeis absenttest/server/dispatcher.test.tscovering OAS3 schema-typed path, query, and header parameter casting