graphql-import
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -13,3 +13,3 @@ "use strict"; | ||
} | ||
var collectedTypedDefinitions = collectNewTypeDefinitions(defintionPool, newDefinition, schemaMap, schemaPath); | ||
var collectedTypedDefinitions = collectNewTypeDefinitions(allDefinitions, defintionPool, newDefinition, schemaMap, schemaPath); | ||
newTypeDefinitions.push.apply(newTypeDefinitions, collectedTypedDefinitions); | ||
@@ -22,3 +22,3 @@ defintionPool.push.apply(defintionPool, collectedTypedDefinitions); | ||
exports.completeDefinitionPool = completeDefinitionPool; | ||
function collectNewTypeDefinitions(definitionPool, newDefinition, schemaMap, schemaPath) { | ||
function collectNewTypeDefinitions(allDefinitions, definitionPool, newDefinition, schemaMap, schemaPath) { | ||
var newTypeDefinitions = []; | ||
@@ -41,2 +41,3 @@ if (newDefinition.kind === 'InputObjectTypeDefinition') { | ||
if (newDefinition.kind === 'InterfaceTypeDefinition') { | ||
var interfaceName_1 = newDefinition.name.value; | ||
newDefinition.fields.forEach(function (field) { | ||
@@ -54,2 +55,7 @@ var namedType = getNamedType(field.type); | ||
}); | ||
var interfaceImplementations = allDefinitions.filter(function (d) { | ||
return d.kind === 'ObjectTypeDefinition' && | ||
d.interfaces.some(function (i) { return i.name.value === interfaceName_1; }); | ||
}); | ||
newTypeDefinitions.push.apply(newTypeDefinitions, interfaceImplementations); | ||
} | ||
@@ -56,0 +62,0 @@ if (newDefinition.kind === 'UnionTypeDefinition') { |
@@ -66,2 +66,6 @@ "use strict"; | ||
}); | ||
ava_1.default('importSchema: interfaces-implements', function (t) { | ||
var expectedSDL = "type A implements B {\n id: ID!\n}\n\ninterface B {\n id: ID!\n}\n\ntype B1 implements B {\n id: ID!\n}\n"; | ||
t.is(_1.importSchema('fixtures/interfaces-implements/a.graphql'), expectedSDL); | ||
}); | ||
ava_1.default('importSchema: input types', function (t) { | ||
@@ -68,0 +72,0 @@ var expectedSDL = "type A {\n first(b: B): String @first\n second: Float\n}\n\ninput B {\n hello: [C!]!\n}\n\ninput C {\n id: ID!\n}\n"; |
{ | ||
"name": "graphql-import", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:graphcool/graphql-import.git", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28160
284