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

use zod schema description when generating components instead of only .openapi #111

Merged

Conversation

AGalabov
Copy link
Collaborator

No description provided.

@AGalabov AGalabov requested a review from georgyangelov March 20, 2023 14:12
@AGalabov AGalabov linked an issue Mar 20, 2023 that may be closed by this pull request

/**
* A description provided from .openapi() should be taken with higher
* precedence. Note that there is an overload of .describe() that uses
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't we remove the overload? What purpose does it have now?

Copy link
Collaborator Author

@AGalabov AGalabov Mar 21, 2023

Choose a reason for hiding this comment

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

Well that is a good question. This is the better implementation in my opinion. In case someone uses the .describe code with extendZodWithOpenApi then this would also mean that you can do .openapi({ description: 'Description' }).describe('Alternative'). If there is no such implementation you cannot do it. Note: In my opinion it is also valid to do this: .describe('Description').openapi({ description: 'Alternative'}) => we cannot just say "zod describe is before openapi or the other way round".

@AGalabov AGalabov merged commit 8be8efd into master Mar 31, 2023
@AGalabov AGalabov deleted the fix/#104-description-not-available-without-zod-overrides branch March 31, 2023 10:18
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.

Inherit zod schema description by default
2 participants