-
-
Notifications
You must be signed in to change notification settings - Fork 36
Better client types producers #757
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
Conversation
…ted from inputs of transformation in depictEffect.
…failed to figure out its type.
if (outputType && ["number", "string", "boolean"].includes(outputType)) { | ||
return { type: outputType as "number" | "string" | "boolean" }; | ||
} else { | ||
return next({ schema: z.any() }); |
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.
unknown transformations in output changed from its input type to any
const isOptional = propTypeName === "ZodOptional" || value.isOptional(); | ||
const isOptional = | ||
isResponse && hasCoercion(value) |
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.
adjusted optional detections for response with coercion
const input = next({ schema: schema.innerType() }); | ||
const effect = schema._def.effect; | ||
if (isResponse && effect.type === "transform") { | ||
const outputType = tryToTransform({ effect, sample: makeSample(input) }); |
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.
output transformations finally got typed, similar to OpenAPI
type: string | ||
format: double | ||
minimum: 5e-324 | ||
exclusiveMinimum: false | ||
maximum: 1.7976931348623157e+308 | ||
exclusiveMaximum: false |
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.
no more excessive props inherited during the transformation
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.
generally ready.
It looks fine. I just need to write changelog, but I'm too lazy for this today :) |
17ed8e7
to
d242872
Compare
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.
ready
The aim is to improve zts producers and align them with OpenAPI depicters.