ecyrbe / zodios

typescript http client and server with zod validation
https://www.zodios.org/
MIT License
1.59k stars 44 forks source link

Validation is turned of if the `validate` option is undefined. #583

Closed atrick-speedline closed 2 months ago

atrick-speedline commented 5 months ago

The validate option is supposed to default to true, and if you do Zodios(baseUrl, definitions, {}) then validation will be enabled. However, if you do Zodios(baseUrl, definitions, {validate: undefined}) then the validation is disabled.

The root cause of this is that undefined isn't considered as one of the possible values for undefined in the constructor code and the plugin code; however, there's no way that I know of to get TypeScript to prevent passing undefined to an optional value.

stale[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

atrick-speedline commented 4 months ago

Would you be interested in a pull request?

stale[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.