Diffo.Provider.Validations.ValidateSpecificationKind (Diffo v0.5.0)

Copy Markdown View Source

Validates that the specification an instance is being specified by matches the instance kind: a Service must be specified by a :serviceSpecification, a Resource by a :resourceSpecification.

Runtime counterpart to the compile-time Diffo.Provider.Extension.Verifiers.VerifySpecificationKind. The verifier guards the statically-declared specification do type on consumer leaves; this guards the specification associated at runtime via the specified_by argument — covering generic instances (Provider.Instance and resource leaves with no spec DSL) and respecify, which the verifier cannot see.

Declared on the Service / Resource fragments with the expected spec type, so each kind carries its own constraint. A no-op on changes that do not set specified_by. A missing/unreadable spec is left to other machinery — this validation only rejects a present, wrong-kind specification.