搜索

PythonReactSEOPDF
GitHub Skill

graphql-contract

Use when changing GraphQL schema, resolvers, or frontend GraphQL documents so the contract and codegen stay in sync.

lmiguelvargasf☆ 2 仓库 Stars0 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

GraphQL contract & sync

When to use

  • You modify backend GraphQL types/resolvers or the schema.
  • You add or edit frontend .graphql documents.
  • You suspect schema and generated types are out of sync.

Steps

  1. Backend: implement changes under backend/src/backend/apps/**/graphql/.
  2. Sync: run task frontend:codegen from the repo root.
    • This runs task backend:schema:export to update frontend/schema/schema.graphql.
    • Then runs pnpm codegen to regenerate TypeScript types.
  3. Frontend: update frontend/src/ to use the newly generated types/fragments.
  4. Verify: run task frontend:check.

Constraints and guardrails

  • The Strawberry backend is the source of truth; do not manually edit frontend/schema/schema.graphql.
  • Do not hand-write TypeScript interfaces for GraphQL results; use generated types in frontend/src/lib/graphql/.
  • Schema changes and frontend sync should be in the same change set.
  • Breaking changes (removing/renaming fields, Nullable → Non-Null, adding required args) require immediate frontend updates after codegen.
  • Avoid N+1 by using SQLAlchemy eager loading (selectinload/joinedload) and moving complex logic into services.

References

  • backend/src/backend/apps/**/graphql/
  • frontend/schema/schema.graphql
  • frontend/src/lib/graphql/
  • frontend/**/codegen.*

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-01-20
索引更新时间
2026-01-26
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!