Fix TypeError when OpenAPI Path Item Object contains non-HTTP-verb fields#1843
Merged
pmcelhaney merged 3 commits intomainfrom Apr 13, 2026
Merged
Fix TypeError when OpenAPI Path Item Object contains non-HTTP-verb fields#1843pmcelhaney merged 3 commits intomainfrom
pmcelhaney merged 3 commits intomainfrom
Conversation
Copilot
AI
changed the title
[WIP] Fix TypeError for non-HTTP-verb fields in path item objects
Fix TypeError when OpenAPI Path Item Object contains non-HTTP-verb fields
Apr 13, 2026
pmcelhaney
approved these changes
Apr 13, 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
Path Item Objects that include
summary,description,servers, orparametersfields (all valid per the OpenAPI spec) caused aTypeError: Cannot use 'in' operator to search for 'operationId' in <string>during code generation. The generator was blindly iterating all keys of a path item and passing each value toOperationCoder, which expects an operation object — not a string or array.Original Prompt
Bug: Non-HTTP-Verbs (like Summary/Description) for a Path Item Object Field lead to TypeError
Using an OpenAPI spec with
summaryordescriptionat the path level (e.g.paths./test.summary: "Test Summary") causes:All fields in a path item are assumed to be HTTP operation objects, but the OpenAPI Path Item Object spec explicitly allows
summary,description,servers, andparameters.Manual acceptance tests
summaryanddescriptionon a path item starts counterfact without a TypeErrorGET /test) are generated and respond correctlyparametersandserversfields also do not cause errorsTasks
src/typescript-generator/generate.ts— Added anHTTP_VERBSset (get,put,post,delete,options,head,patch,trace) and guard inpathDefinition.forEachto skip non-verb keys:test/typescript-generator/generate.test.ts— Added regression test: spec with path-levelsummary+descriptionresolves without throwing and generates the expected route file.changeset/fix-path-item-non-http-verb-fields.md— Patch-level changeset entry