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

Validating request but not response ? #185

Closed
astahmer opened this issue Oct 17, 2022 · 4 comments
Closed

Validating request but not response ? #185

astahmer opened this issue Oct 17, 2022 · 4 comments

Comments

@astahmer
Copy link
Contributor

Currently we can validate both the request payload sent and the response content using validate or none

Continuing my reasoning (and use-cases for openapi-zod-client) that not all APIs are in our own control, and therefore that we can only control what we send in the request payload,

would you consider having a validate mode (as a string enum ?) with the current boolean ?

something like:
validate: "request" | "response" | boolean

tbh I don't know if a response mode would really be useful but I added it in the example above so that every options are available

@ecyrbe
Copy link
Owner

ecyrbe commented Oct 17, 2022

Hello Alex,

Thank you for the suggestion.
Yes, this could be an option passed to the validation plugin.
I think validating both request and response is better for everyone, even on controlled APIs. It allows for fail fast strategies.
But yes, i should not impose my views on zodios users.
I'll add this.

@astahmer
Copy link
Contributor Author

100% agree that everything should be validated on controlled API, i'm still in those use-cases where I don't have any control on the API used 😓

thanks for the quick answer !

@ecyrbe ecyrbe closed this as completed in 6e26666 Oct 17, 2022
@ecyrbe
Copy link
Owner

ecyrbe commented Oct 17, 2022

this is now available on @zodios/core v10.1.0

@astahmer
Copy link
Contributor Author

that was quick 😄 ! thanks

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

No branches or pull requests

2 participants