# graphql-codegen configuration # # Schema source: combined-schema.graphql (generated by scripts/normalize-schema.ts # from services subgraph SDL files, with federation `extend type Query` normalized). # # Subgraph list (7 with GraphQL): iam / config-service / core-edu / content / # msg / data-ana / ai (classes has no GraphQL subgraph yet). # # Outputs: # - __generated__/types.ts: all GraphQL schema types (always generated) # - __generated__/operations.ts: DocumentNode constants emitted from # operations/*.graphql.ts via typescript-document-nodes plugin. # # Related: spec section 2.4 schema: - src/lib/api/__generated__/combined-schema.graphql documents: src/lib/api/operations/**/*.graphql.ts # Schema validation is skipped because services/ai subgraph has invalid input # types (ChatRequestInput.messages references output type ChatMessage; same # for ChatResponseInput.usage → Usage). normalize-schema.ts rewrites those # field types to String as a codegen-only sanitize. skipSchemaValidation: true generates: src/lib/api/__generated__/types.ts: plugins: - typescript src/lib/api/__generated__/operations.ts: # typescript-document-nodes only: emits typed DocumentNode constants # from the gql templates in operations/*.graphql.ts. We deliberately # omit typescript-operations here because portal-shell widgets use # forward-looking spec fields (grades, myClasses, lessonPlans, etc.) # that are not yet present in services subgraph SDL; once services # catch up we can re-add typescript-operations for full query typing. plugins: - typescript-document-nodes config: preResolveTypes: true skipTypename: true exportTypeKeyOnly: true useTypeImports: true # Generated operations.ts should import `gql` from @apollo/client (the # package portal-shell actually uses) instead of the default graphql-tag. gqlImport: "@apollo/client#gql" # Skip document validation against schema. portal-shell widgets use spec # forward-looking fields (grades, myClasses, lessonPlans, etc.) not yet # implemented in services subgraph SDL. Without this flag, codegen would # emit 44 "Cannot query field X on type Query" errors and refuse to write # operations.ts. The runtime apollo-router validates documents at request # time, so skipping here only affects codegen-time type generation. # Once services catch up, remove this flag to re-enable validation. skipDocumentsValidation: true