pub struct Config {
    pub ignore_unknown_fields: bool,
    pub allowed_proto_any_urls: Vec<Pattern>,
    pub diagnostic_level_overrides: HashMap<Classification, (Level, Level)>,
    pub uri_overrides: Vec<(Pattern, Option<String>)>,
    pub uri_resolver: Option<UriResolver>,
}
Expand description

Configuration structure.

Fields

ignore_unknown_fields: bool

When set, do not generate warnings for unknown protobuf fields that are set to their protobuf-defined default value.

allowed_proto_any_urls: Vec<Pattern>

Protobuf message URLs that are explicitly allowed for use in “any” messages, i.e. that the caller warrants the existence of in the consumer that the plan is validated for.

diagnostic_level_overrides: HashMap<Classification, (Level, Level)>

Allows the level of diagnostic messages to be overridden based on their classification/code. The logic for this is as follows:

  • if an entry exists for the classication of the incoming diagnostic, override its error level to at most the second argument, and then to at least the first argument. Otherwise,
  • if an entry exists for the group of said classification, use its level limits instead. Otherwise,
  • if an entry exists for Unclassified (code 0), use its level limits instead. Otherwise, do not adjust the level.

Note that setting an entry to (Info, Error) leaves the diagnostic level unchanged.

uri_overrides: Vec<(Pattern, Option<String>)>

Allows URIs from the plan to be remapped (Some(mapping)) or ignored (None). All resolution can effectively be disabled by just adding a rule that maps * to None. Furthermore, in the absence of a custom yaml_uri_resolver function, this can be used to remap URIs to pre-downloaded files.

uri_resolver: Option<UriResolver>

Optional callback function for resolving URIs. If specified, all URIs (after processing yaml_uri_overrides) are resolved using this function. The function takes the URI as its argument, and should either return the download contents as a Vec or return a String-based error. If no downloader is specified, only file:// URLs with an absolute path are supported.

Implementations

Creates a default configuration.

Instructs the validator to ignore protobuf fields that it doesn’t know about yet (i.e., that have been added to the Substrait protobuf descriptions, but haven’t yet been implemented in the validator) if the fields are set to their default value. If this option isn’t set, or if an unknown field is not set to its default value, a warning is emitted.

Explicitly allows a protobuf message type to be used in advanced extensions, despite the fact that the validator can’t validate it. If an advanced extension is encountered that isn’t explicitly allowed, a warning is emitted.

Sets a minimum and/or maximum error level for the given class of diagnostic messages. Any previous settings for this class are overridden.

Overrides the resolution behavior for (YAML) URIs matching the given pattern. If resolve_as is None, the URI file will not be resolved; if it is Some(s), it will be resolved as if the URI in the plan had been s.

Registers a URI resolution function with this configuration. If the given function fails, any previously registered function will be used as a fallback.

Trait Implementations

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.