Skip to content

Commit

Permalink
Support recent versions of introspection json (#59)
Browse files Browse the repository at this point in the history
* Support recent versions of introspection json

* Update Introspection type
  • Loading branch information
kristiehowboutdat authored and 2fd committed Jun 18, 2019
1 parent 1459746 commit 40ecde3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions lib/interface.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,11 @@ type refToUrl = (typeName: TypeRef) => string;
* Introspection types
*/
type Introspection = {
data: {
__schema: Schema;
};
data: {
__schema: Schema
}
} | {
__schema: Schema
};

type Schema = {
Expand Down
2 changes: 1 addition & 1 deletion lib/schema-loader/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const jsonSchemaLoader: SchemaLoader = (
try {
const schemaPath = resolve(options.schemaFile);
const introspection: Introspection = require(schemaPath);
return Promise.resolve(introspection.data.__schema);
return Promise.resolve(introspection.__schema || introspection.data.__schema);
} catch (err) {
return Promise.reject(err);
}
Expand Down

0 comments on commit 40ecde3

Please sign in to comment.