pub fn validate(
api: &Api,
identity: &Identity,
source: Option<(&str, &str)>,
) -> Result<Model, ValidationDiagnostics>Expand description
Validate an Api document against the library’s identity, reporting
every rule violation found, and build its Model.
This is the one checked way to obtain the Model every generator
consumes, and it builds the model exactly once. The C symbol table is
checked with the real identity, in the same pass. The optional source
is (filename, contents) of the IDL file and is used to attach spans to
the returned diagnostics, each located within its enclosing declaration.
Pass None when the API is constructed in memory and there is no on-disk
source.
§Errors
Returns ValidationDiagnostics carrying one ValidationDiagnostic
per violation: an unsupported schema version, a duplicate or invalid name,
an unknown, qualified, or misplaced type, an empty struct or enum, a
throws without an error domain, a C symbol collision, or any other rule
violation in the catalog above.