Skip to main content

generate_proto_file

Function generate_proto_file 

Source
pub fn generate_proto_file(
    schema: &CompiledSchema,
    package: &str,
    include_types: &[String],
    exclude_types: &[String],
) -> String
Expand description

Generate a complete .proto file from a compiled schema.

Produces a proto3 service definition with:

  • One message per GraphQL type (fields sorted alphabetically for stable numbering)
  • One RPC per query (Get for single, List for list queries)
  • One RPC per mutation (returns MutationResponse)
  • Enum definitions from the schema
  • Request/response wrapper messages

ยงErrors

Returns an error if the schema contains no types to expose.