apollo-kotlin

作者: apollographql

Apollo Kotlin 是一個強型別的 GraphQL 客戶端,能從你的 GraphQL 操作和綱要中生成 Kotlin 模型,可用於 Android、JVM 和 Kotlin Multiplatform 專案。

npx skills add https://github.com/apollographql/skills --skill apollo-kotlin

Apollo Kotlin Guide

Apollo Kotlin is a strongly typed GraphQL client that generates Kotlin models from your GraphQL operations and schema, that can be used in Android, JVM, and Kotlin Multiplatform projects.

Process

Follow this process when adding or working with Apollo Kotlin:

  • Confirm target platforms (Android, JVM, KMP), GraphQL endpoint(s), and how schemas are sourced.
  • Configure Gradle and code generation, including custom scalars
  • Create a shared ApolloClient with auth, logging, and caching.
  • Implement operations.
  • Validate behavior with tests and error handling.

Reference Files

  • Setup - Gradle plugin, schema download, codegen config (including scalars), client configuration (auth, logging, interceptors)
  • Operations - Queries, mutations, subscriptions, and how to execute them
  • Caching - Setup and use the normalized cache
  • Migration Guide - Migrate from Apollo Kotlin 4

Scripts

Key Rules

  • Prefer Apollo Kotlin v5+. Do not use v3 or older versions.
  • Keep schema and operations in source control to make builds reproducible.

來自 apollographql 的更多技能

apollo-federation
apollographql
Apollo Federation 可將多個 GraphQL API(子圖)組合成統一的超級圖表。
apollo-ios
apollographql
Apollo iOS 是一個專為 Apple 平台設計的強型別 GraphQL 客戶端。它能從你的 GraphQL 操作與 schema 生成 Swift 型別,並提供 async/await 客戶端、正規化快取(記憶體或 SQLite 支援)、可插拔的攔截器式 HTTP 傳輸(處理查詢、變更與多部分訂閱),以及可選的 WebSocket 傳輸(graphql-transport-ws),可承載任何操作類型。
apollo-router
apollographql
Apollo Router 是一款以 Rust 編寫的高效能圖形路由器,用於執行 Apollo Federation 2 超級圖。它位於子圖前端,負責查詢規劃、執行與回應組合。
apollo-router-plugin-creator
apollographql
為 Apollo Router 建立原生 Rust 外掛程式。
apollo-server
apollographql
使用 Apollo Server 5.x 跨框架建置 GraphQL 伺服器的完整指南。涵蓋綱要定義、解析器、上下文設定及錯誤處理,支援 TypeScript。支援獨立模式進行原型開發,並可整合 Express、Fastify、Koa 及無伺服器環境。包含解析器模式、認證/授權、外掛、用於防止 N+1 問題的 DataLoader,以及效能最佳化技術。提供資料來源、錯誤處理的參考文件。
graphql-operations
apollographql
撰寫高效、型別安全的 GraphQL 操作並使用片段進行組織的最佳實踐指南。涵蓋查詢、變更、訂閱及片段,包含命名慣例、變數語法與指令用法。強調核心原則:僅請求所需欄位、為所有操作命名、使用變數而非硬編碼值,以及加入 id 欄位以利快取。建議將片段與元件共置,並使用 @include / @skip 指令進行條件式欄位...
graphql-schema
apollographql
業界最佳實踐指南,用於設計直觀、高效且易於維護的 GraphQL 結構。涵蓋核心設計原則,包括以客戶端為中心的類型組織、明確的可空性模式以及向後相容的演進策略。提供關於類型、命名慣例、基於游標的分頁、錯誤建模和安全考量的參考文件。包含介面、聯合、輸入類型、變更和 ID 策略的實用模式,並附有程式碼範例。
rover
apollographql
We need to translate the given English text into Traditional Chinese. The text describes the Apollo Rover CLI tool. We must preserve the name "rover" and any technical terms like GraphQL, federation, supergraph, GraphOS, CI/CD, JSON, etc. Also preserve URLs if any (none here). Do not add any extra commentary or labels. Just translate the text inside <text> tags. The text: "Apollo Rover CLI for managing GraphQL schemas, federation, and local supergraph development. Publish, fetch, and validate subgraph schemas; compose federated supergraphs locally or via GraphOS Includes schema checking (pre-deploy validation), linting, and introspection from running servers rover dev command starts a local Router with automatic schema composition for development workflows Supports CI/CD patterns with check-before-publish validation and JSON output for scripting Requires..." Wait, the source text ends with "Requires" but it's cut off? Actually the user provided: "Apollo Rover CLI for managing GraphQL schemas, federation, and local supergraph development. Publish,