generated from stijnvanhulle/template
-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Zod generated types for all parameters as optional is missing .o…
…ptional() method call on root object
- Loading branch information
1 parent
2c20339
commit f343fbb
Showing
60 changed files
with
309 additions
and
156 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@kubb/swagger-zodios": patch | ||
"@kubb/swagger-zod": patch | ||
"@kubb/swagger": patch | ||
--- | ||
|
||
Zod generated types for all parameters as optional is missing .optional() method call on root object |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"openapi": "3.0.3", | ||
"info": { | ||
"title": "test", | ||
"description": "", | ||
"license": { | ||
"name": "" | ||
}, | ||
"version": "0.1.0" | ||
}, | ||
"paths": { | ||
"/test": { | ||
"get": { | ||
"tags": ["test"], | ||
"operationId": "SomeName", | ||
"summary": "", | ||
"description": "Some description", | ||
"parameters": [ | ||
{ | ||
"name": "foo", | ||
"required": false, | ||
"in": "query", | ||
"schema": { "minimum": 1, "format": "int32", "default": 1, "type": "integer" } | ||
}, | ||
{ | ||
"name": "baz", | ||
"required": false, | ||
"in": "query", | ||
"schema": { "minimum": 1, "format": "int32", "default": 10, "type": "integer" } | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { z } from 'zod' | ||
|
||
export const apiResponseSchema = z.object({ 'code': z.number().optional(), 'type': z.string().optional(), 'message': z.string().optional() }) | ||
export const apiResponseSchema = z.object({ 'code': z.number().optional(), 'type': z.string().optional(), 'message': z.string().optional() }).optional() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { z } from 'zod' | ||
|
||
export const categorySchema = z.object({ 'id': z.number().optional(), 'name': z.string().optional() }) | ||
export const categorySchema = z.object({ 'id': z.number().optional(), 'name': z.string().optional() }).optional() |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { z } from 'zod' | ||
|
||
export const petNotFoundSchema = z.object({ 'code': z.number().optional(), 'message': z.string().optional() }) | ||
export const petNotFoundSchema = z.object({ 'code': z.number().optional(), 'message': z.string().optional() }).optional() |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { z } from 'zod' | ||
|
||
export const tagSchema = z.object({ 'id': z.number().optional(), 'name': z.string().optional() }) | ||
export const tagSchema = z.object({ 'id': z.number().optional(), 'name': z.string().optional() }).optional() |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { z } from 'zod' | ||
|
||
export const addressSchema = z.object({ street: z.string().optional(), city: z.string().optional(), state: z.string().optional(), zip: z.string().optional() }) | ||
export const addressSchema = z | ||
.object({ street: z.string().optional(), city: z.string().optional(), state: z.string().optional(), zip: z.string().optional() }) | ||
.optional() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { z } from 'zod' | ||
|
||
export const apiResponseSchema = z.object({ code: z.number().optional(), type: z.string().optional(), message: z.string().optional() }) | ||
export const apiResponseSchema = z.object({ code: z.number().optional(), type: z.string().optional(), message: z.string().optional() }).optional() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { z } from 'zod' | ||
|
||
export const categorySchema = z.object({ id: z.number().optional(), name: z.string().optional() }) | ||
export const categorySchema = z.object({ id: z.number().optional(), name: z.string().optional() }).optional() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
import { addressSchema } from './addressSchema' | ||
import { z } from 'zod' | ||
|
||
export const customerSchema = z.object({ id: z.number().optional(), username: z.string().optional(), address: z.array(z.lazy(() => addressSchema)).optional() }) | ||
export const customerSchema = z | ||
.object({ id: z.number().optional(), username: z.string().optional(), address: z.array(z.lazy(() => addressSchema)).optional() }) | ||
.optional() |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
import { z } from 'zod' | ||
|
||
export const orderSchema = z.object({ | ||
id: z.number().optional(), | ||
petId: z.number().optional(), | ||
quantity: z.number().optional(), | ||
shipDate: z.string().datetime().optional(), | ||
status: z.enum([`placed`, `approved`, `delivered`]).describe(`Order Status`).optional(), | ||
http_status: z | ||
.union([z.literal(200), z.literal(400), z.literal(500)]) | ||
.describe(`HTTP Status`) | ||
.optional(), | ||
complete: z.boolean().optional(), | ||
}) | ||
export const orderSchema = z | ||
.object({ | ||
id: z.number().optional(), | ||
petId: z.number().optional(), | ||
quantity: z.number().optional(), | ||
shipDate: z.string().datetime().optional(), | ||
status: z.enum([`placed`, `approved`, `delivered`]).describe(`Order Status`).optional(), | ||
http_status: z | ||
.union([z.literal(200), z.literal(400), z.literal(500)]) | ||
.describe(`HTTP Status`) | ||
.optional(), | ||
complete: z.boolean().optional(), | ||
}) | ||
.optional() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { z } from 'zod' | ||
|
||
export const petNotFoundSchema = z.object({ code: z.number().optional(), message: z.string().optional() }) | ||
export const petNotFoundSchema = z.object({ code: z.number().optional(), message: z.string().optional() }).optional() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { z } from 'zod' | ||
|
||
export const tagSchema = z.object({ id: z.number().optional(), name: z.string().optional() }) | ||
export const tagSchema = z.object({ id: z.number().optional(), name: z.string().optional() }).optional() |
Oops, something went wrong.