Expand description

trustfall_stubgen

Given a Trustfall schema, autogenerate a high-quality Rust adapter stub fully wired up with all types, properties, and edges referenced in the schema.

First, install the CLI with: cargo install --locked trustfall_stubgen --features cli Then generate Trustfall adapter stubs for your schema with:

trustfall_stubgen --schema <your_schema.graphql> --target <output_directory>

Under the hood this directly calls the generate_rust_stub function from this crate. This crate can also be used as a library, so you can call that function directly from your own code without going through the CLI.

The generated Trustfall adapter stub has the following structure:

file namepurpose
adapter/mod.rsconnects everything together
adapter/schema.graphqlcontains the schema for the adapter
adapter/adapter_impl.rscontains the adapter implementation
adapter/vertex.rscontains the vertex type definition
adapter/entrypoints.rscontains the entry points where all queries must start
adapter/properties.rscontains the property implementations
adapter/edges.rscontains the edge implementations

See an example of a generated adapter stub from this crate’s test suite.

Functions