Skip to content

chore(interfaces): move data-nosql schemas to new format - #670

Open
james-garner-canonical wants to merge 1 commit into
canonical:mainfrom
james-garner-canonical:26-08+chore+interface-schemas-data-nosql
Open

james-garner-canonical wants to merge 1 commit into
canonical:mainfrom
james-garner-canonical:26-08+chore+interface-schemas-data-nosql

Conversation

@james-garner-canonical

Copy link
Copy Markdown
Collaborator

This PR replaces the pytest-interface-tester wrappers in the schema with a new convention: naming all four databags directly, as ProviderAppData, ProviderUnitData, RequirerAppData and RequirerUnitData, setting a databag that is always empty to None.

The new format is designed to be consumed by ops.Relation.load and round-trip with ops.Relation.save, so the schemas are tweaked to facilitate this -- we define custom encoders and decoders (since ops assumes 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 CODEOWNERS in this repository.

This PR also removes the interface test definitions for etcd_client. The interface tests are being retired; the tooling that ran them is being removed separately.

…ormat

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.

This also removes the interface test definitions for these interfaces. The
interface tests are being retired; the tooling that ran them is removed
separately.

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>
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

Successfully merging this pull request may close these issues.

1 participant