Drop merged GraphQL schema for split files

Relay no longer needs a single merged schema.graphql: each project in
relay.config.json now reads the split graphql/*.graphql files directly
via `schema` (base.graphql) plus `schemaExtensions`. gqlgen already
consumed the split files, so the merge step only fed Relay and the
optional IDE GraphQL extension.

Remove the merge machinery (contrib/merge-graphql-schema.sh, the
RELAY_SCHEMAS make rules, and the gitignore entry) and drop the
graphql-config files (apps/trust/graphql.config.yml and the root
package.json graphql field); the Relay extension provides schema-aware
language features from relay.config.json on its own.

relay-compiler keeps generated artifacts in sync (stale ones are
removed automatically), so the relay npm script just runs the local
relay-compiler and the make target delegates to it.

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-06-19 13:49:13 +02:00
parent 89427845c4
commit 7e943c8105
7 changed files with 10 additions and 78 deletions

View File

@@ -41,7 +41,7 @@ Individual codegen is driven by `go generate`:
- `go generate ./pkg/server/api/mcp/v1` — MCP (mcpgen)
- `go generate ./pkg/llm` — LLM model registry from OpenRouter (`make genmodels`)
`make relay` merges split `.graphql` schema files and runs `relay-compiler`.
`make relay` runs `relay-compiler`, which reads the split `.graphql` schema files directly (via each project's `schema` + `schemaExtensions` in `relay.config.json`) and keeps generated artifacts in sync (stale ones are removed automatically).
## Coverage

View File

@@ -1,44 +0,0 @@
#!/bin/sh
# Merge split GraphQL schema files into a single file for Relay.
# Strips "type Mutation" and "extend type Mutation { ... }" blocks,
# then appends a single "type Mutation { ... }" with all collected fields.
#
# Usage: merge-graphql-schema.sh <output> <graphql-dir>
set -eu
output="$1"
graphql_dir="$2"
base="$graphql_dir/base.graphql"
mutation_fields=$(mktemp)
schema_body=$(mktemp)
trap 'rm -f "$mutation_fields" "$schema_body"' EXIT
process_file() {
awk -v mf="$mutation_fields" '
/^type Mutation$/ { next }
/^(extend )?type Mutation \{/ { skip=1; depth=1; next }
skip {
if (/\{/) depth++
if (/\}/) { depth--; if (depth==0) { skip=0; next } }
if (skip) { print >> mf; next }
}
{ print }
' "$1"
}
{
process_file "$base"
for f in "$graphql_dir"/*.graphql; do
[ "$f" = "$base" ] && continue
process_file "$f"
done
} > "$schema_body"
{
cat "$schema_body"
printf '\ntype Mutation {\n'
cat "$mutation_fields"
printf '}\n'
} > "$output"