{"id":47857,"library":"graphql-codegen","title":"Apollo Codegen (apollo-codegen)","description":"CLI tool to generate typed client code (Swift initially, later TypeScript/Flow) from GraphQL schemas and query documents. Version 0.4.0 is early stage — only Swift output, no fragment support beyond exact type matches. Unstable API. Superseded by @graphql-codegen/cli (v1+) and Apollo CLI. Releases were sporadic. Differentiated as first codegen from Apollo, but quickly replaced.","status":"deprecated","version":"0.4.0","language":"javascript","source_language":"en","source_url":"https://github.com/apollostack/apollo-codegen","tags":["javascript"],"install":[{"cmd":"npm install graphql-codegen","lang":"bash","label":"npm"},{"cmd":"yarn add graphql-codegen","lang":"bash","label":"yarn"},{"cmd":"pnpm add graphql-codegen","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"required for schema introspection and parsing","package":"graphql","optional":false}],"imports":[{"note":"This is a CLI tool, not a library import.","wrong":"import { generate } from 'apollo-codegen'","symbol":"CLI","correct":"apollo-codegen generate ..."},{"note":"CLI commands, not programmatic API.","wrong":"const { downloadSchema } = require('apollo-codegen')","symbol":"downloadSchema","correct":"apollo-codegen download-schema"}],"quickstart":{"code":"npm install -g apollo-codegen@0.4.0\napollo-codegen download-schema http://localhost:4000/graphql --output schema.json --header \"Authorization: Bearer ${AUTH_TOKEN}\"\napollo-codegen generate 'queries/**/*.graphql' --schema schema.json --output API.swift --namespace MyAPI","lang":"typescript","description":"Install CLI, download schema with auth header, generate Swift code from .graphql files."},"warnings":[{"fix":"Migrate to @graphql-codegen/cli or @apollo/cli.","message":"This package is deprecated in favor of @graphql-codegen/cli or Apollo CLI.","severity":"deprecated","affected_versions":">=0"},{"fix":"Use @graphql-codegen/cli for multi-language output.","message":"Only generates Swift code (no TypeScript/Flow support).","severity":"gotcha","affected_versions":"<=0.4.0"},{"fix":"Rewrite fragments to match parent type or use later version.","message":"Fragments are only supported if their type condition matches exactly the parent type.","severity":"breaking","affected_versions":"<=0.4.0"},{"fix":"Use CLI directly or migrate to newer tools.","message":"Programmatic API is not stable — only CLI commands are documented.","severity":"gotcha","affected_versions":"<=0.4.0"}],"env_vars":null,"search_vec":"'/cli':45 '0.4.0':24 'api':39 'apollo':1,4,48,58 'apollo-codegen':3 'beyond':34 'cli':6,49 'client':11 'code':12 'codegen':2,5,44,56 'differenti':53 'document':22 'earli':26 'exact':35 'first':55 'fragment':32 'generat':9 'graphql':18,43 'graphql-codegen':42 'initi':14 'javascript':62 'later':15 'match':37 'output':30 'queri':21 'quick':60 'releas':50 'replac':61 'schema':19 'sporad':52 'stage':27 'supersed':40 'support':33 'swift':13,29 'tool':7 'type':10,36 'typescript/flow':16 'unstabl':38 'v1':46 'version':23","created_at":"2026-06-07T16:53:39.884546+00:00","updated_at":"2026-06-07T16:53:39.884546+00:00","problems":[{"fix":"Install globally: npm install -g apollo-codegen@0.4.0","cause":"Global install not found or not in PATH.","error":"Error: Cannot find module 'apollo-codegen'"},{"fix":"Ensure download-schema succeeded and path is correct.","cause":"Schema file path is incorrect or introspection failed.","error":"Error: Invalid schema file"},{"fix":"Change fragment type condition to match exact parent type.","cause":"Fragment type condition does not match parent type.","error":"Error: Unsupported fragment type condition"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/apollostack/apollo-codegen#readme","github":"https://github.com/apollostack/apollo-codegen","docs":null,"changelog":null,"pypi":null,"npm":"graphql-codegen","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}