Skip to content

Commit

Permalink
Incorporate #4426 change and merge segmented tables
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Barlow committed Aug 29, 2020
1 parent 1e809d5 commit cf5bc0b
Showing 1 changed file with 10 additions and 25 deletions.
35 changes: 10 additions & 25 deletions docs/source/api/apollo-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ const server = new ApolloServer({
});
```

##### Schema options
##### Options


| Name | Type | Description |
|------|------|-------------|
| **Schema options** |
| `typeDefs` | `DocumentNode` or `Array<DocumentNode>` | <p> **Required.** Document or documents that represent your server's GraphQL schema, generated by applying the [`gql`](#gql) tag to valid Schema Definition Language (SDL) strings.</p><p>For an example, see [Define your GraphQL schema](../getting-started/#step-3-define-your-graphql-schema).</p>|
| `resolvers` | `Object` | <p>**Required.** A map of functions that populate data for individual schema fields.</p> <p>For details, see [Resolvers](../data/resolvers/).</p> |
| `resolvers` | `Object` or `Array` | <p>**Required.** A map of functions that populate data for individual schema fields. Can also be an array of multiple maps that are merged.</p> <p>For details, see [Resolvers](../data/resolvers/).</p> |
| `context` | `Object` or `Function` | <p>An object (or a function that _creates_ an object) that's passed to every resolver that executes for a particular operation. This enables resolvers to share helpful context, such as a database connection.</p><p>[Certain fields](#middleware-specific-context-fields) are added to this object automatically, depending on which [Node.js middleware](../integrations/middleware/) your server uses.</p> <p>For more details, see [The `context` argument](../data/resolvers/#the-context-argument).</p> |
| `introspection` | `Boolean` | <p>If `true`, enables [schema introspection](https://graphql.org/learn/introspection/) by clients.</p><p>The default value is `true`, **unless** the `NODE_ENV` environment variable is set to `production`.</p> |
| `schemaDirectives` | `Object` | <p>A map of all [custom schema directives](../schema/directives/#using-custom-schema-directives) used in your schema, if any.</p> |
Expand All @@ -42,20 +44,12 @@ const server = new ApolloServer({
| `subscriptions` | `Object` or `String` or `false` | <p>Provide a `String` to specify the server's subscription-specific endpoint, or an `Object` to further [configure subscription behavior](#subscription-configuration-fields).</p><p>Provide `false` to disable subscription operations entirely.</p> |
| `rootValue` | `Any` or `Function` | <p>A value or function called with the parsed `Document`, creating the root value passed to the GraphQL executor.</p><p>Providing a function is useful if you want to use a different root value depending on the operation's details, such as whether it's a query or mutation.</p> |
| `validationRules` | `Object` | <p>An object containing custom functions to use as additional [validation rules](https://github.com/graphql/graphql-js/tree/master/src/validation/rules) when validating the schema.</p> |

##### Networking options

| Name | Type | Description |
|------|------|-------------|
| **Networking options** |
| `engine` | `EngineReportingOptions` | <p>An object containing configuration options for connecting Apollo Server to [Apollo Studio](https://www.apollographql.com/docs/studio/).</p><p>Supported fields are described in [EngineReportingOptions](#enginereportingoptions).</p> |
| `cors` | `Object` or `Boolean` | <p>An `Object` containing [configuration options](https://github.com/expressjs/cors#configuration-options) for the server's CORS behavior. Provide `false` to remove CORS middleware entirely.</p><p>This option is used only by the `apollo-server` package. If you're integrating with Node.js middleware via a different package, instead see [`applyMiddleware`](#applymiddleware).</p> |
| `formatError`| `Function` | Provide this function to transform the structure of error objects before they're sent to a client. The function takes a [`GraphQLError`](https://github.com/graphql/graphql-js/blob/master/src/error/GraphQLError.js) object and should return a [`GraphQLFormattedError`](https://github.com/graphql/graphql-js/blob/master/src/error/formatError.js#L26) object. |
| `formatResponse` | `Function` | Provide this function to transform the structure of GraphQL response objects before they're sent to a client. The function takes a [`GraphQLResponse`](https://github.com/apollographql/apollo-server/blob/main/packages/apollo-server-types/src/index.ts#L77-L82) object and a [`GraphQLRequestContext`](https://github.com/apollographql/apollo-server/blob/main/packages/apollo-server-types/src/index.ts#L95-L130) object, and it should return a `GraphQLResponse` object. |

##### Debugging options

| Name | Type | Description |
|------------|------|-------------|
| **Debugging options** |
| `playground` | `Boolean` or `Object` | <p>If truthy, the server hosts [GraphQL Playground](../testing/graphql-playground) from its URL. Can be an object to pass [configuration options](https://github.com/prismagraphql/graphql-playground/#usage) to the playground.</p><p>The default value is `true`, **unless** the `NODE_ENV` environment variable is set to `production`.</p><p>Note that `introspection` must be enabled for GraphQL Playground to function properly.</p> |
| `debug` | `Boolean` | <p>If `true`, enables development mode helpers and logs messages of all severity levels (`debug` through `error`). If `false`, only `warn`- and `error`-level messages are logged.</p><p>Defaults to `true`.</p> |
| `logger` | [`Logger`](https://github.com/apollographql/apollo-server/blob/main/packages/apollo-server-types/src/index.ts#L146-L152) | <p>An object to use for logging in place of `console`. If provided, this object must implement all methods of [the `Logger` interface](https://github.com/apollographql/apollo-server/blob/main/packages/apollo-server-types/src/index.ts#L146-L152).</p><p>If you provide this value, Apollo Server automatically logs all messages of _all_ severity levels (`debug` through `error`), regardless of whether the `debug` option is set to `true`. It is the responsibility of the logger to determine how to handle logged messages of each level.</p><p>This logger is automatically added to the `GraphQLRequestContext` object that's passed to all Apollo Server [plugin functions](../integrations/plugins/).</p> |
Expand Down Expand Up @@ -200,7 +194,7 @@ The `makeExecutableSchema` method is re-exported from apollo-server as a conveni

* `options` : <`Object`>
* `typeDefs`: <`GraphQLSchema`> _(required)_
* `resolvers` : <`Object`>
* `resolvers` : <`Object`> : <`Array<Object>`>
* `logger` : <`Object`>
* `allowUndefinedInResolve` = false
* `resolverValidationOptions` = {}
Expand Down Expand Up @@ -267,26 +261,17 @@ addMockFunctionsToSchema({

These are the supported fields of the `engine` object you provide to the [`ApolloServer` constructor](#constructoroptions-apolloserver) to configure communication with [Apollo Studio](https://www.apollographql.com/docs/studio/).

##### Base configuration fields

| Name | Type | Description |
|------|------|-------------|
| **Base config** |
| `apiKey` | `String` | <p>The [graph API key](https://www.apollographql.com/docs/studio/api-keys/#graph-api-keys) that Apollo Server should use to authenticate with Apollo Studio.</p><p>Instead of using this field, we recommend providing your API key by setting it as the value of the `APOLLO_KEY` environment variable in your server's environment.</p> |
| `graphVariant` | `String` | <p>The [variant](https://www.apollographql.com/docs/studio/schema/registry/#managing-environments-with-variants) of your graph to associate this server's schema and metrics with.</p><p>Instead of using this field, we recommend specifying a variant by setting its name as the value of the `APOLLO_GRAPH_VARIANT` environment variable in your server's environment.</p> |
| `logger` | [`Logger`](https://github.com/apollographql/apollo-server/blob/main/packages/apollo-server-types/src/index.ts#L146-L152) | <p>If you provide this object, Apollo Server sends it all log messages related to Apollo Studio communication, instead of sending them to the default logger. The object must implement all methods of [the `Logger` interface](https://github.com/apollographql/apollo-server/blob/main/packages/apollo-server-types/src/index.ts#L146-L152).</p> |

##### Schema reporting fields

| Name | Type | Description |
|------|------|-------------|
| **Schema reporting** |
| `reportSchema` | `Boolean` | <p>If `true`, Apollo Server begins periodically [reporting its schema](https://www.apollographql.com/docs/studio/schema/schema-reporting/) to Apollo Studio shortly after startup.</p><p>The default value is `false`.</p> |
| `schemaReportingInitialDelayMaxMs` | `Number` | <p>On startup, Apollo Server waits a random amount of time between 0 milliseconds and this value before it begins reporting its schema. This randomness is useful for staggering schema reports when you deploy multiple server instances simultaneously.</p><p>The default value is 10 seconds (`10000`). You might want to reduce this value in constrained environments, such as AWS Lambda.</p> |
| `overrideReportedSchema` | `String` | <p>By default, Apollo Server **normalizes** its schema before reporting it to Apollo Studio. Doing so helps make sure that no-op changes to a schema's whitespace or field order aren't incorrectly identified as an updated schema.</p><p>If normalization removes details that you want to preserve, you can provide an SDL string directly to this option. If you do, it is reported directly to Studio instead of the server's normalized schema.</p> |

##### Metrics reporting fields

| Name | Type | Description |
|------|------|-------------|
| **Metrics reporting** |
| `reportIntervalMs` | `Number` | <p>The interval at which Apollo Server should send batched trace reports to Studio, in milliseconds.</p><p>Regardless of this value, Apollo Server sends a trace report whenever the size of a pending batch exceeds the value of `maxUncompressedReportSize` (default 4MB).</p> |
| `maxUncompressedReportSize` | `Number` | <p>Apollo Server sends a trace report whenever the size of a pending batched trace report exceeds this value (in bytes), regardless of its standard reporting interval.</p><p>The default value is 4MB (`4194304`).</p> |
| `maxAttempts` | `Number` | <p>The maximum number of times Apollo Server should attempt to report each trace report, performing exponential backoff between attempts.</p><p>The default value is `5`.</p> |
Expand Down

0 comments on commit cf5bc0b

Please sign in to comment.