zod-openapi 5.0.0-beta.18 → 5.0.0-beta.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/dist/api.js +1 -1
- package/dist/api.mjs +1 -1
- package/dist/{components-BqmhtKMD.js → components-BuSFAjHY.js} +4 -1
- package/dist/{components-Cblv9pY1.mjs → components-n2uYApmq.mjs} +4 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -15,6 +15,9 @@ A TypeScript library which uses <a href="https://github.com/colinhacks/zod">Zod<
|
|
|
15
15
|
</div>
|
|
16
16
|
<br>
|
|
17
17
|
|
|
18
|
+
> [!TIP]
|
|
19
|
+
> Zod v4 support is available via `zod-openapi@beta`. Please read the [documentation](https://github.com/samchungy/zod-openapi/blob/v4-stash/docs/v5.md) for more information. A codegen will be available on release to help you migrate if you wish to wait.
|
|
20
|
+
|
|
18
21
|
## Installation
|
|
19
22
|
|
|
20
23
|
Install via `npm`, `yarn`, or `pnpm`:
|
|
@@ -56,7 +59,7 @@ z.string().meta({
|
|
|
56
59
|
Generates an OpenAPI documentation object.
|
|
57
60
|
|
|
58
61
|
```typescript
|
|
59
|
-
import
|
|
62
|
+
import * as z from 'zod/v4';
|
|
60
63
|
import { createDocument } from 'zod-openapi';
|
|
61
64
|
|
|
62
65
|
const jobId = z.string().meta({
|
|
@@ -207,7 +210,7 @@ createDocument(doc, {
|
|
|
207
210
|
Creates an OpenAPI Schema Object along with any registered components. OpenAPI 3.1.0 Schema Objects are fully compatible with JSON Schema.
|
|
208
211
|
|
|
209
212
|
```typescript
|
|
210
|
-
import
|
|
213
|
+
import * as z from 'zod/v4';
|
|
211
214
|
import { createSchema } from 'zod-openapi';
|
|
212
215
|
|
|
213
216
|
const jobId = z.string().meta({
|
package/dist/api.js
CHANGED
package/dist/api.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { createComponents, createRegistry, isAnyZodType, unwrapZodObject } from "./components-
|
|
1
|
+
import { createComponents, createRegistry, isAnyZodType, unwrapZodObject } from "./components-n2uYApmq.mjs";
|
|
2
2
|
|
|
3
3
|
export { createComponents, createRegistry, isAnyZodType, unwrapZodObject };
|
|
@@ -230,7 +230,10 @@ const override = (ctx) => {
|
|
|
230
230
|
const mapping = {};
|
|
231
231
|
for (const [index, obj] of Object.entries(ctx.jsonSchema.oneOf)) {
|
|
232
232
|
const ref = obj.$ref;
|
|
233
|
-
if (!ref)
|
|
233
|
+
if (!ref) {
|
|
234
|
+
delete ctx.jsonSchema.discriminator;
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
234
237
|
const discriminatorValues = def.options[Number(index)]._zod.propValues?.[def.discriminator];
|
|
235
238
|
if (!discriminatorValues?.size) return;
|
|
236
239
|
for (const value of [...discriminatorValues ?? []]) {
|
|
@@ -207,7 +207,10 @@ const override = (ctx) => {
|
|
|
207
207
|
const mapping = {};
|
|
208
208
|
for (const [index, obj] of Object.entries(ctx.jsonSchema.oneOf)) {
|
|
209
209
|
const ref = obj.$ref;
|
|
210
|
-
if (!ref)
|
|
210
|
+
if (!ref) {
|
|
211
|
+
delete ctx.jsonSchema.discriminator;
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
211
214
|
const discriminatorValues = def.options[Number(index)]._zod.propValues?.[def.discriminator];
|
|
212
215
|
if (!discriminatorValues?.size) return;
|
|
213
216
|
for (const value of [...discriminatorValues ?? []]) {
|
package/dist/index.js
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createComponents, createPaths, createRegistry, createSchema } from "./components-
|
|
1
|
+
import { createComponents, createPaths, createRegistry, createSchema } from "./components-n2uYApmq.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/create/document.ts
|
|
4
4
|
const createDocument = (zodOpenApiObject, opts = {}) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zod-openapi",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.19",
|
|
4
4
|
"description": "Convert Zod Schemas to OpenAPI v3.x documentation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"@arethetypeswrong/cli": "0.18.1",
|
|
55
55
|
"@redocly/cli": "1.34.3",
|
|
56
56
|
"@types/node": "22.15.21",
|
|
57
|
+
"eslint-plugin-import-zod": "1.0.3",
|
|
57
58
|
"eslint-plugin-zod-openapi": "2.0.0-beta.1",
|
|
58
59
|
"openapi3-ts": "4.5.0",
|
|
59
60
|
"skuba": "11.0.1",
|