Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
- Improve client:check output [#934](https://github.com/apollographql/apollo-tooling/pull/934)
- `apollo-language-server`
- Replace checkOperations mutation with new validateOperations mutation [#934](https://github.com/apollographql/apollo-tooling/pull/934)
- Fix language server mis-reporting client identity for schema loading operation [#940](https://github.com/apollographql/apollo-tooling/pull/940)
- `vscode-apollo`
- Fix graphql comments not being highlighted correctly [#907](https://github.com/apollographql/apollo-tooling/pull/907)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this one in 😄

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

giphy-2


## `apollo@2.3.1`

Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-language-server/src/project/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export abstract class GraphQLProject implements GraphQLSchemaProvider {
this.config = config;
this.fileSet = fileSet;
this.loadingHandler = loadingHandler;
this.schemaProvider = schemaProviderFromConfig(config);
this.schemaProvider = schemaProviderFromConfig(config, clientIdentity);
const { engine } = config;
if (engine.apiKey) {
this.engineClient = new ApolloEngineClient(
Expand Down
14 changes: 11 additions & 3 deletions packages/apollo-language-server/src/schema/providers/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import gql from "graphql-tag";

import { GraphQLSchema, buildClientSchema } from "graphql";

import { ApolloEngineClient } from "../../engine";
import { ApolloEngineClient, ClientIdentity } from "../../engine";
import { ClientConfig, parseServiceSpecificer } from "../../config";
import {
GraphQLSchemaProvider,
Expand All @@ -17,7 +17,11 @@ export class EngineSchemaProvider implements GraphQLSchemaProvider {
private schema?: GraphQLSchema;
private client?: ApolloEngineClient;

constructor(private config: ClientConfig) {}
constructor(
private config: ClientConfig,
private clientIdentity?: ClientIdentity
) {}

async resolveSchema(override: SchemaResolveConfig) {
if (this.schema && (!override || !override.force)) return this.schema;
const { engine, client } = this.config;
Expand All @@ -33,7 +37,11 @@ export class EngineSchemaProvider implements GraphQLSchemaProvider {
if (!engine.apiKey) {
throw new Error("ENGINE_API_KEY not found");
}
this.client = new ApolloEngineClient(engine.apiKey, engine.endpoint);
this.client = new ApolloEngineClient(
engine.apiKey,
engine.endpoint,
this.clientIdentity
);
}

const [id, tag = "current"] = parseServiceSpecificer(client.service);
Expand Down
6 changes: 4 additions & 2 deletions packages/apollo-language-server/src/schema/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import { IntrospectionSchemaProvider } from "./introspection";
import { EngineSchemaProvider } from "./engine";
import { FileSchemaProvider } from "./file";
import { ClientIdentity } from "../../engine";

export {
GraphQLSchemaProvider,
Expand All @@ -21,7 +22,8 @@ export {
};

export function schemaProviderFromConfig(
config: ApolloConfig
config: ApolloConfig,
clientIdentity?: ClientIdentity // engine provider needs this
): GraphQLSchemaProvider {
if (isServiceConfig(config)) {
if (config.service.localSchemaFile) {
Expand All @@ -35,7 +37,7 @@ export function schemaProviderFromConfig(

if (isClientConfig(config)) {
if (typeof config.client.service === "string") {
return new EngineSchemaProvider(config);
return new EngineSchemaProvider(config, clientIdentity);
}

if (config.client.service) {
Expand Down