Skip to content
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

make examples use both input and output types of zod #206

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

tionkje
Copy link
Contributor

@tionkje tionkje commented Jan 24, 2024

As mentionend in #189
I ran the tests and they all ran fine.
Let me know if there are any issues with this

Copy link
Contributor

@Sacramentix Sacramentix left a comment

Choose a reason for hiding this comment

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

Seems fine to me :)

@AGalabov
Copy link
Collaborator

AGalabov commented Feb 20, 2024

@tionkje you have some lint errors. Please fix them. As for the PR - I see no reason not to use only z.input. An example should be an example of what comes into the object/validation and not its output.

This is similar to how we handle transform:

it('does support transformed schemas', () => {
    expectSchema(
      [
        z
          .number()
          .transform(num => num.toString())
          .openapi('Transformed'),
      ],
      {
        Transformed: {
          type: 'number',
        },
      }
    );
  });

I.e in the documentation we enter the input type.

And one more thing - we tend to add tests for pretty much everything new that is testable (even if a typescript change only). In this case I think you simply add the default case in the tests, please

@AGalabov AGalabov merged commit b7429c7 into asteasolutions:master Mar 1, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants