Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-schema-linter

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-schema-linter - npm Package Compare versions

Comparing version 0.0.22 to 0.0.23

lib/validation_error.js

6

CHANGELOG.md

@@ -9,2 +9,8 @@ # Changelog

## 0.0.23 (November 28th, 2017)
### New features
- Errors now include the name of the rule that caused the error. [#71](https://github.com/cjoudrey/graphql-schema-linter/pull/71)
## 0.0.22 (November 27th, 2017)

@@ -11,0 +17,0 @@

3

lib/formatters/json_formatter.js

@@ -20,3 +20,4 @@ "use strict";

file: file
}
},
rule: error.ruleName
};

@@ -23,0 +24,0 @@ }));

@@ -40,4 +40,4 @@ 'use strict';

location: _chalk2.default.dim(location.line + ':' + location.column * 4),
message: error.message
// TODO: Add rule name
message: error.message,
rule: _chalk2.default.dim(' ' + error.ruleName)
};

@@ -44,0 +44,0 @@ });

@@ -8,3 +8,3 @@ 'use strict';

var _error = require('graphql/error');
var _validation_error = require('../validation_error');

@@ -38,3 +38,3 @@ function DefinedTypesAreUsed(context) {

if (!referencedTypes.has(node.name.value)) {
context.reportError(new _error.GraphQLError('The type `' + node.name.value + '` is defined in the ' + 'schema but not used anywhere.', [node]));
context.reportError(new _validation_error.ValidationError('defined-types-are-used', 'The type `' + node.name.value + '` is defined in the ' + 'schema but not used anywhere.', [node]));
}

@@ -41,0 +41,0 @@ });

@@ -10,3 +10,3 @@ 'use strict';

var _error = require('graphql/error');
var _validation_error = require('../validation_error');

@@ -29,3 +29,3 @@ function DeprecationsHaveAReason(context) {

context.reportError(new _error.GraphQLError('The field `' + parentName + '.' + fieldName + '` is deprecated but has no deprecation reason.', [deprecatedDirective]));
context.reportError(new _validation_error.ValidationError('deprecations-have-a-reason', 'The field `' + parentName + '.' + fieldName + '` is deprecated but has no deprecation reason.', [deprecatedDirective]));
},

@@ -46,3 +46,3 @@ EnumValueDefinition: function EnumValueDefinition(node, key, parent, path, ancestors) {

context.reportError(new _error.GraphQLError('The enum value `' + parentName + '.' + enumValueName + '` is deprecated but has no deprecation reason.', [deprecatedDirective]));
context.reportError(new _validation_error.ValidationError('deprecations-have-a-reason', 'The enum value `' + parentName + '.' + enumValueName + '` is deprecated but has no deprecation reason.', [deprecatedDirective]));
}

@@ -49,0 +49,0 @@ };

@@ -8,3 +8,3 @@ 'use strict';

var _error = require('graphql/error');
var _validation_error = require('../validation_error');

@@ -18,3 +18,3 @@ function EnumValuesAllCaps(context) {

if (enumValueName !== enumValueName.toUpperCase()) {
context.reportError(new _error.GraphQLError('The enum value `' + parentName + '.' + enumValueName + '` should be uppercase.', [node]));
context.reportError(new _validation_error.ValidationError('enum-values-all-caps', 'The enum value `' + parentName + '.' + enumValueName + '` should be uppercase.', [node]));
}

@@ -21,0 +21,0 @@ }

@@ -10,3 +10,3 @@ 'use strict';

var _error = require('graphql/error');
var _validation_error = require('../validation_error');

@@ -23,5 +23,5 @@ function EnumValuesHaveDescriptions(context) {

context.reportError(new _error.GraphQLError('The enum value `' + parentName + '.' + enumValue + '` is missing a description.', [node]));
context.reportError(new _validation_error.ValidationError('enum-values-have-descriptions', 'The enum value `' + parentName + '.' + enumValue + '` is missing a description.', [node]));
}
};
}

@@ -8,3 +8,3 @@ 'use strict';

var _error = require('graphql/error');
var _validation_error = require('../validation_error');

@@ -19,3 +19,3 @@ function EnumValuesSortedAlphabetically(context) {

if (!arraysEqual(enumValues, enumValues.slice().sort())) {
context.reportError(new _error.GraphQLError('The enum `' + node.name.value + '` should be sorted alphabetically.', [node]));
context.reportError(new _validation_error.ValidationError('enum-values-sorted-alphabetically', 'The enum `' + node.name.value + '` should be sorted alphabetically.', [node]));
}

@@ -22,0 +22,0 @@ }

@@ -10,3 +10,3 @@ 'use strict';

var _error = require('graphql/error');
var _validation_error = require('../validation_error');

@@ -23,5 +23,5 @@ function FieldsHaveDescriptions(context) {

context.reportError(new _error.GraphQLError('The field `' + parentName + '.' + fieldName + '` is missing a description.', [node]));
context.reportError(new _validation_error.ValidationError('fields-have-descriptions', 'The field `' + parentName + '.' + fieldName + '` is missing a description.', [node]));
}
};
}

@@ -10,3 +10,3 @@ 'use strict';

var _error = require('graphql/error');
var _validation_error = require('../validation_error');

@@ -29,5 +29,5 @@ function InputObjectValuesHaveDescriptions(context) {

context.reportError(new _error.GraphQLError('The input value `' + inputObjectName + '.' + inputValueName + '` is missing a description.', [node]));
context.reportError(new _validation_error.ValidationError('input-object-values-have-descriptions', 'The input value `' + inputObjectName + '.' + inputValueName + '` is missing a description.', [node]));
}
};
}

@@ -8,3 +8,3 @@ 'use strict';

var _error = require('graphql/error');
var _validation_error = require('../validation_error');

@@ -16,3 +16,3 @@ function TypesAreCapitalized(context) {

if (typeName[0] == typeName[0].toLowerCase()) {
context.reportError(new _error.GraphQLError('The object type `' + typeName + '` should start with a capital letter.', [node.name]));
context.reportError(new _validation_error.ValidationError('types-are-capitalized', 'The object type `' + typeName + '` should start with a capital letter.', [node.name]));
}

@@ -23,3 +23,3 @@ },

if (typeName[0] == typeName[0].toLowerCase()) {
context.reportError(new _error.GraphQLError('The interface type `' + typeName + '` should start with a capital letter.', [node.name]));
context.reportError(new _validation_error.ValidationError('types-are-capitalized', 'The interface type `' + typeName + '` should start with a capital letter.', [node.name]));
}

@@ -26,0 +26,0 @@ }

@@ -10,3 +10,3 @@ 'use strict';

var _error = require('graphql/error');
var _validation_error = require('../validation_error');

@@ -20,3 +20,3 @@ function validateTypeHasDescription(context, node, typeKind) {

context.reportError(new _error.GraphQLError('The ' + typeKind + ' type `' + interfaceTypeName + '` is missing a description.', [node]));
context.reportError(new _validation_error.ValidationError('types-have-descriptions', 'The ' + typeKind + ' type `' + interfaceTypeName + '` is missing a description.', [node]));
}

@@ -23,0 +23,0 @@

@@ -18,4 +18,2 @@ 'use strict';

var _error = require('graphql/error');
var _figures = require('figures');

@@ -22,0 +20,0 @@

{
"name": "graphql-schema-linter",
"version": "0.0.22",
"version": "0.0.23",
"description":

@@ -30,3 +30,4 @@ "Command line tool and package to validate GraphQL schemas against a set of rules.",

"mocha": "^3.4.2",
"prettier": "^1.6.0"
"prettier": "^1.6.0",
"strip-ansi": "^4.0.0"
},

@@ -33,0 +34,0 @@ "babel": {

@@ -176,4 +176,4 @@ # graphql-schema-linter [![Travis CI](https://travis-ci.org/cjoudrey/graphql-schema-linter.svg?branch=master)](https://travis-ci.org/cjoudrey/graphql-schema-linter) [![npm version](https://badge.fury.io/js/graphql-schema-linter.svg)](https://yarnpkg.com/en/package/graphql-schema-linter)

```
5:1 The object type `QueryRoot` is missing a description.
6:3 The field `QueryRoot.a` is missing a description.
5:1 The object type `QueryRoot` is missing a description. types-have-descriptions
6:3 The field `QueryRoot.a` is missing a description. fields-have-descriptions

@@ -198,3 +198,4 @@ 2 errors detected

"file": "schema.graphql"
}
},
"rule": "types-have-descriptions"
},

@@ -207,3 +208,4 @@ {

"file": "schema.graphql"
}
},
"rule": "fields-have-descriptions"
}

@@ -210,0 +212,0 @@ ]

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc