pub struct SchemaValidator { /* private fields */ }Implementations§
Source§impl SchemaValidator
impl SchemaValidator
Sourcepub fn new(
config: SchemaValidatorConfig,
) -> Result<Self, SchemaValidatorConfigError>
pub fn new( config: SchemaValidatorConfig, ) -> Result<Self, SchemaValidatorConfigError>
Constructs a SchemaValidator from a SchemaValidatorConfig,
resolving and applying each additional schema once. The resulting
[OverlayCatalog] is stored and accessible via Self::overlay_catalog.
This is the canonical construction path: bindings, the CLI, and library embedders all go through this method. A configured overlay behaves identically no matter which front end supplied it.
For call sites that need no overlay schemas, SchemaValidator::default()
provides an infallible, zero-config constructor.
Returns an error when an overlay is malformed.
Sourcepub fn try_with_additional_schemas<I, S>(
additional_schemas: I,
) -> Result<Self, SchemaOverlayError>
pub fn try_with_additional_schemas<I, S>( additional_schemas: I, ) -> Result<Self, SchemaOverlayError>
Construct a validator whose schema store has additional_schemas merged
on top of the bundled schemas.
Each item is a (type_name, schema) pair where schema is an
already-parsed CloudFormation resource provider schema (registry JSON, the
same shape the build-time schema compiler consumes) and type_name is the
resource type it applies to. Overlays are applied in order, so a later
overlay sees the result of the earlier ones. The
crate::overlay module documents the merge model and its scope
limits.
Fails, without building a validator, when an overlay is not a JSON object,
carries no type name, nests too deeply, defines a cyclic $ref graph, or
would change nothing. An overlay for a type the bundled schemas do not
contain is registered as a new type and logged, since that is also what a
misspelled type name looks like.
pub fn init_metric(&self) -> &PhaseMetric
Sourcepub fn validate(
&self,
model: &Arc<SemanticModel>,
region: Option<&str>,
) -> SchemaValidationResult
pub fn validate( &self, model: &Arc<SemanticModel>, region: Option<&str>, ) -> SchemaValidationResult
Validates every resource. region is the configured AWS region, or None
when the caller supplied none - in which case region-scoped checks widen to
the union of all regions (a resource type or enum value is flagged only when
it is unavailable in every region) rather than assuming a default region.
pub fn enrich_context( &self, diagnostics: &mut [Diagnostic], model: &Arc<SemanticModel>, )
pub fn schema_count(&self) -> usize
Sourcepub fn resource_schema_metadata(
&self,
type_name: &str,
) -> Option<ResourceSchemaMetadata>
pub fn resource_schema_metadata( &self, type_name: &str, ) -> Option<ResourceSchemaMetadata>
Returns the schema fields needed to map request parameters to one CloudFormation resource type, including configured schema overlays.
Sourcepub fn has_resource_type(&self, type_name: &str) -> bool
pub fn has_resource_type(&self, type_name: &str) -> bool
Whether this validator has a bundled or caller-provided schema for a CloudFormation resource type.
Sourcepub fn resource_type_names(&self) -> impl Iterator<Item = &str>
pub fn resource_type_names(&self) -> impl Iterator<Item = &str>
Iterates every bundled and caller-provided CloudFormation resource type.