Skip to content

Commit

Permalink
chore: make endpointDefinitionRefiner to receive final fields that ar…
Browse files Browse the repository at this point in the history
…e going to be used in handlebars
  • Loading branch information
imballinst authored and astahmer committed Nov 3, 2023
1 parent 3bf2bd8 commit 81efd49
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/little-shirts-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"openapi-zod-client": patch
---

chore: make endpointDefinitionRefiner to receive final fields that are going to be used in handlebars
12 changes: 6 additions & 6 deletions lib/src/getZodiosEndpointDefinitionList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,6 @@ export const getZodiosEndpointDefinitionList = (doc: OpenAPIObject, options?: Te
response: "",
};

if (options?.endpointDefinitionRefiner) {
// Refine the endpoint definition, in case consumer wants to add some specific fields
// to be rendered in the Handlebars template.
endpointDefinition = options.endpointDefinitionRefiner(endpointDefinition, operation);
}

if (operation.requestBody) {
const requestBody = (
isReferenceObject(operation.requestBody)
Expand Down Expand Up @@ -389,6 +383,12 @@ export const getZodiosEndpointDefinitionList = (doc: OpenAPIObject, options?: Te
endpointDefinition.response = voidSchema;
}

if (options?.endpointDefinitionRefiner) {
// Refine the endpoint definition, in case consumer wants to add some specific fields
// to be rendered in the Handlebars template.
endpointDefinition = options.endpointDefinitionRefiner(endpointDefinition, operation);
}

endpoints.push(endpointDefinition);
}
}
Expand Down

1 comment on commit 81efd49

@vercel
Copy link

@vercel vercel bot commented on 81efd49 Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.