mix caravela.gen.graphql (Caravela v0.5.3)

Copy Markdown View Source

Generates an Absinthe schema layer for the given domain: one file each for object types, queries, and mutations. All three delegate to the generated context module, so authorization, hooks, and multi-tenant scoping flow through the Absinthe resolvers for free.

mix caravela.gen.graphql MyApp.Domains.Library

Requires the optional :absinthe dependency in the consumer app's mix.exs:

{:absinthe, "~> 1.7"},
{:absinthe_plug, "~> 1.5"},
{:dataloader, "~> 2.0"}

Flags:

  • --dry-run — print the generated files without writing
  • --output DIR — write under DIR instead of the project root
  • --force — overwrite existing files without prompting

Regeneration preserves content below the # --- CUSTOM --- marker.