Skip to content

Conversation

RobinTail
Copy link
Owner

The aim is to improve zts producers and align them with OpenAPI depicters.

@RobinTail RobinTail added enhancement New feature or request refactoring The better way to achieve the same result labels Dec 23, 2022
@RobinTail RobinTail marked this pull request as ready for review January 1, 2023 22:24
if (outputType && ["number", "string", "boolean"].includes(outputType)) {
return { type: outputType as "number" | "string" | "boolean" };
} else {
return next({ schema: z.any() });
Copy link
Owner Author

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

Comment on lines -60 to +71
const isOptional = propTypeName === "ZodOptional" || value.isOptional();
const isOptional =
isResponse && hasCoercion(value)
Copy link
Owner Author

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) });
Copy link
Owner Author

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

Comment on lines 576 to -581
type: string
format: double
minimum: 5e-324
exclusiveMinimum: false
maximum: 1.7976931348623157e+308
exclusiveMaximum: false
Copy link
Owner Author

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

Copy link
Owner Author

@RobinTail RobinTail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally ready.

@RobinTail
Copy link
Owner Author

It looks fine. I just need to write changelog, but I'm too lazy for this today :)

@RobinTail RobinTail force-pushed the better-zts-producers branch from 17ed8e7 to d242872 Compare January 8, 2023 13:46
Copy link
Owner Author

@RobinTail RobinTail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ready

@RobinTail RobinTail merged commit 1f6a943 into master Jan 8, 2023
@RobinTail RobinTail deleted the better-zts-producers branch January 8, 2023 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactoring The better way to achieve the same result
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant