Skip to main content

validate_api

Function validate_api 

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

Validate an Api, reporting every rule violation found. The optional source is (filename, contents) of the IDL file and is used to attach spans to the returned diagnostics. 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): enum and interface references are distinguished from struct references, and cross-module references are qualified.

ยงErrors

Returns ValidationDiagnostics carrying one ValidationDiagnostic per violation: an unsupported schema version, a duplicate or invalid name, an unknown or misplaced type, an empty struct or enum, a throws without an error domain, or any other rule violation in the catalog above.