Diffo. Provider. Extension. Transformers. TransformInheritedJason
(Diffo v0.8.0)
Copy Markdown
View Source
Surfaces inherited and reverse-inherited results into the TMF JSON view.
TransformInheritedRefs injects the Ash calculations for inherited_place,
inherited_party, and inherited_characteristic so they are loadable via
Ash.load/2. That
alone keeps the brought-up values off the consumer-visible TMF surface — the
calc result never reaches the place / relatedParty / serviceCharacteristic
/ resourceCharacteristic arrays on encode.
This transformer closes that gap. It appends one focused jason.customize step
per TMF array — but only for the inherited kinds the resource actually declares:
inherited_place→Diffo.Provider.Instance.Util.surface_inherited_places/2(theplacearray)inherited_party→Diffo.Provider.Instance.Util.surface_inherited_parties/2(therelatedPartyarray)inherited_characteristic→Diffo.Provider.Instance.Util.surface_inherited_characteristics/2(theserviceCharacteristic/resourceCharacteristicarray)
Each step — at encode time — reads its inherited calc(s) off the record, drops
%Diffo.Unknown{} sentinels (X-state is the Diffo diagnostic surface, not the
TMF wire), and appends the concrete structs to its array. Each surfaced struct
encodes via its own Jason.Encoder, so subtype fidelity is preserved without
hand-building any TMF object here. See the Diffo.Provider.Instance.Util
functions for the runtime logic and the ordering convention.
Single responsibility by design: calc injection stays in TransformInheritedRefs
(an API concern), wire surfacing lives here (a TMF concern). The two evolve
independently.
Runs after TransformInheritedRefs (the calcs must exist) and before
AshJason.Resource.Transformer (which compiles the jason do steps into the
Jason.Encoder implementation).
Summary
Functions
Callback implementation for Spark.Dsl.Transformer.after_compile?/0.
Functions
Callback implementation for Spark.Dsl.Transformer.after_compile?/0.