You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34-1Lines changed: 34 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -123,7 +123,11 @@ It has three overloads:
123
123
124
124
For this to work, you need to call `extendZodWithOpenApi` once in your project.
125
125
126
-
Note: This should be done only once in a common-entrypoint file of your project (for example an `index.ts`/`app.ts`). If you're using tree-shaking with Webpack, mark that file as having side-effects.
126
+
This should be done only once in a common-entrypoint file of your project (for example an `index.ts`/`app.ts`). If you're using tree-shaking with Webpack, mark that file as having side-effects.
127
+
128
+
It can be bit tricky to achieve this in your codebase, because *require* is synchronous and *import* is a async.
129
+
130
+
### The basic idea
127
131
128
132
```ts
129
133
import { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
The `OpenAPIRegistry` is a utility that can be used to collect definitions which would later be passed to a `OpenApiGeneratorV3` or `OpenApiGeneratorV31` instance.
0 commit comments