# SPDX-License-Identifier: Apache-2.0 # Copyright 2026 SZL Holdings. Licensed under the Apache License, Version 2.0. """SZL GraphQL Gateway — FastAPI + Strawberry. Serves a unified GraphQL surface over the 5 flagships: POST /graphql — GraphQL endpoint GET /graphiql — mobile-friendly interactive explorer GET /graphql/sdl — full SDL GET /healthz — health + Doctrine v11 GET / — service info Doctrine v11 — LOCKED, verbatim: 749/14/163 · locked_at c7c0ba17. Signed: Yachay Co-Authored-By: Perplexity Computer Agent """ from __future__ import annotations import os from fastapi import FastAPI from fastapi.responses import HTMLResponse, PlainTextResponse from strawberry.fastapi import GraphQLRouter from szl_graphql_schema import DOCTRINE_LOCKED_AT, FLAGSHIPS, schema app = FastAPI(title="szl-graphql-gateway", version="1.0.0") DOCTRINE = {"version": "v11", "declarations": 749, "axioms": 14, "sorries": 163, "locked_at": DOCTRINE_LOCKED_AT} # GraphiQL is served by our own mobile-friendly route below; disable the # built-in one so we control the viewport meta. graphql_app = GraphQLRouter(schema, graphql_ide=None) app.include_router(graphql_app, prefix="/graphql") @app.get("/") def root(): return { "service": "szl-graphql-gateway", "version": "1.0.0", "doctrine": DOCTRINE, "flagships": list(FLAGSHIPS), "endpoints": ["/graphql", "/graphiql", "/graphql/sdl", "/healthz"], "license": "Apache-2.0", } @app.get("/healthz") def healthz(): return {"status": "ok", "service": "graphql-gateway", "doctrine": DOCTRINE, "flagships": len(FLAGSHIPS)} @app.get("/graphql/sdl", response_class=PlainTextResponse) def sdl(): return PlainTextResponse(schema.as_str()) @app.get("/graphiql", response_class=HTMLResponse) def graphiql(): return HTMLResponse(_GRAPHIQL_HTML) _GRAPHIQL_HTML = """ SZL GraphQL — Explorer
SZL GraphQL Gateway Doctrine v11 · 749/14/163 SDL healthz
Loading…
""" if __name__ == "__main__": # pragma: no cover import uvicorn uvicorn.run(app, host="0.0.0.0", port=int(os.environ.get("PORT", 7860)))