graphql-language-service-utils
Advanced tools
Comparing version 2.7.0-canary-efc41fcd.0 to 2.7.0-canary-fae7d199.0
@@ -7,3 +7,3 @@ import type { VariableToType } from './collectVariables'; | ||
}; | ||
export declare function getOperationASTFacts(documentAST: DocumentNode, schema?: GraphQLSchema): OperationASTFacts; | ||
export declare function getOperationASTFacts(documentAST: DocumentNode, schema?: GraphQLSchema | null): OperationASTFacts; | ||
export declare type OperationFacts = { | ||
@@ -13,4 +13,4 @@ documentAST: DocumentNode; | ||
export declare type QueryFacts = OperationFacts; | ||
export default function getOperationFacts(schema?: GraphQLSchema, documentString?: string | null): OperationFacts | undefined; | ||
export default function getOperationFacts(schema?: GraphQLSchema | null, documentString?: string | null): OperationFacts | undefined; | ||
export declare const getQueryFacts: typeof getOperationFacts; | ||
//# sourceMappingURL=getOperationFacts.d.ts.map |
@@ -1,5 +0,26 @@ | ||
import type { JSONSchema6, JSONSchema6TypeName } from 'json-schema'; | ||
import type { JSONSchema6, JSONSchema6Definition, JSONSchema6TypeName } from 'json-schema'; | ||
import type { VariableToType } from './collectVariables'; | ||
export type { JSONSchema6, JSONSchema6TypeName }; | ||
export declare function getVariablesJSONSchema(variableToType: VariableToType): JSONSchema6; | ||
export declare type JsonSchemaOptions = { | ||
useMarkdownDescription?: boolean; | ||
}; | ||
export declare type JSONSchemaOptions = { | ||
useMarkdownDescription?: boolean; | ||
}; | ||
export declare const defaultJSONSchemaOptions: { | ||
useMarkdownDescription: boolean; | ||
}; | ||
export declare type MonacoEditorJSONSchema = JSONSchema6 & { | ||
markdownDescription?: string; | ||
}; | ||
export declare type CombinedSchema = JSONSchema6 | MonacoEditorJSONSchema; | ||
declare type Definitions = { | ||
[k: string]: JSONSchema6Definition; | ||
}; | ||
export declare type DefinitionResult = { | ||
definition: JSONSchema6 | MonacoEditorJSONSchema; | ||
required: boolean; | ||
definitions?: Definitions; | ||
}; | ||
export declare function getVariablesJSONSchema(variableToType: VariableToType, options?: JSONSchemaOptions): JSONSchema6; | ||
//# sourceMappingURL=getVariablesJSONSchema.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getVariablesJSONSchema = void 0; | ||
exports.getVariablesJSONSchema = exports.defaultJSONSchemaOptions = void 0; | ||
const graphql_1 = require("graphql"); | ||
@@ -17,8 +17,7 @@ const scalarTypesMap = { | ||
}; | ||
const listType = (definition, type) => { | ||
var _a; | ||
const listType = (definition, type, definitions) => { | ||
definition.type = 'array'; | ||
definition.items = { | ||
type: (_a = scalarTypesMap[type.ofType]) !== null && _a !== void 0 ? _a : type.ofType, | ||
}; | ||
const { definition: def, definitions: defs } = getJSONSchemaFromGraphQLType(type.ofType); | ||
definition.items = { $ref: def.$ref }; | ||
definitions = Object.assign(Object.assign({}, definitions), defs); | ||
}; | ||
@@ -29,23 +28,82 @@ const enumType = (definition, type) => { | ||
}; | ||
const objectType = (definition, type) => { | ||
definition.type = 'object'; | ||
const fields = type.getFields(); | ||
if (!definition.properties) { | ||
definition.properties = {}; | ||
const inputObjectType = (definition, type, definitions, options) => { | ||
definition.$ref = `#/definitions/${type.name}`; | ||
definition.description = undefined; | ||
if (!definitions || !definitions[type.name]) { | ||
const fields = type.getFields(); | ||
const fieldDef = { | ||
type: 'object', | ||
properties: {}, | ||
required: [], | ||
}; | ||
if (type.description) { | ||
fieldDef.description = type.description; | ||
} | ||
if (options === null || options === void 0 ? void 0 : options.useMarkdownDescription) { | ||
fieldDef.markdownDescription = type.description; | ||
} | ||
Object.keys(fields).forEach(fieldName => { | ||
const field = fields[fieldName]; | ||
const { required, definition: typeDefinition, } = getJSONSchemaFromGraphQLType(field.type, options); | ||
const { definition: fieldDefinition } = getJSONSchemaFromGraphQLType(fields[fieldName], options); | ||
fieldDef.properties[fieldName] = Object.assign(Object.assign({}, typeDefinition), fieldDefinition); | ||
if (required) { | ||
fieldDef.required.push(fieldName); | ||
} | ||
}); | ||
definitions[type.name] = fieldDef; | ||
} | ||
definition.required = []; | ||
Object.keys(fields).forEach(fieldName => { | ||
const { required, definition: fieldDefinition, } = getJSONSchemaFromGraphQLType(fields[fieldName].type); | ||
definition.properties[fieldName] = fieldDefinition; | ||
if (required) { | ||
definition.required.push(fieldName); | ||
} | ||
}); | ||
else { | ||
return; | ||
} | ||
}; | ||
function getJSONSchemaFromGraphQLType(type) { | ||
exports.defaultJSONSchemaOptions = { | ||
useMarkdownDescription: false, | ||
}; | ||
function text(into, newText) { | ||
into.push(newText); | ||
} | ||
function renderType(into, t) { | ||
if (!t) { | ||
return; | ||
} | ||
if (graphql_1.isNonNullType(t)) { | ||
renderType(into, t.ofType); | ||
text(into, '!'); | ||
} | ||
else if (t instanceof graphql_1.GraphQLList) { | ||
text(into, '['); | ||
renderType(into, t.ofType); | ||
text(into, ']'); | ||
} | ||
else { | ||
text(into, t.name); | ||
} | ||
} | ||
function renderTypeToString(t, useMarkdown) { | ||
const into = []; | ||
if (useMarkdown) { | ||
text(into, '\n```graphql\n'); | ||
} | ||
renderType(into, t); | ||
if (useMarkdown) { | ||
text(into, '\n```\n'); | ||
} | ||
return into.join(''); | ||
} | ||
function getJSONSchemaFromGraphQLType(type, options) { | ||
let required = false; | ||
let definition = {}; | ||
if ('description' in type) { | ||
definition.description = type.description; | ||
let definitions = {}; | ||
definition.description = renderTypeToString(type); | ||
const hasDescription = 'description' in type && type.description; | ||
if ('description' in type && type.description) { | ||
definition.description += type.description; | ||
} | ||
if (options === null || options === void 0 ? void 0 : options.useMarkdownDescription) { | ||
definition.markdownDescription = renderTypeToString(type, true); | ||
if (hasDescription) { | ||
definition.markdownDescription += type.description; | ||
} | ||
} | ||
if ('defaultValue' in type) { | ||
@@ -58,17 +116,19 @@ definition.default = type.defaultValue; | ||
if (graphql_1.isInputObjectType(type)) { | ||
objectType(definition, type); | ||
inputObjectType(definition, type, definitions, options); | ||
} | ||
if (graphql_1.isListType(type)) { | ||
listType(definition, type); | ||
} | ||
if (graphql_1.isScalarType(type)) { | ||
scalarType(definition, type); | ||
} | ||
if (graphql_1.isListType(type)) { | ||
listType(definition, type, definitions); | ||
} | ||
if (graphql_1.isNonNullType(type)) { | ||
required = true; | ||
definition = getJSONSchemaFromGraphQLType(type.ofType).definition; | ||
const { definition: def, definitions: defs } = getJSONSchemaFromGraphQLType(type.ofType, options); | ||
definition = def; | ||
definitions = Object.assign(Object.assign({}, definitions), defs); | ||
} | ||
return { required, definition }; | ||
return { required, definition, definitions }; | ||
} | ||
function getVariablesJSONSchema(variableToType) { | ||
function getVariablesJSONSchema(variableToType, options) { | ||
const jsonSchema = { | ||
@@ -83,3 +143,3 @@ $schema: 'https://json-schema.org/draft/2020-12/schema', | ||
var _a; | ||
const { definition, required } = getJSONSchemaFromGraphQLType(type); | ||
const { definition, required, definitions, } = getJSONSchemaFromGraphQLType(type, options); | ||
jsonSchema.properties[variableName] = definition; | ||
@@ -89,2 +149,5 @@ if (required) { | ||
} | ||
if (definitions) { | ||
jsonSchema.definitions = definitions; | ||
} | ||
}); | ||
@@ -91,0 +154,0 @@ } |
@@ -7,3 +7,4 @@ export { getFragmentDependencies, getFragmentDependenciesForAST, } from './fragmentDependencies'; | ||
export { collectVariables, VariableToType } from './collectVariables'; | ||
export { fillLeafs, GetDefaultFieldNamesFn, buildSelectionSet, defaultGetDefaultFieldNames, } from './fillLeafs'; | ||
export { default as getOperationFacts, getOperationASTFacts, getQueryFacts, OperationFacts, QueryFacts, } from './getOperationFacts'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getQueryFacts = exports.getOperationASTFacts = exports.getOperationFacts = exports.collectVariables = exports.validateWithCustomRules = exports.offsetToPosition = exports.locToRange = exports.Range = exports.Position = exports.pointToOffset = exports.getASTNodeAtPosition = exports.getVariablesJSONSchema = exports.getFragmentDependenciesForAST = exports.getFragmentDependencies = void 0; | ||
exports.getQueryFacts = exports.getOperationASTFacts = exports.getOperationFacts = exports.defaultGetDefaultFieldNames = exports.buildSelectionSet = exports.fillLeafs = exports.collectVariables = exports.validateWithCustomRules = exports.offsetToPosition = exports.locToRange = exports.Range = exports.Position = exports.pointToOffset = exports.getASTNodeAtPosition = exports.getVariablesJSONSchema = exports.getFragmentDependenciesForAST = exports.getFragmentDependencies = void 0; | ||
var fragmentDependencies_1 = require("./fragmentDependencies"); | ||
@@ -25,2 +25,6 @@ Object.defineProperty(exports, "getFragmentDependencies", { enumerable: true, get: function () { return fragmentDependencies_1.getFragmentDependencies; } }); | ||
Object.defineProperty(exports, "collectVariables", { enumerable: true, get: function () { return collectVariables_1.collectVariables; } }); | ||
var fillLeafs_1 = require("./fillLeafs"); | ||
Object.defineProperty(exports, "fillLeafs", { enumerable: true, get: function () { return fillLeafs_1.fillLeafs; } }); | ||
Object.defineProperty(exports, "buildSelectionSet", { enumerable: true, get: function () { return fillLeafs_1.buildSelectionSet; } }); | ||
Object.defineProperty(exports, "defaultGetDefaultFieldNames", { enumerable: true, get: function () { return fillLeafs_1.defaultGetDefaultFieldNames; } }); | ||
var getOperationFacts_1 = require("./getOperationFacts"); | ||
@@ -27,0 +31,0 @@ Object.defineProperty(exports, "getOperationFacts", { enumerable: true, get: function () { return __importDefault(getOperationFacts_1).default; } }); |
import { ValidationRule, DocumentNode, GraphQLError, GraphQLSchema } from 'graphql'; | ||
export declare function validateWithCustomRules(schema: GraphQLSchema, ast: DocumentNode, customRules?: Array<ValidationRule> | null, isRelayCompatMode?: boolean): Array<GraphQLError>; | ||
export declare function validateWithCustomRules(schema: GraphQLSchema, ast: DocumentNode, customRules?: Array<ValidationRule> | null, isRelayCompatMode?: boolean, isSchemaDocument?: boolean): Array<GraphQLError>; | ||
//# sourceMappingURL=validateWithCustomRules.d.ts.map |
@@ -5,3 +5,17 @@ "use strict"; | ||
const graphql_1 = require("graphql"); | ||
function validateWithCustomRules(schema, ast, customRules, isRelayCompatMode) { | ||
const specifiedSDLRules = [ | ||
graphql_1.LoneSchemaDefinitionRule, | ||
graphql_1.UniqueOperationTypesRule, | ||
graphql_1.UniqueTypeNamesRule, | ||
graphql_1.UniqueEnumValueNamesRule, | ||
graphql_1.UniqueFieldDefinitionNamesRule, | ||
graphql_1.UniqueDirectiveNamesRule, | ||
graphql_1.KnownTypeNamesRule, | ||
graphql_1.KnownDirectivesRule, | ||
graphql_1.UniqueDirectivesPerLocationRule, | ||
graphql_1.PossibleTypeExtensionsRule, | ||
graphql_1.UniqueArgumentNamesRule, | ||
graphql_1.UniqueInputFieldNamesRule, | ||
]; | ||
function validateWithCustomRules(schema, ast, customRules, isRelayCompatMode, isSchemaDocument) { | ||
const rules = graphql_1.specifiedRules.filter(rule => { | ||
@@ -19,2 +33,5 @@ if (rule === graphql_1.NoUnusedFragmentsRule || rule === graphql_1.ExecutableDefinitionsRule) { | ||
} | ||
if (isSchemaDocument) { | ||
Array.prototype.push.apply(rules, specifiedSDLRules); | ||
} | ||
const errors = graphql_1.validate(schema, ast, rules); | ||
@@ -21,0 +38,0 @@ return errors.filter(error => { |
@@ -7,3 +7,3 @@ import type { VariableToType } from './collectVariables'; | ||
}; | ||
export declare function getOperationASTFacts(documentAST: DocumentNode, schema?: GraphQLSchema): OperationASTFacts; | ||
export declare function getOperationASTFacts(documentAST: DocumentNode, schema?: GraphQLSchema | null): OperationASTFacts; | ||
export declare type OperationFacts = { | ||
@@ -13,4 +13,4 @@ documentAST: DocumentNode; | ||
export declare type QueryFacts = OperationFacts; | ||
export default function getOperationFacts(schema?: GraphQLSchema, documentString?: string | null): OperationFacts | undefined; | ||
export default function getOperationFacts(schema?: GraphQLSchema | null, documentString?: string | null): OperationFacts | undefined; | ||
export declare const getQueryFacts: typeof getOperationFacts; | ||
//# sourceMappingURL=getOperationFacts.d.ts.map |
@@ -1,5 +0,26 @@ | ||
import type { JSONSchema6, JSONSchema6TypeName } from 'json-schema'; | ||
import type { JSONSchema6, JSONSchema6Definition, JSONSchema6TypeName } from 'json-schema'; | ||
import type { VariableToType } from './collectVariables'; | ||
export type { JSONSchema6, JSONSchema6TypeName }; | ||
export declare function getVariablesJSONSchema(variableToType: VariableToType): JSONSchema6; | ||
export declare type JsonSchemaOptions = { | ||
useMarkdownDescription?: boolean; | ||
}; | ||
export declare type JSONSchemaOptions = { | ||
useMarkdownDescription?: boolean; | ||
}; | ||
export declare const defaultJSONSchemaOptions: { | ||
useMarkdownDescription: boolean; | ||
}; | ||
export declare type MonacoEditorJSONSchema = JSONSchema6 & { | ||
markdownDescription?: string; | ||
}; | ||
export declare type CombinedSchema = JSONSchema6 | MonacoEditorJSONSchema; | ||
declare type Definitions = { | ||
[k: string]: JSONSchema6Definition; | ||
}; | ||
export declare type DefinitionResult = { | ||
definition: JSONSchema6 | MonacoEditorJSONSchema; | ||
required: boolean; | ||
definitions?: Definitions; | ||
}; | ||
export declare function getVariablesJSONSchema(variableToType: VariableToType, options?: JSONSchemaOptions): JSONSchema6; | ||
//# sourceMappingURL=getVariablesJSONSchema.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { isEnumType, isInputObjectType, isListType, isNonNullType, isScalarType, } from 'graphql'; | ||
import { GraphQLList, isEnumType, isInputObjectType, isListType, isNonNullType, isScalarType, } from 'graphql'; | ||
const scalarTypesMap = { | ||
@@ -14,8 +14,7 @@ Int: 'integer', | ||
}; | ||
const listType = (definition, type) => { | ||
var _a; | ||
const listType = (definition, type, definitions) => { | ||
definition.type = 'array'; | ||
definition.items = { | ||
type: (_a = scalarTypesMap[type.ofType]) !== null && _a !== void 0 ? _a : type.ofType, | ||
}; | ||
const { definition: def, definitions: defs } = getJSONSchemaFromGraphQLType(type.ofType); | ||
definition.items = { $ref: def.$ref }; | ||
definitions = Object.assign(Object.assign({}, definitions), defs); | ||
}; | ||
@@ -26,23 +25,82 @@ const enumType = (definition, type) => { | ||
}; | ||
const objectType = (definition, type) => { | ||
definition.type = 'object'; | ||
const fields = type.getFields(); | ||
if (!definition.properties) { | ||
definition.properties = {}; | ||
const inputObjectType = (definition, type, definitions, options) => { | ||
definition.$ref = `#/definitions/${type.name}`; | ||
definition.description = undefined; | ||
if (!definitions || !definitions[type.name]) { | ||
const fields = type.getFields(); | ||
const fieldDef = { | ||
type: 'object', | ||
properties: {}, | ||
required: [], | ||
}; | ||
if (type.description) { | ||
fieldDef.description = type.description; | ||
} | ||
if (options === null || options === void 0 ? void 0 : options.useMarkdownDescription) { | ||
fieldDef.markdownDescription = type.description; | ||
} | ||
Object.keys(fields).forEach(fieldName => { | ||
const field = fields[fieldName]; | ||
const { required, definition: typeDefinition, } = getJSONSchemaFromGraphQLType(field.type, options); | ||
const { definition: fieldDefinition } = getJSONSchemaFromGraphQLType(fields[fieldName], options); | ||
fieldDef.properties[fieldName] = Object.assign(Object.assign({}, typeDefinition), fieldDefinition); | ||
if (required) { | ||
fieldDef.required.push(fieldName); | ||
} | ||
}); | ||
definitions[type.name] = fieldDef; | ||
} | ||
definition.required = []; | ||
Object.keys(fields).forEach(fieldName => { | ||
const { required, definition: fieldDefinition, } = getJSONSchemaFromGraphQLType(fields[fieldName].type); | ||
definition.properties[fieldName] = fieldDefinition; | ||
if (required) { | ||
definition.required.push(fieldName); | ||
} | ||
}); | ||
else { | ||
return; | ||
} | ||
}; | ||
function getJSONSchemaFromGraphQLType(type) { | ||
export const defaultJSONSchemaOptions = { | ||
useMarkdownDescription: false, | ||
}; | ||
function text(into, newText) { | ||
into.push(newText); | ||
} | ||
function renderType(into, t) { | ||
if (!t) { | ||
return; | ||
} | ||
if (isNonNullType(t)) { | ||
renderType(into, t.ofType); | ||
text(into, '!'); | ||
} | ||
else if (t instanceof GraphQLList) { | ||
text(into, '['); | ||
renderType(into, t.ofType); | ||
text(into, ']'); | ||
} | ||
else { | ||
text(into, t.name); | ||
} | ||
} | ||
function renderTypeToString(t, useMarkdown) { | ||
const into = []; | ||
if (useMarkdown) { | ||
text(into, '\n```graphql\n'); | ||
} | ||
renderType(into, t); | ||
if (useMarkdown) { | ||
text(into, '\n```\n'); | ||
} | ||
return into.join(''); | ||
} | ||
function getJSONSchemaFromGraphQLType(type, options) { | ||
let required = false; | ||
let definition = {}; | ||
if ('description' in type) { | ||
definition.description = type.description; | ||
let definitions = {}; | ||
definition.description = renderTypeToString(type); | ||
const hasDescription = 'description' in type && type.description; | ||
if ('description' in type && type.description) { | ||
definition.description += type.description; | ||
} | ||
if (options === null || options === void 0 ? void 0 : options.useMarkdownDescription) { | ||
definition.markdownDescription = renderTypeToString(type, true); | ||
if (hasDescription) { | ||
definition.markdownDescription += type.description; | ||
} | ||
} | ||
if ('defaultValue' in type) { | ||
@@ -55,17 +113,19 @@ definition.default = type.defaultValue; | ||
if (isInputObjectType(type)) { | ||
objectType(definition, type); | ||
inputObjectType(definition, type, definitions, options); | ||
} | ||
if (isListType(type)) { | ||
listType(definition, type); | ||
} | ||
if (isScalarType(type)) { | ||
scalarType(definition, type); | ||
} | ||
if (isListType(type)) { | ||
listType(definition, type, definitions); | ||
} | ||
if (isNonNullType(type)) { | ||
required = true; | ||
definition = getJSONSchemaFromGraphQLType(type.ofType).definition; | ||
const { definition: def, definitions: defs } = getJSONSchemaFromGraphQLType(type.ofType, options); | ||
definition = def; | ||
definitions = Object.assign(Object.assign({}, definitions), defs); | ||
} | ||
return { required, definition }; | ||
return { required, definition, definitions }; | ||
} | ||
export function getVariablesJSONSchema(variableToType) { | ||
export function getVariablesJSONSchema(variableToType, options) { | ||
const jsonSchema = { | ||
@@ -80,3 +140,3 @@ $schema: 'https://json-schema.org/draft/2020-12/schema', | ||
var _a; | ||
const { definition, required } = getJSONSchemaFromGraphQLType(type); | ||
const { definition, required, definitions, } = getJSONSchemaFromGraphQLType(type, options); | ||
jsonSchema.properties[variableName] = definition; | ||
@@ -86,2 +146,5 @@ if (required) { | ||
} | ||
if (definitions) { | ||
jsonSchema.definitions = definitions; | ||
} | ||
}); | ||
@@ -88,0 +151,0 @@ } |
@@ -7,3 +7,4 @@ export { getFragmentDependencies, getFragmentDependenciesForAST, } from './fragmentDependencies'; | ||
export { collectVariables, VariableToType } from './collectVariables'; | ||
export { fillLeafs, GetDefaultFieldNamesFn, buildSelectionSet, defaultGetDefaultFieldNames, } from './fillLeafs'; | ||
export { default as getOperationFacts, getOperationASTFacts, getQueryFacts, OperationFacts, QueryFacts, } from './getOperationFacts'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -7,3 +7,4 @@ export { getFragmentDependencies, getFragmentDependenciesForAST, } from './fragmentDependencies'; | ||
export { collectVariables } from './collectVariables'; | ||
export { fillLeafs, buildSelectionSet, defaultGetDefaultFieldNames, } from './fillLeafs'; | ||
export { default as getOperationFacts, getOperationASTFacts, getQueryFacts, } from './getOperationFacts'; | ||
//# sourceMappingURL=index.js.map |
import { ValidationRule, DocumentNode, GraphQLError, GraphQLSchema } from 'graphql'; | ||
export declare function validateWithCustomRules(schema: GraphQLSchema, ast: DocumentNode, customRules?: Array<ValidationRule> | null, isRelayCompatMode?: boolean): Array<GraphQLError>; | ||
export declare function validateWithCustomRules(schema: GraphQLSchema, ast: DocumentNode, customRules?: Array<ValidationRule> | null, isRelayCompatMode?: boolean, isSchemaDocument?: boolean): Array<GraphQLError>; | ||
//# sourceMappingURL=validateWithCustomRules.d.ts.map |
@@ -1,3 +0,17 @@ | ||
import { specifiedRules, validate, NoUnusedFragmentsRule, KnownFragmentNamesRule, Kind, ExecutableDefinitionsRule, } from 'graphql'; | ||
export function validateWithCustomRules(schema, ast, customRules, isRelayCompatMode) { | ||
import { specifiedRules, validate, NoUnusedFragmentsRule, KnownFragmentNamesRule, Kind, ExecutableDefinitionsRule, LoneSchemaDefinitionRule, UniqueOperationTypesRule, UniqueTypeNamesRule, UniqueEnumValueNamesRule, UniqueFieldDefinitionNamesRule, UniqueDirectiveNamesRule, KnownTypeNamesRule, KnownDirectivesRule, UniqueDirectivesPerLocationRule, PossibleTypeExtensionsRule, UniqueArgumentNamesRule, UniqueInputFieldNamesRule, } from 'graphql'; | ||
const specifiedSDLRules = [ | ||
LoneSchemaDefinitionRule, | ||
UniqueOperationTypesRule, | ||
UniqueTypeNamesRule, | ||
UniqueEnumValueNamesRule, | ||
UniqueFieldDefinitionNamesRule, | ||
UniqueDirectiveNamesRule, | ||
KnownTypeNamesRule, | ||
KnownDirectivesRule, | ||
UniqueDirectivesPerLocationRule, | ||
PossibleTypeExtensionsRule, | ||
UniqueArgumentNamesRule, | ||
UniqueInputFieldNamesRule, | ||
]; | ||
export function validateWithCustomRules(schema, ast, customRules, isRelayCompatMode, isSchemaDocument) { | ||
const rules = specifiedRules.filter(rule => { | ||
@@ -15,2 +29,5 @@ if (rule === NoUnusedFragmentsRule || rule === ExecutableDefinitionsRule) { | ||
} | ||
if (isSchemaDocument) { | ||
Array.prototype.push.apply(rules, specifiedSDLRules); | ||
} | ||
const errors = validate(schema, ast, rules); | ||
@@ -17,0 +34,0 @@ return errors.filter(error => { |
{ | ||
"name": "graphql-language-service-utils", | ||
"version": "2.7.0-canary-efc41fcd.0", | ||
"version": "2.7.0-canary-fae7d199.0", | ||
"description": "Utilities to support the GraphQL Language Service", | ||
@@ -18,3 +18,4 @@ "contributors": [ | ||
"dist", | ||
"esm" | ||
"esm", | ||
"src" | ||
], | ||
@@ -28,7 +29,8 @@ "keywords": [ | ||
"peerDependencies": { | ||
"graphql": ">= 15.5.0 <= 16.0.0-experimental-stream-defer.5" | ||
"graphql": "^15.5.0 || ^16.0.0" | ||
}, | ||
"dependencies": { | ||
"graphql-language-service-types": "^1.8.3", | ||
"nullthrows": "^1.0.0" | ||
"graphql-language-service-types": "^1.8.6", | ||
"nullthrows": "^1.0.0", | ||
"@types/json-schema": "7.0.9" | ||
}, | ||
@@ -35,0 +37,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
145717
95
2635
4
1
+ Added@types/json-schema@7.0.9
+ Added@types/json-schema@7.0.9(transitive)
- Removedgraphql@16.0.0-experimental-stream-defer.5(transitive)