chore(interfaces): move data-postgresql schemas to new format - #671
Open
james-garner-canonical wants to merge 1 commit into
Open
james-garner-canonical wants to merge 1 commit into
james-garner-canonical wants to merge 1 commit into
Conversation
…new format Interface schemas no longer wrap their models in the `ProviderSchema` and `RequirerSchema` classes from `pytest-interface-tester`. Instead a schema names all four databags directly, as `ProviderAppData`, `ProviderUnitData`, `RequirerAppData` and `RequirerUnitData`, setting a databag that is always empty to `None`. Naming all four makes an empty databag a deliberate choice a reviewer can see, and makes a misspelled name an error rather than a silently empty databag. The models are unchanged; only the wrapper classes around them are gone. Dropping the `pytest-interface-tester` import leaves Pydantic as the only dependency needed to read a schema. The new format is designed to be consumed by `ops.Relation.load` and to round-trip with `ops.Relation.save`, so the schemas define custom encoders and decoders (since `ops` assumes JSON encoding) and add Pydantic aliases for the hyphenated databag keys. A follow-up PR documents the format and adds a CI check for it, once every interface has been migrated. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
james-garner-canonical
marked this pull request as ready for review
September 3, 2026 06:02
james-garner-canonical
requested review from
carlcsaposs-canonical,
dragomirp,
juju-charm-bot,
marceloneppel,
oleksii-buhaiov and
taurus-forever
September 3, 2026 06:02
james-garner-canonical
force-pushed
the
26-08+chore+interface-schemas-data-postgresql
branch
from
September 11, 2026 03:10
57733e0 to
2bcbb38
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR replaces the
pytest-interface-testerwrappers in the schema with a new convention: naming all four databags directly, asProviderAppData,ProviderUnitData,RequirerAppDataandRequirerUnitData, setting a databag that is always empty toNone.The new format is designed to be consumed by
ops.Relation.loadand round-trip withops.Relation.save, so the schemas are tweaked to facilitate this -- we define custom encoders and decoders (sinceopsassumes JSON encoding), and add Pydantic aliases for the actual databag keys (hyphenated). Note that the__juju_encoder/decoder__convention used here is not (yet?) supported in Ops, for now it's just designed to be consumed by the repository machinery.A follow up PR will document this and add tooling to enforce it, after similar PRs have landed for all the other
CODEOWNERSin this repository.