Skip to main content

validate_api

Function validate_api 

Source
pub fn validate_api(
    api: &mut Api,
    source: Option<(&str, &str)>,
) -> Result<(), ValidationDiagnostic>
Expand description

Validate an Api. The optional source is (filename, contents) of the IDL file and is used at the call site to attach a span to a returned error via ValidationDiagnostic::new. Pass None when the API is constructed in memory (tests, programmatic builds) and there is no on-disk source.

On success, type references in api are resolved in place (see resolve_type_refs).

ยงErrors

Returns a ValidationDiagnostic wrapping the first ValidationError found: an unsupported schema version, a duplicate or invalid name, an unknown or misplaced type, an empty struct or enum, or any other rule violation in the catalog above. The diagnostic carries a source span when source is provided.