fix(openapi): accept array examples for array-typed query parameters #10744
+197
−12
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.
Description
Fixes the OpenAPI IR parser to properly handle array-typed query parameters. Previously, the parser would log debug warnings like
Expected a primitive example but got array for query parameter tipMode for GET /paymentswhen encountering array-typed query parameters with array examples.Link to Devin run: https://app.devin.ai/sessions/3a4e6565484443fcb082bfd5a8ba00d1
Requested by: Deep Singhvi ([email protected]) / @dsinghvi
Changes Made
getResolvedSchema()to properly unwrap optional/nullable/reference wrappers to determine the underlying schema typeisExamplePrimitive()where the unknown case was recursing on the same value instead of inspectingexample.valueKey Implementation Details
The fix aligns with the existing IR-to-Fern conversion in
buildQueryParameter.ts, which already handles array query parameters via theallowMultipleflag. When a query parameter has an array schema, the IR-to-Fern layer unwraps it to the item type and setsallowMultiple: true, allowing multiple values to be passed (e.g.,?status=pending&status=active).Testing
Review Checklist
Important areas to review:
buildQueryParameter.tsactually handles array query parameters correctly viaallowMultiple(assumption made but not explicitly tested)