Skip to content

Commit

Permalink
Support path parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
TimPetricola authored and astahmer committed Nov 22, 2023
1 parent b9b4772 commit 23f3dc3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/tender-snakes-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"typed-openapi": minor
---

Support path parameters
2 changes: 1 addition & 1 deletion packages/typed-openapi/src/map-openapi-endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const mapOpenApiEndpoints = (doc: OpenAPIObject) => {

// Build a list of parameters by type + fill an object with all of them
const lists = { query: [] as ParameterObject[], path: [] as ParameterObject[], header: [] as ParameterObject[] };
const paramObjects = (operation.parameters ?? []).reduce(
const paramObjects = [...(pathItemObj.parameters ?? []), ...(operation.parameters ?? [])].reduce(
(acc, paramOrRef) => {
const param = refs.unwrap(paramOrRef);
const schema = openApiSchemaToTs({ schema: refs.unwrap(param.schema ?? {}), ctx });
Expand Down

0 comments on commit 23f3dc3

Please sign in to comment.