-
Notifications
You must be signed in to change notification settings - Fork 1
Relax default type for response schemas #733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -65,9 +65,9 @@ export type PayloadRouteDefinition< | |||||||||||||||
| RequestHeaderSchema extends z.Schema | undefined = undefined, | ||||||||||||||||
| IsNonJSONResponseExpected extends boolean = false, | ||||||||||||||||
| IsEmptyResponseExpected extends boolean = false, | ||||||||||||||||
| ResponseSchemasByStatusCode extends | ||||||||||||||||
| | Partial<Record<HttpStatusCode, z.Schema>> | ||||||||||||||||
| | undefined = undefined, | ||||||||||||||||
| ResponseSchemasByStatusCode extends Partial<Record<HttpStatusCode, z.Schema>> | undefined = | ||||||||||||||||
| | Record<HttpStatusCode, z.Schema> | ||||||||||||||||
| | undefined, | ||||||||||||||||
| > = CommonRouteDefinition< | ||||||||||||||||
| SuccessResponseBodySchema, | ||||||||||||||||
| PathParamsSchema, | ||||||||||||||||
|
|
@@ -88,9 +88,9 @@ export type GetRouteDefinition< | |||||||||||||||
| RequestHeaderSchema extends z.Schema | undefined = undefined, | ||||||||||||||||
| IsNonJSONResponseExpected extends boolean = false, | ||||||||||||||||
| IsEmptyResponseExpected extends boolean = false, | ||||||||||||||||
| ResponseSchemasByStatusCode extends | ||||||||||||||||
| | Partial<Record<HttpStatusCode, z.Schema>> | ||||||||||||||||
| | undefined = undefined, | ||||||||||||||||
| ResponseSchemasByStatusCode extends Partial<Record<HttpStatusCode, z.Schema>> | undefined = | ||||||||||||||||
| | Record<HttpStatusCode, z.Schema> | ||||||||||||||||
| | undefined, | ||||||||||||||||
| > = CommonRouteDefinition< | ||||||||||||||||
|
Comment on lines
+91
to
94
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same issue in GetRouteDefinition default Defaulting to - ResponseSchemasByStatusCode extends Partial<Record<HttpStatusCode, z.Schema>> | undefined =
- | Record<HttpStatusCode, z.Schema>
- | undefined,
+ ResponseSchemasByStatusCode extends Partial<Record<HttpStatusCode, z.Schema>> | undefined =
+ Partial<Record<HttpStatusCode, z.Schema>> | undefined,📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
| SuccessResponseBodySchema, | ||||||||||||||||
| PathParamsSchema, | ||||||||||||||||
|
|
@@ -110,9 +110,9 @@ export type DeleteRouteDefinition< | |||||||||||||||
| RequestHeaderSchema extends z.Schema | undefined = undefined, | ||||||||||||||||
| IsNonJSONResponseExpected extends boolean = false, | ||||||||||||||||
| IsEmptyResponseExpected extends boolean = true, | ||||||||||||||||
| ResponseSchemasByStatusCode extends | ||||||||||||||||
| | Partial<Record<HttpStatusCode, z.Schema>> | ||||||||||||||||
| | undefined = undefined, | ||||||||||||||||
| ResponseSchemasByStatusCode extends Partial<Record<HttpStatusCode, z.Schema>> | undefined = | ||||||||||||||||
| | Record<HttpStatusCode, z.Schema> | ||||||||||||||||
| | undefined, | ||||||||||||||||
| > = CommonRouteDefinition< | ||||||||||||||||
|
Comment on lines
+113
to
116
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same issue in DeleteRouteDefinition default Align default with the relaxed intent so partials work out of the box. - ResponseSchemasByStatusCode extends Partial<Record<HttpStatusCode, z.Schema>> | undefined =
- | Record<HttpStatusCode, z.Schema>
- | undefined,
+ ResponseSchemasByStatusCode extends Partial<Record<HttpStatusCode, z.Schema>> | undefined =
+ Partial<Record<HttpStatusCode, z.Schema>> | undefined,📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
| SuccessResponseBodySchema, | ||||||||||||||||
| PathParamsSchema, | ||||||||||||||||
|
|
@@ -133,9 +133,9 @@ export function buildPayloadRoute< | |||||||||||||||
| RequestHeaderSchema extends z.Schema | undefined = undefined, | ||||||||||||||||
| IsNonJSONResponseExpected extends boolean = false, | ||||||||||||||||
| IsEmptyResponseExpected extends boolean = false, | ||||||||||||||||
| ResponseSchemasByStatusCode extends | ||||||||||||||||
| | Partial<Record<HttpStatusCode, z.Schema>> | ||||||||||||||||
| | undefined = undefined, | ||||||||||||||||
| ResponseSchemasByStatusCode extends Partial<Record<HttpStatusCode, z.Schema>> | undefined = | ||||||||||||||||
| | Record<HttpStatusCode, z.Schema> | ||||||||||||||||
| | undefined, | ||||||||||||||||
| >( | ||||||||||||||||
|
Comment on lines
+136
to
139
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Builder: buildPayloadRoute default also too strict Mirror the fix here so callers can pass partial maps without specifying generics. - ResponseSchemasByStatusCode extends Partial<Record<HttpStatusCode, z.Schema>> | undefined =
- | Record<HttpStatusCode, z.Schema>
- | undefined,
+ ResponseSchemasByStatusCode extends Partial<Record<HttpStatusCode, z.Schema>> | undefined =
+ Partial<Record<HttpStatusCode, z.Schema>> | undefined,📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
| params: PayloadRouteDefinition< | ||||||||||||||||
| RequestBodySchema, | ||||||||||||||||
|
|
@@ -183,9 +183,9 @@ export function buildGetRoute< | |||||||||||||||
| RequestHeaderSchema extends z.Schema | undefined = undefined, | ||||||||||||||||
| IsNonJSONResponseExpected extends boolean = false, | ||||||||||||||||
| IsEmptyResponseExpected extends boolean = false, | ||||||||||||||||
| ResponseSchemasByStatusCode extends | ||||||||||||||||
| | Partial<Record<HttpStatusCode, z.Schema>> | ||||||||||||||||
| | undefined = undefined, | ||||||||||||||||
| ResponseSchemasByStatusCode extends Partial<Record<HttpStatusCode, z.Schema>> | undefined = | ||||||||||||||||
| | Record<HttpStatusCode, z.Schema> | ||||||||||||||||
| | undefined, | ||||||||||||||||
| >( | ||||||||||||||||
|
Comment on lines
+186
to
189
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Builder: buildGetRoute default too strict Default should be - ResponseSchemasByStatusCode extends Partial<Record<HttpStatusCode, z.Schema>> | undefined =
- | Record<HttpStatusCode, z.Schema>
- | undefined,
+ ResponseSchemasByStatusCode extends Partial<Record<HttpStatusCode, z.Schema>> | undefined =
+ Partial<Record<HttpStatusCode, z.Schema>> | undefined,📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
| params: Omit< | ||||||||||||||||
| GetRouteDefinition< | ||||||||||||||||
|
|
@@ -233,9 +233,9 @@ export function buildDeleteRoute< | |||||||||||||||
| RequestHeaderSchema extends z.Schema | undefined = undefined, | ||||||||||||||||
| IsNonJSONResponseExpected extends boolean = false, | ||||||||||||||||
| IsEmptyResponseExpected extends boolean = true, | ||||||||||||||||
| ResponseSchemasByStatusCode extends | ||||||||||||||||
| | Partial<Record<HttpStatusCode, z.Schema>> | ||||||||||||||||
| | undefined = undefined, | ||||||||||||||||
| ResponseSchemasByStatusCode extends Partial<Record<HttpStatusCode, z.Schema>> | undefined = | ||||||||||||||||
| | Record<HttpStatusCode, z.Schema> | ||||||||||||||||
| | undefined, | ||||||||||||||||
| >( | ||||||||||||||||
|
Comment on lines
+236
to
239
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Builder: buildDeleteRoute default too strict Apply the same correction here. - ResponseSchemasByStatusCode extends Partial<Record<HttpStatusCode, z.Schema>> | undefined =
- | Record<HttpStatusCode, z.Schema>
- | undefined,
+ ResponseSchemasByStatusCode extends Partial<Record<HttpStatusCode, z.Schema>> | undefined =
+ Partial<Record<HttpStatusCode, z.Schema>> | undefined,📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
| params: Omit< | ||||||||||||||||
| DeleteRouteDefinition< | ||||||||||||||||
|
|
||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default now requires a full mapping; defeats “relax default” goal
Setting the default to
Record<HttpStatusCode, z.Schema> | undefinednarrows usage when generics are omitted—partials won’t type-check. Default toPartial<...> | undefined;Record<...>remains assignable toPartial<...>anyway.📝 Committable suggestion
🤖 Prompt for AI Agents