Skip to main content

parse_schema_source

Function parse_schema_source 

Source
pub fn parse_schema_source(
    protocol: &str,
    source: &str,
) -> Result<Schema, ProtocolError>
Expand description

Parse a text/source schema (an IDL or DDL string) into a Schema, dispatching on protocol name.

The text counterpart to parse_schema_document, for the protocols whose source is a language rather than a JSON document: SQL DDL, GraphQL SDL, Protocol Buffers .proto, CDDL, Cassandra CQL, Cypher, ASN.1, Microsoft Bond, FlatBuffers .fbs, and CoNLL-U. Name matching is the same normalization as parse_schema_document.

§Errors

Returns ProtocolError::Parse if no text-source parser is registered for protocol, or the protocol’s own error if the source is malformed.