pub struct SchemaValidator { /* private fields */ }Implementations§
Source§impl SchemaValidator
impl SchemaValidator
Sourcepub fn new(
config: SchemaValidatorConfig,
) -> Result<SchemaValidator, SchemaValidatorConfigError>
pub fn new( config: SchemaValidatorConfig, ) -> Result<SchemaValidator, 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<SchemaValidator, SchemaOverlayError>
pub fn try_with_additional_schemas<I, S>( additional_schemas: I, ) -> Result<SchemaValidator, 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
pub fn list_rules(&self) -> Vec<RuleInfo>
Trait Implementations§
Source§impl Default for SchemaValidator
impl Default for SchemaValidator
Source§fn default() -> SchemaValidator
fn default() -> SchemaValidator
Auto Trait Implementations§
impl Freeze for SchemaValidator
impl RefUnwindSafe for SchemaValidator
impl Send for SchemaValidator
impl Sync for SchemaValidator
impl Unpin for SchemaValidator
impl UnsafeUnpin for SchemaValidator
impl UnwindSafe for SchemaValidator
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer