Macro shopify_function::generate_types

source ·
generate_types!() { /* proc-macro */ }
Expand description

Generate the types to interact with Shopify’s API.

The macro generates two inline modules: input and output. The modules generate Rust types from the GraphQL schema file for the Function input and output respectively.

The macro takes the following parameters:

  • query_path: A path to a GraphQL query, whose result will be used as the input for the function invocation. The query MUST be named “Input”.
  • schema_path: A path to Shopify’s GraphQL schema definition. Use the CLI to download a fresh copy.
  • extern_enums (optional): A list of Enums for which an external type should be used. For those, code generation will be skipped. This is useful for large enums which can increase binary size, or for enums shared between multiple targets. Example: extern_enums = ["LanguageCode"]
    • default: ["LanguageCode", "CountryCode", "CurrencyCode"]