@graphql-toolkit/common
Advanced tools
Comparing version 0.9.13-alpha-ef52b30.9 to 0.9.13-alpha-f1e4c5e.9
@@ -428,4 +428,3 @@ 'use strict'; | ||
}; | ||
let errors = graphql.validate(schema, documentToValidate, effectiveRules); | ||
skipUnusedFragmentsInNonOperations(documentToValidate, errors); | ||
const errors = skipUnusedFragmentsInNonOperations(documentToValidate, graphql.validate(schema, documentToValidate, effectiveRules)); | ||
if (errors.length > 0) { | ||
@@ -464,9 +463,9 @@ allErrors.push({ | ||
function skipUnusedFragmentsInNonOperations(doc, errors) { | ||
if (!errors.length) { | ||
return; | ||
if (errors.length > 0) { | ||
const isFragmentOnly = doc.definitions.some((def) => def.kind === 'OperationDefinition') === false; | ||
if (isFragmentOnly) { | ||
return errors.filter((error) => error.message.includes('is never used') === false); | ||
} | ||
} | ||
const isFragmentOnly = doc.definitions.some((def) => def.kind === 'OperationDefinition') === false; | ||
if (isFragmentOnly) { | ||
errors = errors.filter((error) => error.message.includes('is never used') === false); | ||
} | ||
return errors; | ||
} | ||
@@ -473,0 +472,0 @@ |
@@ -403,4 +403,3 @@ import { parse, buildASTSchema, isScalarType, isObjectType, isInterfaceType, isEnumType, isUnionType, getDirectiveValues, Kind, defaultFieldResolver, isSpecifiedScalarType, isIntrospectionType, print, printType, specifiedRules, validate, buildSchema, buildClientSchema, Source, isListType, isNonNullType, getNamedType } from 'graphql'; | ||
}; | ||
let errors = validate(schema, documentToValidate, effectiveRules); | ||
skipUnusedFragmentsInNonOperations(documentToValidate, errors); | ||
const errors = skipUnusedFragmentsInNonOperations(documentToValidate, validate(schema, documentToValidate, effectiveRules)); | ||
if (errors.length > 0) { | ||
@@ -439,9 +438,9 @@ allErrors.push({ | ||
function skipUnusedFragmentsInNonOperations(doc, errors) { | ||
if (!errors.length) { | ||
return; | ||
if (errors.length > 0) { | ||
const isFragmentOnly = doc.definitions.some((def) => def.kind === 'OperationDefinition') === false; | ||
if (isFragmentOnly) { | ||
return errors.filter((error) => error.message.includes('is never used') === false); | ||
} | ||
} | ||
const isFragmentOnly = doc.definitions.some((def) => def.kind === 'OperationDefinition') === false; | ||
if (isFragmentOnly) { | ||
errors = errors.filter((error) => error.message.includes('is never used') === false); | ||
} | ||
return errors; | ||
} | ||
@@ -448,0 +447,0 @@ |
{ | ||
"name": "@graphql-toolkit/common", | ||
"version": "0.9.13-alpha-ef52b30.9+ef52b30", | ||
"version": "0.9.13-alpha-f1e4c5e.9+f1e4c5e", | ||
"description": "Common package containting utils and types for GraphQL Toolkit", | ||
@@ -5,0 +5,0 @@ "peerDependencies": { |
@@ -12,1 +12,2 @@ export interface SchemaPrintOptions { | ||
} | ||
export declare type Maybe<T> = null | undefined | T; |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
85331
2186