Skip to content

Version 0.2.2

Choose a tag to compare

@koehlma koehlma released this 29 Apr 19:29
· 25 commits to main since this release
sidex-gen-py: uniform inlining + payload() translation method

All flat-record variant cases now inline the target record's fields
directly into the variant class, regardless of whether the target lives
in the same schema, a sibling schema, or a different bundle. The
previous "inherit when same-schema, inline when cross-schema" split was
fragile (sibling-schema inheritance fails at class-construction time
because `_schema_X` is `TYPE_CHECKING`-gated) and forced API consumers
to handle two shapes for the same logical case.

To preserve the conceptual link to the base record, every payload-
bearing variant case now exposes a `payload()` method that constructs
a fresh instance of the underlying type:

    SettingTarget_Module(...).payload()  # -> ModuleRef
    ConcreteType_Table(...).payload()     # -> ConcreteTableType

Cross-schema payloads use a method-local `from . import` so the
translation works even when the variant module is imported standalone,
before the bundle's `__init__.py` has wired up runtime aliases.

Externally- and adjacently-tagged variant cases get the same `payload()`
method for symmetry, returning `self.value` / `self.content`
respectively.

The previous `test_variant_e_inherits_record` / `..._inherits_generic_
record` tests asserted on inheritance; rename and rewrite them to
exercise `payload()` instead.