AttributeConfig (kind: attributeconfig)
Declares a real JSON Schema (2020-12) fragment that must validate
against a targeted properties/custom/configuration block of every document matching
spec.target — a platform-authored shape guardrail for the loosely-typed passthrough blobs
every kind carries, enforced automatically against every matching document the moment it ships
(no opt-in required on the target document’s side).
See docs/design/dynamic-configuration-validation.md
for the full design rationale, and
How To: model your own structured data in properties
for a worked example.
Schema
spec.target.kind— whichPlatformKindthis schema targets (e.g.resource)spec.target.block— which blob field on that kind to validate:properties,custom,configuration,variables,features(whichever the target kind actually has), orcomposite(all four merged blocks together;view: effectiveonly).valuesis a parameter set’s own values (view: document);paramsis the merged parameter values a document receives (view: effective, see below). Neversecrets.spec.target.view— required:documentvalidates each matching document’s own block in isolation;effectivevalidates each deployable deployment’s merged result (target.kind: deploymentonly), or withblock: params, what a deployment, environment or tenant receives from its parameter setsspec.target.selector— optionalfield.path: required-valueequality map narrowing which documents oftarget.kindthis schema applies to. Omitted means every document of that kind. Equality only — no wildcards or regex. A path walks into a map by key:meta.labels.role: spokeselects on a label.
Parameter sets: two views
Values are layered, so they are checked in two places:
One set at a time (
kind: parameterset,block: values,view: document): the shape of what one file holds. A set does not know its role, so select on an optional label:spec: target: { kind: parameterset, block: values, view: document, selector: { meta.labels.role: spoke } } schema: type: object required: [name, hub, tenant] properties: name: { type: string, pattern: "^[a-z][a-z0-9]*-[0-9]{3}$" }
What a document receives (
block: params,view: effective, forkind: deployment,environmentortenant): the values its chain’s sets give it once merged per role (root first, leaf last), with the roles as top-level keys. “Everything a base needs is there” can only be checked here: a hub’s set does not fill thespokerole.spec: target: { kind: deployment, block: params, view: effective, selector: { spec.workspace: bootstrap } } schema: required: [spoke, hub] properties: spoke: { required: [name, hub, tenant] } hub: { properties: { provider: { enum: [azure-westeurope, azure-westus2] } } }
A deployment is checked when it is deployable, with its selector evaluated on the resolved deployment; an environment or tenant when it is not
partial: true. A document that names no set receives{}, so narrow the selector to the documents that use the base. Findings are located atmeta.params.<role>.<key>on the document, and name it.
A schema cannot check that a value names an existing tenant or provider; the reference check on the resolved document does.
spec.schema— a verbatim JSON Schema fragment (type,properties,required,additionalProperties,patternProperties,if/then, …), authored directly — no strata-invented vocabulary.
Example
apiVersion: strata.huybrechts.xyz/v2
kind: attributeconfig
meta:
name: azure-storage-account-configuration
spec:
target:
kind: resource
block: configuration
view: document
selector:
spec.provider_type: azure
spec.resource_type: storage_account
schema:
type: object
required: [account_tier]
additionalProperties: false
properties:
account_tier:
type: string
pattern: "^(Standard|Premium)$"
Notes
No merge. Every
attributeconfigdocument whosetargetandselectormatch a document is evaluated independently, and all must pass — adding a schema can only ever tighten validation, never loosen it. Two schemas declaring the same top-levelpropertieskey, with selectors that can match the same document, is an authoring mistake caught at load time (attributeconfig_conflict).Applied-schema visibility. Every
(document, schema)application is logged under--verbose; a schema whose selector matches zero documents gets a warning (attributeconfig_unused) — a silently-inert guardrail is otherwise indistinguishable from one that always passes.Security. The evaluator never resolves a schema’s
$refagainst a remote URL — an unresolvable$refis reported as an invalid schema (attributeconfig_invalid), not fetched.Relationship to
providerconfig.providerconfigpreviously carried its own embedded, regex-only schema sub-feature forresource.spec.configuration. That sub-feature is retired — the same schemas are now ordinaryattributeconfigdocuments, keyed by a{spec.provider_type, spec.resource_type}selector, with strictly more power (real JSON Schema types, nesting, cross-fieldif/then).providerconfig’s resource-type/region name-registry role (additional_regions/additional_resources) is unrelated and unaffected.