Skip to main content

SchemaValidator

Struct SchemaValidator 

Source
pub struct SchemaValidator { /* private fields */ }

Implementations§

Source§

impl SchemaValidator

Source

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.

Source

pub fn try_with_additional_schemas<I, S>( additional_schemas: I, ) -> Result<SchemaValidator, SchemaOverlayError>
where I: IntoIterator<Item = (S, Value)>, S: AsRef<str>,

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.

Source

pub fn init_metric(&self) -> &PhaseMetric

Source

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.

Source

pub fn enrich_context( &self, diagnostics: &mut [Diagnostic], model: &Arc<SemanticModel>, )

Source

pub fn schema_count(&self) -> usize

Source

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.

Source

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.

Source

pub fn resource_type_names(&self) -> impl Iterator<Item = &str>

Iterates every bundled and caller-provided CloudFormation resource type.

Source

pub fn list_rules(&self) -> Vec<RuleInfo>

Trait Implementations§

Source§

impl Default for SchemaValidator

Source§

fn default() -> SchemaValidator

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyExt for T
where T: Any + ?Sized,

Source§

fn downcast_ref<T>(this: &Self) -> Option<&T>
where T: Any,

Attempts to downcast this to T behind reference
Source§

fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>
where T: Any,

Attempts to downcast this to T behind mutable reference
Source§

fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>
where T: Any,

Attempts to downcast this to T behind Rc pointer
Source§

fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>
where T: Any,

Attempts to downcast this to T behind Arc pointer
Source§

fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>
where T: Any,

Attempts to downcast this to T behind Box pointer
Source§

fn downcast_move<T>(this: Self) -> Option<T>
where T: Any, Self: Sized,

Attempts to downcast owned Self to T, useful only in generic context as a workaround for specialization
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T, X> CoerceTo<T> for X
where T: CoerceFrom<X> + ?Sized,

Source§

fn coerce_rc_to(self: Rc<X>) -> Rc<T>

Source§

fn coerce_box_to(self: Box<X>) -> Box<T>

Source§

fn coerce_ref_to(&self) -> &T

Source§

fn coerce_mut_to(&mut self) -> &mut T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V