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

Add an option to disable constraint checks #688

Open
corentin-regent opened this issue May 16, 2024 · 0 comments
Open

Add an option to disable constraint checks #688

corentin-regent opened this issue May 16, 2024 · 0 comments

Comments

@corentin-regent
Copy link

Description

Hi @jcrist!

I am currently using msgspec for deserializing data queried from external REST APIs. Constraints are great for this purpose, because it provides some documentation within the code about the format of the data that we retrieve, and it ensures that we really receive what we expect.

However, once the end-to-end tests for my API client pass, well we are pretty sure that any other request that we may perform in a near future will also return some valid data as expected. Or at least it would be the case for APIs that are stable enough.

This means that all the tests that may be performed at runtime once in production will be nearly redundant, however they could introduce some overhead depending on the size of the data and on the performance that is required.

Therefore I am suggesting to add an enforce_constraints flag (or whatever name fits best) for the Decoders and the decode functions, which could be set to False for disabling these checks.

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

1 participant