Show HN: stable_pydantic – catch Pydantic schema breakage in two tests (github.com)

1 points by QuartzLibrary ↗ HN
Hi HN!

If you persist your pydantic models (db, cache, queues, config, ...), a schema change can quietly break deserialization.

To help with this, stable_pydantic:

- tests for backward compatibility (new client reads old data)

- is easy to run on CI (just normal tests)

- stores schemas as Python files (easy to review/diff)

- optionally, tests for forward compatibility (old client reads new data)

- optionally, version-tags the data and handles migrations transparently

To setup, just copy a couple of tests from the README.

You can also adopt it incrementally, starting from just committing a copy of the models in a single file for easy diffing.

It does not cover custom validation logic, only model structure and built-in validation.

Let me know if you end up trying it, and of course if you spot any issues!

0 comments

[ 2.8 ms ] story [ 12.7 ms ] thread

No comments yet.