Task-indexed recipes for the day-to-day patterns Graphitron’s directives unlock. Browse alphabetically when you know which directive you want; browse by category when you know which problem you’re solving.

Alphabetical

  • Add custom conditions: attach a developer-supplied predicate to a field, argument, or input field via @condition.

  • Apollo Federation transport: wire the federation runtime around a Graphitron schema.

  • Batch lookups: drive a positional batch fetch with @lookupKey and get one result per input position.

  • Computed fields with @externalField: project a derived column from a developer-supplied jOOQ Field<T>.

  • Stacking and overriding conditions: when explicit @condition predicates stack with implicit ones, and what override: suppresses.

  • Cursor-paginated connections: synthesised vs declared connection types, totalCount cost, and what the rewrite caps (and doesn’t).

  • Custom scalars: declare a custom scalar in the SDL and bind it to a GraphQLScalarType constant via the @scalarType(scalar:) directive.

  • The errors channel: route Java exceptions through a service payload’s errors: field as typed data.

  • Wire external Java code: the shared mechanics for @service, @externalField, @tableMethod, @condition, @sourceRow, @enum, and @record.

  • Federation key fields: declare entity keys with @key, layer them onto @node types, and stub non-resolvable entities owned by another subgraph.

  • Global object IDs: Relay Global Object Identification end-to-end, including stable IDs, keyColumns migrations, and Query.node dispatch.

  • Handle services: bind GraphQL arguments to Java parameters and pick a return shape the framework recognises.

  • Join with references: pin foreign-key paths between table-bound types so the generator emits a JOIN.

  • Map types to tables: bind types and fields with @table + @field across the four directive sites.

  • Migrating from the legacy generator: walk a schema authored against graphitron-codegen-parent to the rewrite.

  • Multi-hop @nodeId filters: reach a related node type through one or more intermediate tables when the FKs carry the target’s keys positionally by SQL name.

  • Polymorphic types: choose between single-table and multi-table layouts for GraphQL interfaces and unions.

  • Result-type variants: pick a backing class for a @record parent (jOOQ TableRecord, jOOQ Record, Java record, plain POJO).

  • Source-row directive: bridge a non-jOOQ DTO parent to a @table child field with @sourceRow, optionally composed with @reference for multi-hop paths.

  • Sort results: pick a column source, build stable keyset cursors with explicit tie-breakers, and avoid the collation pitfalls.

  • When to split queries: choose between inline correlated subqueries and @splitQuery-batched fetches.

  • Tenant scoping: per-request routing through Graphitron.newExecutionInput(dsl, …​). The full recipe (per-tenant DataLoader partitioning, @tenantId directive, byTenant factory overload) ships under R45; until then, single-tenant apps pass a single DSLContext.

  • Test your schema: wire a consumer-side execution-tier test against a real Postgres.

← Back to the manual landing