apollo-connectors

द्वारा apollographql

REST APIs को @source और @connect निर्देशों का उपयोग करके GraphQL सुपरग्राफ में एकीकृत करें। एक संरचित 5-चरणीय प्रक्रिया प्रदान करता है: API संरचना पर शोध करें, निर्देशों के साथ स्कीमा लागू करें, rover supergraph compose के माध्यम से मान्य करें, कनेक्टर निष्पादित करें, और परीक्षण कवरेज करें। हेडर, बॉडी पेलोड, N+1 पैटर्न के लिए बैचिंग, और $env के माध्यम से पर्यावरण चर इंजेक्शन सहित अनुरोध कॉन्फ़िगरेशन का समर्थन करता है। फ़ील्ड चयन,

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

Apollo Connectors Schema Assistant

MCP Tools

If GraphOS MCP Tools are available, use them:

  • connectors-spec: Fetch the complete Connectors specification before starting any connector work
  • apollo_docs_search: Search for relevant documentation
  • apollo_docs_read: Read specific documentation pages by slug

Documentation paths by topic:

  • Requests: /graphos/connectors/requests/url, /headers, /body, /batching
  • Responses: /graphos/connectors/responses/fields, /error-handling
  • Mapping: /graphos/connectors/mapping, /arrays, /enums, /literals
  • Entities: /graphos/connectors/entities, /patterns

Process

Follow this 5-step process. DO NOT skip any steps.

Step 1: Research

  • Understand the API being called and the structure of responses
  • Ask the user for example API responses if not provided
  • Fetch relevant documentation from MCP tools or reference files
  • DO NOT write any code until research is complete

Step 2: Implement

  • Create the schema using the template below
  • Follow the grammar, methods, and variables in the reference files
  • Ask clarifying questions if unsure about requirements

Step 3: Validate (Compose)

  • Run rover supergraph compose --config ./supergraph.yaml
  • Fix any composition errors before proceeding

Step 4: Execute

  • Run rover connector run --schema <file> -c "<Type.field>" -v "{}"
  • Verify the connector executes correctly

Step 5: Test

  • Create or update test files under /tests/
  • Run rover connector test
  • Ensure full test coverage for each connector

Schema Template

# Note to AI Friends: This is an Apollo Connectors schema. You should use your connectors-spec MCP tool if you have it available before editing this file.

extend schema
  @link(url: "https://specs.apollo.dev/federation/v2.15")
  @link(url: "https://specs.apollo.dev/connect/v0.3", import: ["@source", "@connect"])

@source(name: "api_name", http: { baseURL: "https://api.example.com" })

type Query {
  example(id: ID!): Example
    @connect(
      source: "api_name"
      http: { GET: "/example/{$args.id}" }
      selection: """
      id
      name
      """
    )
}

type Example {
  id: ID!
  name: String
}

Version requirements

Use the latest Long-Term Support (LTS) versions of Apollo Federation and Apollo Connectors. Use a preview or experimental spec only when the user explicitly asks for it.

Confirm the current LTS before writing @link URLs or federation_version. Prefer the GraphOS docs tools when they are available:

  • Federation: read /graphos/schema-design/federated-schemas/reference/versions and use the highest version marked LTS. That version is the schema @link (https://specs.apollo.dev/federation/vX.Y). Set federation_version in supergraph.yaml to the latest patch of that same LTS line.
  • Connectors: read /graphos/connectors/getting-started/version-requirements and /graphos/connectors/reference/changelog. Use the latest Connectors spec that is generally available (not marked experimental) and compatible with that Federation LTS (https://specs.apollo.dev/connect/vX.Y).

The template above uses the current LTS: Federation v2.15 and Connectors v0.3. If the docs list a newer LTS, use the docs.

Reference Files

Before implementing connectors, read the relevant reference files:

Key Rules

Selection Mapping

  • Prefer sub-selections over ->map for cleaner mappings
  • Do NOT use $ when selecting fields directly from root
  • Field aliasing: newName: originalField (only when renaming)
  • Sub-selection: fieldName { ... } (to map nested content)
# DO - Direct sub-selection for arrays
$.results {
  firstName: name.first
  lastName: name.last
}

# DO NOT - Unnecessary root $
$ {
  id
  name
}

# DO - Direct field selection
id
name

Entities

  • Add @connect on a type to make it an entity (no @key needed)
  • Create entity stubs in parent selections: user: { id: userId }
  • When you see an ID field (e.g., productId), create an entity relationship
  • Each entity should have ONE authoritative subgraph with @connect

Literal Values

Use $() wrapper for literal values in mappings:

$(1)              # number
$(true)           # boolean
$("hello")        # string
$({"a": "b"})     # object

# In body
body: "$({ a: $args.a })"  # CORRECT
body: "{ a: $args.a }"     # WRONG - will not compose

Headers

http: {
  GET: "/api"
  headers: [
    { name: "Authorization", value: "Bearer {$env.API_KEY}" },
    { name: "X-Forwarded", from: "x-client" }
  ]
}

Batching

Convert N+1 patterns using $batch:

type Product @connect(
  source: "api"
  http: {
    POST: "/batch"
    body: "ids: $batch.id"
  }
  selection: "id name"
) {
  id: ID!
  name: String
}

Ground Rules

  • NEVER make up syntax or directive values not in this specification
  • NEVER use --elv2-license accept (for humans only)
  • ALWAYS ask for example API responses before writing code
  • ALWAYS validate with rover supergraph compose after changes
  • ALWAYS create entity relationships when you see ID fields
  • Prefer $env over $config for environment variables
  • Use rover dev for running Apollo Router locally

apollographql की और Skills

apollo-federation
apollographql
Apollo Federation एकाधिक GraphQL API (उपग्राफ) को एक एकीकृत सुपरग्राफ में संयोजित करने में सक्षम बनाता है।
apollo-ios
apollographql
Apollo iOS एप्पल प्लेटफॉर्म के लिए एक मजबूत टाइप वाला GraphQL क्लाइंट है। यह आपके GraphQL ऑपरेशन और स्कीमा से Swift प्रकार उत्पन्न करता है, और एक async/await क्लाइंट, एक सामान्यीकृत कैश (इन-मेमोरी या SQLite-समर्थित), एक प्लग करने योग्य इंटरसेप्टर-आधारित HTTP ट्रांसपोर्ट जो क्वेरी, म्यूटेशन और मल्टीपार्ट सब्सक्रिप्शन को संभालता है, और एक वैकल्पिक WebSocket ट्रांसपोर्ट (graphql-transport-ws) जो किसी भी ऑपरेशन
apollo-router
apollographql
अपोलो राउटर एक उच्च-प्रदर्शन ग्राफ राउटर है जो रस्ट में लिखा गया है और अपोलो फेडरेशन 2 सुपरग्राफ चलाने के लिए है। यह आपके सबग्राफ के सामने बैठता है और क्वेरी योजना, निष्पादन और प्रतिक्रिया संरचना को संभालता है।
apollo-router-plugin-creator
apollographql
अपोलो राउटर के लिए मूल रस्ट प्लगइन बनाएं।
apollo-server
apollographql
Apollo Server 5.x के साथ विभिन्न फ्रेमवर्कों पर GraphQL सर्वर बनाने के लिए पूर्ण मार्गदर्शिका। इसमें स्कीमा परिभाषा, रिज़ॉल्वर, संदर्भ सेटअप, और TypeScript समर्थन के साथ त्रुटि प्रबंधन शामिल है। प्रोटोटाइपिंग के लिए स्टैंडअलोन मोड और Express, Fastify, Koa, तथा सर्वरलेस वातावरण के साथ एकीकरण का समर्थन करता है। इसमें रिज़ॉल्वर पैटर्न, प्रमाणीकरण/अधिकार, प्लगइन्स, N+1 रोकथाम के लिए DataLoader, और प्रदर्शन
graphql-operations
apollographql
कुशल, टाइप-सुरक्षित GraphQL ऑपरेशन लिखने और उन्हें फ्रैगमेंट के साथ व्यवस्थित करने के लिए सर्वोत्तम अभ्यास मार्गदर्शिका। इसमें नामकरण परंपराओं, वेरिएबल सिंटैक्स और डायरेक्टिव उपयोग के साथ क्वेरी, म्यूटेशन, सब्सक्रिप्शन और फ्रैगमेंट शामिल हैं। मुख्य सिद्धांतों पर जोर देती है: केवल आवश्यक फ़ील्ड का अनुरोध करें, सभी ऑपरेशनों को नाम दें, हार्डकोडेड मानों के बजाय वेरिएबल का उ
graphql-schema
apollographql
We need to translate the given English text to Hindi. The text is a description of a guide for GraphQL schema design. We must preserve the name "graphql-schema" but it's not in the text, so ignore. No extra labels. Translate only the text inside <text>. Output should be the translated text in Hindi. Let me translate: "Industry best practices guide for designing intuitive, performant, and maintainable GraphQL schemas. Covers core design principles including client-centric type organization, explicit nullability patterns, and backwards-compatible evolution strategies Provides reference documentation on types, naming conventions, cursor-based pagination, error modeling, and security considerations Includes practical patterns for interfaces, unions, input types, mutations, and ID strategies with code examples..." I'll translate into natural Hindi, keeping technical terms like GraphQL, cursor-based pagination, etc. as is or with appropriate Hindi transliteration. Ensure no extra commentary. Translation attempt: "सहज, उच्च प्रदर्शन और रखरखाव योग्य GraphQL स्कीम
rover
apollographql
Apollo Rover CLI ग्राफक्यूएल स्कीमा, फेडरेशन और स्थानीय सुपरग्राफ विकास के प्रबंधन के लिए है। सबग्राफ स्कीमा प्रकाशित करें, प्राप्त करें और मान्य करें; स्थानीय रूप से या GraphOS के माध्यम से फेडरेटेड सुपरग्राफ बनाएं। इसमें स्कीमा जाँच (प्री-डिप्लॉय मान्यकरण), लिंटिंग और चल रहे सर्वरों से इंट्रोस्पेक्शन शामिल है। rover dev कमांड विकास वर्कफ़्लो के लिए स्वचालित स्कीमा संयोजन के साथ एक स्थानीय