Settings

Theme

Show HN: stable_pydantic – catch Pydantic schema breakage in two tests

github.com

1 points by QuartzLibrary 2 months ago · 0 comments · 1 min read

Reader

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!

No comments yet.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection