Skip to main content

Module compiled_schema

Module compiled_schema 

Source
Expand description

Shared CloudFormation resource-provider schema model and the raw-JSON → compiled-schema transform.

This is the single source of truth for turning a raw CloudFormation registry schema ($ref, type, enum, /properties/... paths, allOf+if, …) into the compiled representation that the schema validator consumes.

  • At build time, codegen_schema_validator compiles every bundled schema with compile_schema and serializes the results to compiled_schemas.json (embedded into the binary). BTreeMap fields make that output deterministic.
  • At run time, the schema-validator crate applies additional/overlay schemas by calling compile_schema and converting the result into its own runtime schema type. Routing overlays through this exact function guarantees the transform is the same one bundled schemas go through.

The transform is shared; the input is not. Bundled schemas are compiled from the build pipeline’s patched archive, which adds keywords the raw registry does not carry (case-insensitive enums, requiredOr/requiredXor, dependentExcluded, injected conditional allOf fragments). A caller-supplied overlay is compiled straight from the JSON it provides, so anything the pipeline would have contributed is absent unless the caller states it explicitly. Callers must not assume an overlay for a bundled type reproduces that type’s enriched schema.

This module is intentionally dependency-free (only serde/serde_json + std) and is not behind the maintenance feature, so the runtime can use the transform without pulling in the build pipeline’s heavy dependencies.

Modules§

keywords
Named constants for every raw JSON-schema and CloudFormation provider-schema keyword the compiler reads, grouped by how the compiled model represents them. This module is the single source of truth for the vocabulary shared between the build-time compilation pipeline and the runtime overlay preflight in schema-validator.

Structs§

CompiledSchema
ConditionSchema
IfThenElse
PropSchema

Enums§

PropType
RefSiblings
How to treat constraint keywords written beside a $ref.

Functions§

compile_schema
Compiles a raw provider schema with RefSiblings::Enforce - the overlay path. The build pipeline uses compile_schema_with and RefSiblings::Ignore instead; see RefSiblings.
compile_schema_with
Compiles a raw CloudFormation resource provider schema into the compiled representation.
unsupported_root_conditionals
Describes every resource-root conditional whose if schema the compiler cannot represent faithfully: a keyword outside keywords::COMPILE_CONDITION_SCHEMA_FIELDS, or an if that states no condition at all. Such a condition would compile to one that always (or never) matches, silently changing what the then branch applies to, so the build pipeline refuses to emit it. Sub-conditions under anyOf, oneOf and not follow the same grammar and are audited recursively.

Type Aliases§

SubSchema
A composition branch is now a full property schema - every constraint that compile_prop produces is available in a branch and evaluated by the runtime. This alias maintains naming clarity at usage sites.