Socket
Socket
Sign inDemoInstall

graphql-codegen

Package Overview
Dependencies
7
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    graphql-codegen

Generate client code based on a GraphQL schema and query documents


Version published
Weekly downloads
13K
decreased by-2.93%
Maintainers
1
Install size
4.26 MB
Created
Weekly downloads
 

Changelog

Source

apollo@2.16.0, apollo-codegen-swift@0.34.0, apollo-language-server@1.13.0, apollo-tools@0.4.0, vscode-apollo@1.8.0

  • apollo@2.16.0
    • Add service:list and tests #1358 and header #1377
    • Update service:list test to use a simulated time to prevent relative dates causing snapshot failures #1374
    • Update service:check to support --markdown and --json flags for federated schema #1378
    • Exit status code 1 after composition errors in service:push #1403
    • Update service:check to include graphCompositionId in query params for UI #1401
  • apollo-codegen-swift@0.34.0
    • Update Swift codegen to add operation name to generated query classes #1386
    • Append terminating newline character to generated files #531
  • apollo-language-server@1.13.0
    • Allow template literal placeholders that span multiple rows#1299
    • Add support for extracting GraphQL documents from Ruby source files using <<-GRAPHQL...GRAPHQL heredoc. #1304
  • apollo-tools@0.4.0
    • Handle subscribe in buildServiceDefinition and add type in resolverMap #1047
  • vscode-apollo@1.8.0
    • Add support for Ruby source files using <<-GRAPHQL...GRAPHQL heredoc. #1304

Readme

Source

Apollo client code generator

This is a tool to generate client code based on a GraphQL schema and query documents.

It currently only generates Swift code, and only for a subset of GraphQL queries. Most importantly, fragments are only supported if their type condition matches their parent type exactly. See Apollo iOS for details on the proposed mapping from GraphQL results to Swift types, as well as runtime support for performing queries.

Getting Started

Apollo iOS Quickstart is a sample Xcode project that makes it easy to get started with a generated API for your own schema and queries.

Usage

If you want to experiment with the tool, you can install the apollo-codegen command globally:

npm install apollo-codegen -g

To download a GraphQL schema by sending an introspection query to a server:

apollo-codegen download-schema http://localhost:8080/graphql --output GitHuntAPI/Definitions/schema.json

You can use the header option to add additional HTTP headers to the request. For example, to include an authentication token, use --header "Authorization: Bearer <token>".

To generate Swift code from a set of query definitions in .graphql files:

apollo-codegen generate GitHuntAPI/Definitions/**/*.graphql --schema GitHuntAPI/Definitions/schema.json --output GitHuntAPI/GitHuntAPI.swift

FAQs

Last updated on 22 Sep 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc