Trait Extension

Source
pub trait Extension {
    // Required method
    fn new(
        schema_directives: Vec<Directive>,
        config: Configuration,
    ) -> Result<Self, Box<dyn Error>>
       where Self: Sized;
}
Expand description

A trait representing an extension that can be initialized from schema directives.

This trait is intended to define a common interface for extensions in Grafbase Gateway, particularly focusing on their initialization. Extensions are constructed using a vector of Directive instances provided by the type definitions in the schema.

Required Methods§

Source

fn new( schema_directives: Vec<Directive>, config: Configuration, ) -> Result<Self, Box<dyn Error>>
where Self: Sized,

Creates a new instance of the extension from the given schema directives.

The directives must be defined in the extension configuration, and written to the federated schema. The directives are deserialized from their GraphQL definitions to the corresponding Directive instances.

Implementors§