Socket
Socket
Sign inDemoInstall

apollo-codegen

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-codegen - npm Package Compare versions

Comparing version 0.16.4 to 0.16.5

lib/scala/codeGeneration.js

4

lib/cli.js

@@ -107,3 +107,3 @@ #!/usr/bin/env node

describe: 'Code generation target language',
choices: ['swift', 'json', 'ts', 'typescript', 'flow'],
choices: ['swift', 'scala', 'json', 'ts', 'typescript', 'flow'],
default: 'swift'

@@ -113,3 +113,3 @@ },

demand: false,
describe: 'Optional namespace for generated types [currently Swift-only]',
describe: 'Optional namespace for generated types [currently Swift and Scala-only]',
type: 'string'

@@ -116,0 +116,0 @@ },

@@ -11,2 +11,3 @@ "use strict";

const flow_1 = require("./flow");
const scala_1 = require("./scala");
function generate(inputPaths, schemaPath, outputPath, target, tagName, options) {

@@ -35,2 +36,4 @@ const schema = loading_1.loadSchema(schemaPath);

break;
case 'scala':
output = scala_1.generateSource(context, options);
}

@@ -37,0 +40,0 @@ if (outputPath) {

{
"name": "apollo-codegen",
"version": "0.16.4",
"version": "0.16.5",
"description": "Generate API code or type annotations based on a GraphQL schema and query documents",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -7,5 +7,5 @@ # Apollo GraphQL code generator

It currently generates Swift code, TypeScript annotations and Flow annotations, we hope to add support for other targets in the future.
It currently generates Swift code, TypeScript annotations, Flow annotations, and Scala code, we hope to add support for other targets in the future.
See [Apollo iOS](https://github.com/apollographql/apollo-ios) for details on the mapping from GraphQL results to Swift types, as well as runtime support for executing queries and mutations.
See [Apollo iOS](https://github.com/apollographql/apollo-ios) for details on the mapping from GraphQL results to Swift types, as well as runtime support for executing queries and mutations. For Scala, see [React Apollo Scala.js](https://github.com/apollographql/react-apollo-scalajs) for details on how to use generated Scala code in a Scala.js app with Apollo Client.

@@ -48,3 +48,3 @@ ## Usage

You can also generate type annotations for TypeScript or Flow using the `--target` option:
You can also generate type annotations for TypeScript, Flow, or Scala using the `--target` option:

@@ -56,2 +56,4 @@ ```sh

apollo-codegen generate **/*.graphql --schema schema.json --target flow --output schema.flow.js
# Scala
apollo-codegen generate **/*.graphql --schema schema.json --target scala --output schema.scala
```

@@ -69,3 +71,3 @@

If you're using a client like `apollo-client` that does this automatically for your GraphQL operations, pass in the -`-addTypename` option to `apollo-codegen` to make sure the generated Typescript and Flow types have the `__typename` field as well. This is required to ensure proper type generation support for `GraphQLUnionType` and `GraphQLInterfaceType` fields.
If you're using a client like `apollo-client` that does this automatically for your GraphQL operations, pass in the -`-addTypename` option to `apollo-codegen` to make sure the generated Typescript and Flow types have the `__typename` field as well. This is required to ensure proper type generation support for `GraphQLUnionType` and `GraphQLInterfaceType` fields.

@@ -105,7 +107,7 @@ ### Why is the __typename field required?

name
... on Human {
homePlanet
}
... on Droid {

@@ -112,0 +114,0 @@ primaryFunction

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc