From 3e5dad210b7ce54ad26b9d837deedb1e650050f6 Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 20 Nov 2018 11:54:56 +0000 Subject: [PATCH 1/7] Change fields to path in validation responses This brings it into line with the GraphQL spec: https://github.com/facebook/graphql/blob/master/spec/Section%207%20--%20Response.md#user-content-errors --- javascript_client/yarn.lock | 342 ++++++++++++++++++ lib/graphql/static_validation/base_visitor.rb | 1 + lib/graphql/static_validation/message.rb | 3 +- spec/graphql/execution/multiplex_spec.rb | 2 +- .../argument_literals_are_compatible_spec.rb | 24 +- .../rules/argument_names_are_unique_spec.rb | 4 +- .../rules/arguments_are_defined_spec.rb | 10 +- .../rules/directives_are_defined_spec.rb | 4 +- .../directives_are_in_valid_locations_spec.rb | 4 +- .../rules/fields_are_defined_on_type_spec.rb | 10 +- ...fields_have_appropriate_selections_spec.rb | 10 +- .../rules/fields_will_merge_spec.rb | 2 +- .../rules/fragment_names_are_unique_spec.rb | 2 +- .../fragment_spreads_are_possible_spec.rb | 6 +- .../rules/fragment_types_exist_spec.rb | 4 +- .../rules/fragments_are_finite_spec.rb | 4 +- .../rules/fragments_are_named_spec.rb | 2 +- .../fragments_are_on_composite_types_spec.rb | 6 +- .../rules/fragments_are_used_spec.rb | 4 +- .../rules/mutation_root_exists_spec.rb | 2 +- .../rules/operation_names_are_valid_spec.rb | 6 +- .../required_arguments_are_present_spec.rb | 8 +- .../rules/subscription_root_exists_spec.rb | 2 +- .../unique_directives_per_location_spec.rb | 14 +- ...default_values_are_correctly_typed_spec.rb | 14 +- .../rules/variable_usages_are_allowed_spec.rb | 8 +- .../rules/variables_are_input_types_spec.rb | 8 +- .../variables_are_used_and_defined_spec.rb | 6 +- .../static_validation/validator_spec.rb | 4 +- 29 files changed, 430 insertions(+), 86 deletions(-) diff --git a/javascript_client/yarn.lock b/javascript_client/yarn.lock index 5dfb5e81d3..8303eede9b 100644 --- a/javascript_client/yarn.lock +++ b/javascript_client/yarn.lock @@ -5,24 +5,29 @@ "@types/zen-observable@0.5.3": version "0.5.3" resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.5.3.tgz#91b728599544efbb7386d8b6633693a3c2e7ade5" + integrity sha512-aDvGDAHcVfUqNmd8q4//cHAP+HGxsbChbBbuk3+kMVk5TTxfWLpQWvVN3+UPjohLnwMYN7jr6BWNn2cYNqdm7g== abab@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.3.tgz#b81de5f7274ec4e756d797cd834f303642724e5d" + integrity sha1-uB3l9ydOxOdW15fNg08wNkJyTl0= acorn-globals@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-3.1.0.tgz#fd8270f71fbb4996b004fa880ee5d46573a731bf" + integrity sha1-/YJw9x+7SZawBPqIDuXUZXOnMb8= dependencies: acorn "^4.0.4" acorn@^4.0.4: version "4.0.13" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" + integrity sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c= ajv@^4.9.1: version "4.11.8" resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" + integrity sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY= dependencies: co "^4.6.0" json-stable-stringify "^1.0.1" @@ -30,6 +35,7 @@ ajv@^4.9.1: align-text@^0.1.1, align-text@^0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" + integrity sha1-DNkKVhCT810KmSVsIrcGlDP60Rc= dependencies: kind-of "^3.0.2" longest "^1.0.1" @@ -38,28 +44,34 @@ align-text@^0.1.1, align-text@^0.1.3: amdefine@>=0.0.4: version "1.0.1" resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" + integrity sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU= ansi-escapes@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" + integrity sha1-06ioOzGapneTZisT52HHkRQiMG4= ansi-regex@^2.0.0, ansi-regex@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= ansi-styles@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.1.0.tgz#09c202d5c917ec23188caa5c9cb9179cd9547750" + integrity sha1-CcIC1ckX7CMYjKpcnLkXnNlUd1A= dependencies: color-convert "^1.0.0" anymatch@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.0.tgz#a3e52fa39168c825ff57b0248126ce5a8ff95507" + integrity sha1-o+Uvo5FoyCX/V7AkgSbOWo/5VQc= dependencies: arrify "^1.0.0" micromatch "^2.1.5" @@ -67,6 +79,7 @@ anymatch@^1.3.0: apollo-link@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.0.3.tgz#759c36abeeb99e227eca45f919ee07fb8fee911e" + integrity sha512-JVFLl+Y5OmwwPqrnf12q9Em85uwSm/QFYR9ZUvFNb1dyv+7IF+9inS6D2m/cVy03O4D32kFzLo8D34D3tY664w== dependencies: "@types/zen-observable" "0.5.3" apollo-utilities "^1.0.0" @@ -75,82 +88,100 @@ apollo-link@^1.0.3: apollo-utilities@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.0.2.tgz#bcf348a7e613e82e2624ddb5be2b9f6bf1259c6d" + integrity sha512-tCiJexDJQr9He6TW9E1/sba0WdeRW4/mmaA1JJBOwyLoPSAvCgBOJ6fo4L3iwWvadR1X1723JGojzhYFrUHMhg== append-transform@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-0.4.0.tgz#d76ebf8ca94d276e247a36bad44a4b74ab611991" + integrity sha1-126/jKlNJ24keja61EpLdKthGZE= dependencies: default-require-extensions "^1.0.0" argparse@^1.0.7: version "1.0.9" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" + integrity sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY= dependencies: sprintf-js "~1.0.2" arr-diff@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" + integrity sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8= dependencies: arr-flatten "^1.0.1" arr-flatten@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== array-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" + integrity sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM= array-unique@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" + integrity sha1-odl8yvy8JiXMcPrc6zalDFiwGlM= arrify@^1.0.0, arrify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= asn1@~0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86" + integrity sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y= assert-plus@1.0.0, assert-plus@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= assert-plus@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" + integrity sha1-104bh+ev/A24qttwIfP+SBAasjQ= assertion-error@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c" + integrity sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw= async@^1.4.0: version "1.5.2" resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" + integrity sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo= async@^2.1.4: version "2.5.0" resolved "https://registry.yarnpkg.com/async/-/async-2.5.0.tgz#843190fd6b7357a0b9e1c956edddd5ec8462b54d" + integrity sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw== dependencies: lodash "^4.14.0" asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= aws-sign2@~0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" + integrity sha1-FDQt0428yU0OW4fXY81jYSwOeU8= aws4@^1.2.1: version "1.6.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" + integrity sha1-g+9cqGCysy5KDe7e6MdxudtXRx4= babel-code-frame@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" + integrity sha1-AnYgvuVnqIwyVhV05/0IAdMxGOQ= dependencies: chalk "^1.1.0" esutils "^2.0.2" @@ -159,6 +190,7 @@ babel-code-frame@^6.22.0: babel-core@^6.0.0, babel-core@^6.24.1: version "6.25.0" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.25.0.tgz#7dd42b0463c742e9d5296deb3ec67a9322dad729" + integrity sha1-fdQrBGPHQunVKW3rPsZ6kyLa1yk= dependencies: babel-code-frame "^6.22.0" babel-generator "^6.25.0" @@ -183,6 +215,7 @@ babel-core@^6.0.0, babel-core@^6.24.1: babel-generator@^6.18.0, babel-generator@^6.25.0: version "6.25.0" resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.25.0.tgz#33a1af70d5f2890aeb465a4a7793c1df6a9ea9fc" + integrity sha1-M6GvcNXyiQrrRlpKd5PB32qeqfw= dependencies: babel-messages "^6.23.0" babel-runtime "^6.22.0" @@ -196,6 +229,7 @@ babel-generator@^6.18.0, babel-generator@^6.25.0: babel-helpers@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.24.1.tgz#3471de9caec388e5c850e597e58a26ddf37602b2" + integrity sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI= dependencies: babel-runtime "^6.22.0" babel-template "^6.24.1" @@ -203,6 +237,7 @@ babel-helpers@^6.24.1: babel-jest@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-20.0.3.tgz#e4a03b13dc10389e140fc645d09ffc4ced301671" + integrity sha1-5KA7E9wQOJ4UD8ZF0J/8TO0wFnE= dependencies: babel-core "^6.0.0" babel-plugin-istanbul "^4.0.0" @@ -211,12 +246,14 @@ babel-jest@^20.0.3: babel-messages@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" + integrity sha1-8830cDhYA1sqKVHG7F7fbGLyYw4= dependencies: babel-runtime "^6.22.0" babel-plugin-istanbul@^4.0.0: version "4.1.4" resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.4.tgz#18dde84bf3ce329fddf3f4103fae921456d8e587" + integrity sha1-GN3oS/POMp/d8/QQP66SFFbY5Yc= dependencies: find-up "^2.1.0" istanbul-lib-instrument "^1.7.2" @@ -225,16 +262,19 @@ babel-plugin-istanbul@^4.0.0: babel-plugin-jest-hoist@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-20.0.3.tgz#afedc853bd3f8dc3548ea671fbe69d03cc2c1767" + integrity sha1-r+3IU70/jcNUjqZx++adA8wsF2c= babel-preset-jest@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-20.0.3.tgz#cbacaadecb5d689ca1e1de1360ebfc66862c178a" + integrity sha1-y6yq3stdaJyh4d4TYOv8ZoYsF4o= dependencies: babel-plugin-jest-hoist "^20.0.3" babel-register@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.24.1.tgz#7e10e13a2f71065bdfad5a1787ba45bca6ded75f" + integrity sha1-fhDhOi9xBlvfrVoXh7pFvKbe118= dependencies: babel-core "^6.24.1" babel-runtime "^6.22.0" @@ -247,6 +287,7 @@ babel-register@^6.24.1: babel-runtime@^6.22.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b" + integrity sha1-CpSJ8UTecO+zzkMArM2zKeL8VDs= dependencies: core-js "^2.4.0" regenerator-runtime "^0.10.0" @@ -254,6 +295,7 @@ babel-runtime@^6.22.0: babel-template@^6.16.0, babel-template@^6.24.1, babel-template@^6.25.0: version "6.25.0" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.25.0.tgz#665241166b7c2aa4c619d71e192969552b10c071" + integrity sha1-ZlJBFmt8KqTGGdceGSlpVSsQwHE= dependencies: babel-runtime "^6.22.0" babel-traverse "^6.25.0" @@ -264,6 +306,7 @@ babel-template@^6.16.0, babel-template@^6.24.1, babel-template@^6.25.0: babel-traverse@^6.18.0, babel-traverse@^6.25.0: version "6.25.0" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.25.0.tgz#2257497e2fcd19b89edc13c4c91381f9512496f1" + integrity sha1-IldJfi/NGbie3BPEyROB+VEklvE= dependencies: babel-code-frame "^6.22.0" babel-messages "^6.23.0" @@ -278,6 +321,7 @@ babel-traverse@^6.18.0, babel-traverse@^6.25.0: babel-types@^6.18.0, babel-types@^6.25.0: version "6.25.0" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.25.0.tgz#70afb248d5660e5d18f811d91c8303b54134a18e" + integrity sha1-cK+ySNVmDl0Y+BHZHIMDtUE0oY4= dependencies: babel-runtime "^6.22.0" esutils "^2.0.2" @@ -287,26 +331,31 @@ babel-types@^6.18.0, babel-types@^6.25.0: babylon@^6.17.2, babylon@^6.17.4: version "6.17.4" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.4.tgz#3e8b7402b88d22c3423e137a1577883b15ff869a" + integrity sha512-kChlV+0SXkjE0vUn9OZ7pBMWRFd8uq3mZe8x1K6jhuNcAFAtEnjchFAqB+dYEXKyd+JpT6eppRR78QAr5gTsUw== balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= bcrypt-pbkdf@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d" + integrity sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40= dependencies: tweetnacl "^0.14.3" boom@2.x.x: version "2.10.1" resolved "https://registry.yarnpkg.com/boom/-/boom-2.10.1.tgz#39c8918ceff5799f83f9492a848f625add0c766f" + integrity sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8= dependencies: hoek "2.x.x" brace-expansion@^1.1.7: version "1.1.8" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" + integrity sha1-wHshHHyVLsH479Uad+8NHTmQopI= dependencies: balanced-match "^1.0.0" concat-map "0.0.1" @@ -314,6 +363,7 @@ brace-expansion@^1.1.7: braces@^1.8.2: version "1.8.5" resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" + integrity sha1-uneWLhLf+WnWt2cR6RS3N4V79qc= dependencies: expand-range "^1.8.1" preserve "^0.2.0" @@ -322,44 +372,53 @@ braces@^1.8.2: browser-resolve@^1.11.2: version "1.11.2" resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.2.tgz#8ff09b0a2c421718a1051c260b32e48f442938ce" + integrity sha1-j/CbCixCFxihBRwmCzLkj0QpOM4= dependencies: resolve "1.1.7" bser@1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/bser/-/bser-1.0.2.tgz#381116970b2a6deea5646dd15dd7278444b56169" + integrity sha1-OBEWlwsqbe6lZG3RXdcnhES1YWk= dependencies: node-int64 "^0.4.0" bser@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/bser/-/bser-2.0.0.tgz#9ac78d3ed5d915804fd87acb158bc797147a1719" + integrity sha1-mseNPtXZFYBP2HrLFYvHlxR6Fxk= dependencies: node-int64 "^0.4.0" builtin-modules@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" + integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8= callsites@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-2.0.0.tgz#06eb84f00eea413da86affefacbffb36093b3c50" + integrity sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA= camelcase@^1.0.2: version "1.2.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" + integrity sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk= camelcase@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" + integrity sha1-MvxLn82vhF/N9+c7uXysImHwqwo= caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= center-align@^0.1.1: version "0.1.3" resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad" + integrity sha1-qg0yYptu6XIgBBHL1EYckHvCt60= dependencies: align-text "^0.1.3" lazy-cache "^1.0.3" @@ -367,6 +426,7 @@ center-align@^0.1.1: "chai@>=1.9.2 <4.0.0": version "3.5.0" resolved "https://registry.yarnpkg.com/chai/-/chai-3.5.0.tgz#4d02637b067fe958bdbfdd3a40ec56fef7373247" + integrity sha1-TQJjewZ/6Vi9v906QOxW/vc3Mkc= dependencies: assertion-error "^1.0.1" deep-eql "^0.1.3" @@ -375,6 +435,7 @@ center-align@^0.1.1: chalk@^1.1.0, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= dependencies: ansi-styles "^2.2.1" escape-string-regexp "^1.0.2" @@ -385,10 +446,12 @@ chalk@^1.1.0, chalk@^1.1.3: ci-info@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.0.0.tgz#dc5285f2b4e251821683681c381c3388f46ec534" + integrity sha1-3FKF8rTiUYIWg2gcOBwziPRuxTQ= cliui@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" + integrity sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE= dependencies: center-align "^0.1.1" right-align "^0.1.1" @@ -397,6 +460,7 @@ cliui@^2.1.0: cliui@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" + integrity sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0= dependencies: string-width "^1.0.1" strip-ansi "^3.0.1" @@ -405,134 +469,161 @@ cliui@^3.2.0: co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= color-convert@^1.0.0: version "1.9.0" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a" + integrity sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o= dependencies: color-name "^1.1.1" color-name@^1.1.1: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= combined-stream@^1.0.5, combined-stream@~1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" + integrity sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk= dependencies: delayed-stream "~1.0.0" concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= content-type-parser@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/content-type-parser/-/content-type-parser-1.0.1.tgz#c3e56988c53c65127fb46d4032a3a900246fdc94" + integrity sha1-w+VpiMU8ZRJ/tG1AMqOpACRv3JQ= convert-source-map@^1.1.0, convert-source-map@^1.4.0: version "1.5.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.0.tgz#9acd70851c6d5dfdd93d9282e5edf94a03ff46b5" + integrity sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU= core-js@^2.4.0: version "2.4.1" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e" + integrity sha1-TekR5mew6ukSTjQlS1OupvxhjT4= cryptiles@2.x.x: version "2.0.5" resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" + integrity sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g= dependencies: boom "2.x.x" cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": version "0.3.2" resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.2.tgz#b8036170c79f07a90ff2f16e22284027a243848b" + integrity sha1-uANhcMefB6kP8vFuIihAJ6JDhIs= "cssstyle@>= 0.2.37 < 0.3.0": version "0.2.37" resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-0.2.37.tgz#541097234cb2513c83ceed3acddc27ff27987d54" + integrity sha1-VBCXI0yyUTyDzu06zdwn/yeYfVQ= dependencies: cssom "0.3.x" dashdash@^1.12.0: version "1.14.1" resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= dependencies: assert-plus "^1.0.0" debug@^2.1.1, debug@^2.2.0, debug@^2.6.3: version "2.6.8" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" + integrity sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw= dependencies: ms "2.0.0" decamelize@^1.0.0, decamelize@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= deep-eql@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2" + integrity sha1-71WKyrjeJSBs1xOQbXTlaTDrafI= dependencies: type-detect "0.1.1" deep-equal@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5" + integrity sha1-9dJgKStmDghO/0zbyfCK0yR0SLU= deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= default-require-extensions@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-1.0.0.tgz#f37ea15d3e13ffd9b437d33e1a75b5fb97874cb8" + integrity sha1-836hXT4T/9m0N9M+GnW1+5eHTLg= dependencies: strip-bom "^2.0.0" delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= detect-indent@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-4.0.0.tgz#f76d064352cdf43a1cb6ce619c4ee3a9475de208" + integrity sha1-920GQ1LN9Docts5hnE7jqUdd4gg= dependencies: repeating "^2.0.0" diff@^3.2.0: version "3.3.0" resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.0.tgz#056695150d7aa93237ca7e378ac3b1682b7963b9" + integrity sha512-w0XZubFWn0Adlsapj9EAWX0FqWdO4tz8kc3RiYdWLh4k/V8PTb6i0SMgXt0vRM3zyKnT8tKO7mUlieRQHIjMNg== ecc-jsbn@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" + integrity sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU= dependencies: jsbn "~0.1.0" errno@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.4.tgz#b896e23a9e5e8ba33871fc996abd3635fc9a1c7d" + integrity sha1-uJbiOp5ei6M4cfyZar02NfyaHH0= dependencies: prr "~0.0.0" error-ex@^1.2.0: version "1.3.1" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" + integrity sha1-+FWobOYa3E6GIcPNoh56dhLDqNw= dependencies: is-arrayish "^0.2.1" escape-string-regexp@^1.0.2: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= escodegen@^1.6.1: version "1.8.1" resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.8.1.tgz#5a5b53af4693110bebb0867aa3430dd3b70a1018" + integrity sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg= dependencies: esprima "^2.7.1" estraverse "^1.9.1" @@ -544,74 +635,89 @@ escodegen@^1.6.1: esprima@^2.7.1: version "2.7.3" resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" + integrity sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE= esprima@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" + integrity sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw== estraverse@^1.9.1: version "1.9.3" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.9.3.tgz#af67f2dc922582415950926091a4005d29c9bb44" + integrity sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q= esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + integrity sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs= exec-sh@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.2.0.tgz#14f75de3f20d286ef933099b2ce50a90359cef10" + integrity sha1-FPdd4/INKG75MwmbLOUKkDWc7xA= dependencies: merge "^1.1.3" expand-brackets@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" + integrity sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s= dependencies: is-posix-bracket "^0.1.0" expand-range@^1.8.1: version "1.8.2" resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" + integrity sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc= dependencies: fill-range "^2.1.0" extend@~3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" + integrity sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ= extglob@^0.3.1: version "0.3.2" resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" + integrity sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE= dependencies: is-extglob "^1.0.0" extsprintf@1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.0.2.tgz#e1080e0658e300b06294990cc70e1502235fd550" + integrity sha1-4QgOBljjALBilJkMxw4VAiNf1VA= fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= fb-watchman@^1.8.0: version "1.9.2" resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-1.9.2.tgz#a24cf47827f82d38fb59a69ad70b76e3b6ae7383" + integrity sha1-okz0eCf4LTj7Waaa1wt247auc4M= dependencies: bser "1.0.2" fb-watchman@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.0.tgz#54e9abf7dfa2f26cd9b1636c588c1afc05de5d58" + integrity sha1-VOmr99+i8mzZsWNsWIwa/AXeXVg= dependencies: bser "^2.0.0" filename-regex@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" + integrity sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY= fileset@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/fileset/-/fileset-2.0.3.tgz#8e7548a96d3cc2327ee5e674168723a333bba2a0" + integrity sha1-jnVIqW08wjJ+5eZ0FocjozO7oqA= dependencies: glob "^7.0.3" minimatch "^3.0.3" @@ -619,6 +725,7 @@ fileset@^2.0.2: fill-range@^2.1.0: version "2.2.3" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723" + integrity sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM= dependencies: is-number "^2.1.0" isobject "^2.0.0" @@ -629,6 +736,7 @@ fill-range@^2.1.0: find-up@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + integrity sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8= dependencies: path-exists "^2.0.0" pinkie-promise "^2.0.0" @@ -636,26 +744,31 @@ find-up@^1.0.0: find-up@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= dependencies: locate-path "^2.0.0" for-in@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= for-own@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" + integrity sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4= dependencies: for-in "^1.0.1" forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= form-data@~2.1.1: version "2.1.4" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.4.tgz#33c183acf193276ecaa98143a69e94bfee1750d1" + integrity sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE= dependencies: asynckit "^0.4.0" combined-stream "^1.0.5" @@ -664,20 +777,24 @@ form-data@~2.1.1: fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= get-caller-file@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5" + integrity sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U= getpass@^0.1.1: version "0.1.7" resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= dependencies: assert-plus "^1.0.0" glob-base@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" + integrity sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q= dependencies: glob-parent "^2.0.0" is-glob "^2.0.0" @@ -685,12 +802,14 @@ glob-base@^0.3.0: glob-parent@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" + integrity sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg= dependencies: is-glob "^2.0.0" glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" + integrity sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -702,24 +821,29 @@ glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2: globals@^9.0.0: version "9.18.0" resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" + integrity sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== graceful-fs@^4.1.11, graceful-fs@^4.1.2: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" + integrity sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg= graphql@^0.10.5: version "0.10.5" resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.10.5.tgz#c9be17ca2bdfdbd134077ffd9bbaa48b8becd298" + integrity sha512-Q7cx22DiLhwHsEfUnUip1Ww/Vfx7FS0w6+iHItNuN61+XpegHSa3k5U0+6M5BcpavQImBwFiy0z3uYwY7cXMLQ== dependencies: iterall "^1.1.0" growly@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" + integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= handlebars@^4.0.3: version "4.0.10" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.10.tgz#3d30c718b09a3d96f23ea4cc1f403c4d3ba9ff4f" + integrity sha1-PTDHGLCaPZbyPqTMH0A8TTup/08= dependencies: async "^1.4.0" optimist "^0.6.1" @@ -730,10 +854,12 @@ handlebars@^4.0.3: har-schema@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-1.0.5.tgz#d263135f43307c02c602afc8fe95970c0151369e" + integrity sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4= har-validator@~4.2.1: version "4.2.1" resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-4.2.1.tgz#33481d0f1bbff600dd203d75812a6a5fba002e2a" + integrity sha1-M0gdDxu/9gDdID11gSpqX7oALio= dependencies: ajv "^4.9.1" har-schema "^1.0.5" @@ -741,16 +867,19 @@ har-validator@~4.2.1: has-ansi@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= dependencies: ansi-regex "^2.0.0" has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" + integrity sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo= hawk@~3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" + integrity sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ= dependencies: boom "2.x.x" cryptiles "2.x.x" @@ -760,10 +889,12 @@ hawk@~3.1.3: hoek@2.x.x: version "2.16.3" resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" + integrity sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0= home-or-tmp@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8" + integrity sha1-42w/LSyufXRqhX440Y1fMqeILbg= dependencies: os-homedir "^1.0.0" os-tmpdir "^1.0.1" @@ -771,16 +902,19 @@ home-or-tmp@^2.0.0: hosted-git-info@^2.1.4: version "2.5.0" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.5.0.tgz#6d60e34b3abbc8313062c3b798ef8d901a07af3c" + integrity sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg== html-encoding-sniffer@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-1.0.1.tgz#79bf7a785ea495fe66165e734153f363ff5437da" + integrity sha1-eb96eF6klf5mFl5zQVPzY/9UN9o= dependencies: whatwg-encoding "^1.0.1" http-signature@~1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf" + integrity sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8= dependencies: assert-plus "^0.2.0" jsprim "^1.2.2" @@ -789,10 +923,12 @@ http-signature@~1.1.0: iconv-lite@0.4.13: version "0.4.13" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.13.tgz#1f88aba4ab0b1508e8312acc39345f36e992e2f2" + integrity sha1-H4irpKsLFQjoMSrMOTRfNumS4vI= inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= dependencies: once "^1.3.0" wrappy "1" @@ -800,122 +936,147 @@ inflight@^1.0.4: inherits@2: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= invariant@^2.2.0: version "2.2.2" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" + integrity sha1-nh9WrArNtr8wMwbzOL47IErmA2A= dependencies: loose-envify "^1.0.0" invert-kv@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" + integrity sha1-EEqOSqym09jNFXqO+L+rLXo//bY= is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= is-buffer@^1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.5.tgz#1f3b26ef613b214b88cbca23cc6c01d87961eecc" + integrity sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw= is-builtin-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" + integrity sha1-VAVy0096wxGfj3bDDLwbHgN6/74= dependencies: builtin-modules "^1.0.0" is-ci@^1.0.10: version "1.0.10" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.0.10.tgz#f739336b2632365061a9d48270cd56ae3369318e" + integrity sha1-9zkzayYyNlBhqdSCcM1WrjNpMY4= dependencies: ci-info "^1.0.0" is-dotfile@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" + integrity sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE= is-equal-shallow@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" + integrity sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ= dependencies: is-primitive "^2.0.0" is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= is-extglob@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" + integrity sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA= is-finite@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" + integrity sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko= dependencies: number-is-nan "^1.0.0" is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= dependencies: number-is-nan "^1.0.0" is-glob@^2.0.0, is-glob@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" + integrity sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM= dependencies: is-extglob "^1.0.0" is-number@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" + integrity sha1-Afy7s5NGOlSPL0ZszhbezknbkI8= dependencies: kind-of "^3.0.2" is-number@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= dependencies: kind-of "^3.0.2" is-posix-bracket@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" + integrity sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q= is-primitive@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" + integrity sha1-IHurkWOEmcB7Kt8kCkGochADRXU= is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= is-utf8@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" + integrity sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI= isarray@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= isobject@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= dependencies: isarray "1.0.0" isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= istanbul-api@^1.1.1: version "1.1.11" resolved "https://registry.yarnpkg.com/istanbul-api/-/istanbul-api-1.1.11.tgz#fcc0b461e2b3bda71e305155138238768257d9de" + integrity sha1-/MC0YeKzvaceMFFVE4I4doJX2d4= dependencies: async "^2.1.4" fileset "^2.0.2" @@ -932,16 +1093,19 @@ istanbul-api@^1.1.1: istanbul-lib-coverage@^1.0.1, istanbul-lib-coverage@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz#73bfb998885299415c93d38a3e9adf784a77a9da" + integrity sha512-0+1vDkmzxqJIn5rcoEqapSB4DmPxE31EtI2dF2aCkV5esN9EWHxZ0dwgDClivMXJqE7zaYQxq30hj5L0nlTN5Q== istanbul-lib-hook@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.0.7.tgz#dd6607f03076578fe7d6f2a630cf143b49bacddc" + integrity sha512-3U2HB9y1ZV9UmFlE12Fx+nPtFqIymzrqCksrXujm3NVbAZIJg/RfYgO1XiIa0mbmxTjWpVEVlkIZJ25xVIAfkQ== dependencies: append-transform "^0.4.0" istanbul-lib-instrument@^1.4.2, istanbul-lib-instrument@^1.7.2, istanbul-lib-instrument@^1.7.4: version "1.7.4" resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.7.4.tgz#e9fd920e4767f3d19edc765e2d6b3f5ccbd0eea8" + integrity sha1-6f2SDkdn89Ge3HZeLWs/XMvQ7qg= dependencies: babel-generator "^6.18.0" babel-template "^6.16.0" @@ -954,6 +1118,7 @@ istanbul-lib-instrument@^1.4.2, istanbul-lib-instrument@^1.7.2, istanbul-lib-ins istanbul-lib-report@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz#f0e55f56655ffa34222080b7a0cd4760e1405fc9" + integrity sha512-tvF+YmCmH4thnez6JFX06ujIA19WPa9YUiwjc1uALF2cv5dmE3It8b5I8Ob7FHJ70H9Y5yF+TDkVa/mcADuw1Q== dependencies: istanbul-lib-coverage "^1.1.1" mkdirp "^0.5.1" @@ -963,6 +1128,7 @@ istanbul-lib-report@^1.1.1: istanbul-lib-source-maps@^1.1.0, istanbul-lib-source-maps@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.1.tgz#a6fe1acba8ce08eebc638e572e294d267008aa0c" + integrity sha512-mukVvSXCn9JQvdJl8wP/iPhqig0MRtuWuD4ZNKo6vB2Ik//AmhAKe3QnPN02dmkRe3lTudFk3rzoHhwU4hb94w== dependencies: debug "^2.6.3" istanbul-lib-coverage "^1.1.1" @@ -973,20 +1139,24 @@ istanbul-lib-source-maps@^1.1.0, istanbul-lib-source-maps@^1.2.1: istanbul-reports@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.1.1.tgz#042be5c89e175bc3f86523caab29c014e77fee4e" + integrity sha512-P8G873A0kW24XRlxHVGhMJBhQ8gWAec+dae7ZxOBzxT4w+a9ATSPvRVK3LB1RAJ9S8bg2tOyWHAGW40Zd2dKfw== dependencies: handlebars "^4.0.3" iterall@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.1.1.tgz#f7f0af11e9a04ec6426260f5019d9fcca4d50214" + integrity sha1-9/CvEemgTsZCYmD1AZ2fzKTVAhQ= jest-changed-files@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-20.0.3.tgz#9394d5cc65c438406149bef1bf4d52b68e03e3f8" + integrity sha1-k5TVzGXEOEBhSb7xv01Sto4D4/g= jest-cli@^20.0.4: version "20.0.4" resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-20.0.4.tgz#e532b19d88ae5bc6c417e8b0593a6fe954b1dc93" + integrity sha1-5TKxnYiuW8bEF+iwWTpv6VSx3JM= dependencies: ansi-escapes "^1.4.0" callsites "^2.0.0" @@ -1022,6 +1192,7 @@ jest-cli@^20.0.4: jest-config@^20.0.4: version "20.0.4" resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-20.0.4.tgz#e37930ab2217c913605eff13e7bd763ec48faeea" + integrity sha1-43kwqyIXyRNgXv8T5712PsSPruo= dependencies: chalk "^1.1.3" glob "^7.1.1" @@ -1037,6 +1208,7 @@ jest-config@^20.0.4: jest-diff@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-20.0.3.tgz#81f288fd9e675f0fb23c75f1c2b19445fe586617" + integrity sha1-gfKI/Z5nXw+yPHXxwrGURf5YZhc= dependencies: chalk "^1.1.3" diff "^3.2.0" @@ -1046,10 +1218,12 @@ jest-diff@^20.0.3: jest-docblock@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-20.0.3.tgz#17bea984342cc33d83c50fbe1545ea0efaa44712" + integrity sha1-F76phDQswz2DxQ++FUXqDvqkRxI= jest-environment-jsdom@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-20.0.3.tgz#048a8ac12ee225f7190417713834bb999787de99" + integrity sha1-BIqKwS7iJfcZBBdxODS7mZeH3pk= dependencies: jest-mock "^20.0.3" jest-util "^20.0.3" @@ -1058,6 +1232,7 @@ jest-environment-jsdom@^20.0.3: jest-environment-node@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-20.0.3.tgz#d488bc4612af2c246e986e8ae7671a099163d403" + integrity sha1-1Ii8RhKvLCRumG6K52caCZFj1AM= dependencies: jest-mock "^20.0.3" jest-util "^20.0.3" @@ -1065,6 +1240,7 @@ jest-environment-node@^20.0.3: jest-haste-map@^20.0.4: version "20.0.5" resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-20.0.5.tgz#abad74efb1a005974a7b6517e11010709cab9112" + integrity sha512-0IKAQjUvuZjMCNi/0VNQQF74/H9KB67hsHJqGiwTWQC6XO5Azs7kLWm+6Q/dwuhvDUvABDOBMFK2/FwZ3sZ07Q== dependencies: fb-watchman "^2.0.0" graceful-fs "^4.1.11" @@ -1076,6 +1252,7 @@ jest-haste-map@^20.0.4: jest-jasmine2@^20.0.4: version "20.0.4" resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-20.0.4.tgz#fcc5b1411780d911d042902ef1859e852e60d5e1" + integrity sha1-/MWxQReA2RHQQpAu8YWehS5g1eE= dependencies: chalk "^1.1.3" graceful-fs "^4.1.11" @@ -1090,6 +1267,7 @@ jest-jasmine2@^20.0.4: jest-matcher-utils@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-20.0.3.tgz#b3a6b8e37ca577803b0832a98b164f44b7815612" + integrity sha1-s6a443yld4A7CDKpixZPRLeBVhI= dependencies: chalk "^1.1.3" pretty-format "^20.0.3" @@ -1097,6 +1275,7 @@ jest-matcher-utils@^20.0.3: jest-matchers@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/jest-matchers/-/jest-matchers-20.0.3.tgz#ca69db1c32db5a6f707fa5e0401abb55700dfd60" + integrity sha1-ymnbHDLbWm9wf6XgQBq7VXAN/WA= dependencies: jest-diff "^20.0.3" jest-matcher-utils "^20.0.3" @@ -1106,6 +1285,7 @@ jest-matchers@^20.0.3: jest-message-util@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-20.0.3.tgz#6aec2844306fcb0e6e74d5796c1006d96fdd831c" + integrity sha1-auwoRDBvyw5udNV5bBAG2W/dgxw= dependencies: chalk "^1.1.3" micromatch "^2.3.11" @@ -1114,20 +1294,24 @@ jest-message-util@^20.0.3: jest-mock@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-20.0.3.tgz#8bc070e90414aa155c11a8d64c869a0d5c71da59" + integrity sha1-i8Bw6QQUqhVcEajWTIaaDVxx2lk= jest-regex-util@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-20.0.3.tgz#85bbab5d133e44625b19faf8c6aa5122d085d762" + integrity sha1-hburXRM+RGJbGfr4xqpRItCF12I= jest-resolve-dependencies@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-20.0.3.tgz#6e14a7b717af0f2cb3667c549de40af017b1723a" + integrity sha1-bhSntxevDyyzZnxUneQK8Bexcjo= dependencies: jest-regex-util "^20.0.3" jest-resolve@^20.0.4: version "20.0.4" resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-20.0.4.tgz#9448b3e8b6bafc15479444c6499045b7ffe597a5" + integrity sha1-lEiz6La6/BVHlETGSZBFt//ll6U= dependencies: browser-resolve "^1.11.2" is-builtin-module "^1.0.0" @@ -1136,6 +1320,7 @@ jest-resolve@^20.0.4: jest-runtime@^20.0.4: version "20.0.4" resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-20.0.4.tgz#a2c802219c4203f754df1404e490186169d124d8" + integrity sha1-osgCIZxCA/dU3xQE5JAYYWnRJNg= dependencies: babel-core "^6.0.0" babel-jest "^20.0.3" @@ -1156,6 +1341,7 @@ jest-runtime@^20.0.4: jest-snapshot@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-20.0.3.tgz#5b847e1adb1a4d90852a7f9f125086e187c76566" + integrity sha1-W4R+GtsaTZCFKn+fElCG4YfHZWY= dependencies: chalk "^1.1.3" jest-diff "^20.0.3" @@ -1167,6 +1353,7 @@ jest-snapshot@^20.0.3: jest-util@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-20.0.3.tgz#0c07f7d80d82f4e5a67c6f8b9c3fe7f65cfd32ad" + integrity sha1-DAf32A2C9OWmfG+LnD/n9lz9Mq0= dependencies: chalk "^1.1.3" graceful-fs "^4.1.11" @@ -1179,6 +1366,7 @@ jest-util@^20.0.3: jest-validate@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-20.0.3.tgz#d0cfd1de4f579f298484925c280f8f1d94ec3cab" + integrity sha1-0M/R3k9XnymEhJJcKA+PHZTsPKs= dependencies: chalk "^1.1.3" jest-matcher-utils "^20.0.3" @@ -1188,16 +1376,19 @@ jest-validate@^20.0.3: jest@^20.0.4: version "20.0.4" resolved "https://registry.yarnpkg.com/jest/-/jest-20.0.4.tgz#3dd260c2989d6dad678b1e9cc4d91944f6d602ac" + integrity sha1-PdJgwpidba1nix6cxNkZRPbWAqw= dependencies: jest-cli "^20.0.4" js-tokens@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= js-yaml@^3.7.0: version "3.9.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.9.0.tgz#4ffbbf25c2ac963b8299dc74da7e3740de1c18ce" + integrity sha512-0LoUNELX4S+iofCT8f4uEHIiRBR+c2AINyC8qRWfC6QNruLtxVZRJaPcu/xwMgFIgDxF25tGHaDjvxzJCNE9yw== dependencies: argparse "^1.0.7" esprima "^4.0.0" @@ -1205,10 +1396,12 @@ js-yaml@^3.7.0: jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= jsdom@^9.12.0: version "9.12.0" resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-9.12.0.tgz#e8c546fffcb06c00d4833ca84410fed7f8a097d4" + integrity sha1-6MVG//ywbADUgzyoRBD+1/igl9Q= dependencies: abab "^1.0.3" acorn "^4.0.4" @@ -1233,32 +1426,39 @@ jsdom@^9.12.0: jsesc@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" + integrity sha1-RsP+yMGJKxKwgz25vHYiF226s0s= json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= json-stable-stringify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" + integrity sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8= dependencies: jsonify "~0.0.0" json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= json5@^0.5.0: version "0.5.1" resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" + integrity sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE= jsonify@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" + integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM= jsprim@^1.2.2: version "1.4.0" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.0.tgz#a3b87e40298d8c380552d8cc7628a0bb95a22918" + integrity sha1-o7h+QCmNjDgFUtjMdiigu5WiKRg= dependencies: assert-plus "1.0.0" extsprintf "1.0.2" @@ -1268,32 +1468,38 @@ jsprim@^1.2.2: kind-of@^3.0.2: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= dependencies: is-buffer "^1.1.5" kind-of@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= dependencies: is-buffer "^1.1.5" lazy-cache@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" + integrity sha1-odePw6UEdMuAhF07O24dpJpEbo4= lcid@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" + integrity sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU= dependencies: invert-kv "^1.0.0" leven@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" + integrity sha1-wuep93IJTe6dNCAq6KzORoeHVYA= levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= dependencies: prelude-ls "~1.1.2" type-check "~0.3.2" @@ -1301,6 +1507,7 @@ levn@~0.3.0: load-json-file@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" + integrity sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA= dependencies: graceful-fs "^4.1.2" parse-json "^2.2.0" @@ -1311,6 +1518,7 @@ load-json-file@^1.0.0: locate-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= dependencies: p-locate "^2.0.0" path-exists "^3.0.0" @@ -1318,30 +1526,36 @@ locate-path@^2.0.0: lodash@^4.14.0, lodash@^4.2.0, lodash@~4.17.2: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" + integrity sha1-eCA6TRwyiuHYbcpkYONptX9AVa4= longest@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" + integrity sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc= loose-envify@^1.0.0: version "1.3.1" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" + integrity sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg= dependencies: js-tokens "^3.0.0" makeerror@1.0.x: version "1.0.11" resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" + integrity sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw= dependencies: tmpl "1.0.x" merge@^1.1.3: version "1.2.0" resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.0.tgz#7531e39d4949c281a66b8c5a6e0265e8b05894da" + integrity sha1-dTHjnUlJwoGma4xabgJl6LBYlNo= micromatch@^2.1.5, micromatch@^2.3.11: version "2.3.11" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" + integrity sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU= dependencies: arr-diff "^2.0.0" array-unique "^0.2.1" @@ -1360,44 +1574,53 @@ micromatch@^2.1.5, micromatch@^2.3.11: mime-db@~1.27.0: version "1.27.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.27.0.tgz#820f572296bbd20ec25ed55e5b5de869e5436eb1" + integrity sha1-gg9XIpa70g7CXtVeW13oaeVDbrE= mime-types@^2.1.12, mime-types@~2.1.7: version "2.1.15" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.15.tgz#a4ebf5064094569237b8cf70046776d09fc92aed" + integrity sha1-pOv1BkCUVpI3uM9wBGd20J/JKu0= dependencies: mime-db "~1.27.0" minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== dependencies: brace-expansion "^1.1.7" minimist@0.0.8, minimist@~0.0.1: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= minimist@^1.1.1, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= mkdirp@^0.5.0, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= dependencies: minimist "0.0.8" ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= nock@^9.0.14: version "9.0.14" resolved "https://registry.yarnpkg.com/nock/-/nock-9.0.14.tgz#2211550253173ce298bcd89fca825e83813ca72b" + integrity sha1-IhFVAlMXPOKYvNifyoJeg4E8pys= dependencies: chai ">=1.9.2 <4.0.0" debug "^2.2.0" @@ -1412,10 +1635,12 @@ nock@^9.0.14: node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= node-notifier@^5.0.2: version "5.1.2" resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.1.2.tgz#2fa9e12605fa10009d44549d6fcd8a63dde0e4ff" + integrity sha1-L6nhJgX6EACdRFSdb82KY93g5P8= dependencies: growly "^1.3.0" semver "^5.3.0" @@ -1425,6 +1650,7 @@ node-notifier@^5.0.2: normalize-package-data@^2.3.2: version "2.4.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" + integrity sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw== dependencies: hosted-git-info "^2.1.4" is-builtin-module "^1.0.0" @@ -1434,28 +1660,34 @@ normalize-package-data@^2.3.2: normalize-path@^2.0.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" + integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= dependencies: remove-trailing-separator "^1.0.1" number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= "nwmatcher@>= 1.3.9 < 2.0.0": version "1.4.1" resolved "https://registry.yarnpkg.com/nwmatcher/-/nwmatcher-1.4.1.tgz#7ae9b07b0ea804db7e25f05cb5fe4097d4e4949f" + integrity sha1-eumwew6oBNt+JfBctf5Al9TklJ8= oauth-sign@~0.8.1: version "0.8.2" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" + integrity sha1-Rqarfwrq2N6unsBWV4C31O/rnUM= object-assign@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= object.omit@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" + integrity sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo= dependencies: for-own "^0.1.4" is-extendable "^0.1.1" @@ -1463,12 +1695,14 @@ object.omit@^2.0.0: once@^1.3.0, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= dependencies: wrappy "1" optimist@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" + integrity sha1-2j6nRob6IaGaERwybpDrFaAZZoY= dependencies: minimist "~0.0.1" wordwrap "~0.0.2" @@ -1476,6 +1710,7 @@ optimist@^0.6.1: optionator@^0.8.1: version "0.8.2" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" + integrity sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q= dependencies: deep-is "~0.1.3" fast-levenshtein "~2.0.4" @@ -1487,34 +1722,41 @@ optionator@^0.8.1: os-homedir@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= os-locale@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9" + integrity sha1-IPnxeuKe00XoveWDsT0gCYA8FNk= dependencies: lcid "^1.0.0" os-tmpdir@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= p-limit@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.1.0.tgz#b07ff2d9a5d88bec806035895a2bab66a27988bc" + integrity sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw= p-locate@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= dependencies: p-limit "^1.1.0" p-map@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.1.1.tgz#05f5e4ae97a068371bc2a5cc86bfbdbc19c4ae7a" + integrity sha1-BfXkrpegaDcbwqXMhr+9vBnErno= parse-glob@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" + integrity sha1-ssN2z7EfNVE7rdFz7wu246OIORw= dependencies: glob-base "^0.3.0" is-dotfile "^1.0.0" @@ -1524,34 +1766,41 @@ parse-glob@^3.0.4: parse-json@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + integrity sha1-9ID0BDTvgHQfhGkJn43qGPVaTck= dependencies: error-ex "^1.2.0" parse5@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/parse5/-/parse5-1.5.1.tgz#9b7f3b0de32be78dc2401b17573ccaf0f6f59d94" + integrity sha1-m387DeMr543CQBsXVzzK8Pb1nZQ= path-exists@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" + integrity sha1-D+tsZPD8UY2adU3V77YscCJ2H0s= dependencies: pinkie-promise "^2.0.0" path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= path-parse@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" + integrity sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME= path-type@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" + integrity sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE= dependencies: graceful-fs "^4.1.2" pify "^2.0.0" @@ -1560,32 +1809,39 @@ path-type@^1.0.0: performance-now@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5" + integrity sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU= pify@^2.0.0, pify@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + integrity sha1-7RQaasBDqEnqWISY59yosVMw6Qw= pinkie-promise@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + integrity sha1-ITXW36ejWMBprJsXh3YogihFD/o= dependencies: pinkie "^2.0.0" pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" + integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks= pretty-format@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-20.0.3.tgz#020e350a560a1fe1a98dc3beb6ccffb386de8b14" + integrity sha1-Ag41ClYKH+GpjcO+tsz/s4beixQ= dependencies: ansi-regex "^2.1.1" ansi-styles "^3.0.0" @@ -1593,26 +1849,32 @@ pretty-format@^20.0.3: private@^0.1.6: version "0.1.7" resolved "https://registry.yarnpkg.com/private/-/private-0.1.7.tgz#68ce5e8a1ef0a23bb570cc28537b5332aba63ef1" + integrity sha1-aM5eih7woju1cMwoU3tTMqumPvE= propagate@0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/propagate/-/propagate-0.4.0.tgz#f3fcca0a6fe06736a7ba572966069617c130b481" + integrity sha1-8/zKCm/gZzanulcpZgaWF8EwtIE= prr@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a" + integrity sha1-GoS4WQgyVQFBGFPQCB7j+obikmo= punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= qs@^6.0.2, qs@~6.4.0: version "6.4.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" + integrity sha1-E+JtKK1rD/qpExLNO/cI7TUecjM= randomatic@^1.1.3: version "1.1.7" resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.7.tgz#c7abe9cc8b87c0baa876b19fde83fd464797e38c" + integrity sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how== dependencies: is-number "^3.0.0" kind-of "^4.0.0" @@ -1620,6 +1882,7 @@ randomatic@^1.1.3: read-pkg-up@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" + integrity sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI= dependencies: find-up "^1.0.0" read-pkg "^1.0.0" @@ -1627,6 +1890,7 @@ read-pkg-up@^1.0.1: read-pkg@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" + integrity sha1-9f+qXs0pyzHAR0vKfXVra7KePyg= dependencies: load-json-file "^1.0.0" normalize-package-data "^2.3.2" @@ -1635,10 +1899,12 @@ read-pkg@^1.0.0: regenerator-runtime@^0.10.0: version "0.10.5" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658" + integrity sha1-M2w+/BIgrc7dosn6tntaeVWjNlg= regex-cache@^0.4.2: version "0.4.3" resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.3.tgz#9b1a6c35d4d0dfcef5711ae651e8e9d3d7114145" + integrity sha1-mxpsNdTQ3871cRrmUejp09cRQUU= dependencies: is-equal-shallow "^0.1.3" is-primitive "^2.0.0" @@ -1646,24 +1912,29 @@ regex-cache@^0.4.2: remove-trailing-separator@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.0.2.tgz#69b062d978727ad14dc6b56ba4ab772fd8d70511" + integrity sha1-abBi2XhyetFNxrVrpKt3L9jXBRE= repeat-element@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a" + integrity sha1-7wiaF40Ug7quTZPrmLT55OEdmQo= repeat-string@^1.5.2: version "1.6.1" resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= repeating@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" + integrity sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo= dependencies: is-finite "^1.0.0" request@^2.79.0: version "2.81.0" resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" + integrity sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA= dependencies: aws-sign2 "~0.6.0" aws4 "^1.2.1" @@ -1691,40 +1962,48 @@ request@^2.79.0: require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= require-main-filename@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= resolve@1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" + integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= resolve@^1.3.2: version "1.3.3" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.3.tgz#655907c3469a8680dc2de3a275a8fdd69691f0e5" + integrity sha1-ZVkHw0aahoDcLeOidaj91paR8OU= dependencies: path-parse "^1.0.5" right-align@^0.1.1: version "0.1.3" resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" + integrity sha1-YTObci/mo1FWiSENJOFMlhSGE+8= dependencies: align-text "^0.1.1" rimraf@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" + integrity sha1-wjOOxkPfeht/5cVPqG9XQopV8z0= dependencies: glob "^7.0.5" safe-buffer@^5.0.1: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" + integrity sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg== sane@~1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/sane/-/sane-1.6.0.tgz#9610c452307a135d29c1fdfe2547034180c46775" + integrity sha1-lhDEUjB6E10pwf3+JUcDQYDEZ3U= dependencies: anymatch "^1.3.0" exec-sh "^0.2.0" @@ -1737,72 +2016,87 @@ sane@~1.6.0: sax@^1.2.1: version "1.2.4" resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" + integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== "semver@2 || 3 || 4 || 5", semver@^5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" + integrity sha1-myzl094C0XxgEq0yaqa00M9U+U8= set-blocking@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= shellwords@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.0.tgz#66afd47b6a12932d9071cbfd98a52e785cd0ba14" + integrity sha1-Zq/Ue2oSky2Qccv9mKUueFzQuhQ= slash@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" + integrity sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU= sntp@1.x.x: version "1.0.9" resolved "https://registry.yarnpkg.com/sntp/-/sntp-1.0.9.tgz#6541184cc90aeea6c6e7b35e2659082443c66198" + integrity sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg= dependencies: hoek "2.x.x" source-map-support@^0.4.2: version "0.4.15" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.15.tgz#03202df65c06d2bd8c7ec2362a193056fef8d3b1" + integrity sha1-AyAt9lwG0r2MfsI2KhkwVv7407E= dependencies: source-map "^0.5.6" source-map@^0.4.4: version "0.4.4" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" + integrity sha1-66T12pwNyZneaAMti092FzZSA2s= dependencies: amdefine ">=0.0.4" source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1: version "0.5.6" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" + integrity sha1-dc449SvwczxafwwRjYEzSiu19BI= source-map@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.2.0.tgz#dab73fbcfc2ba819b4de03bd6f6eaa48164b3f9d" + integrity sha1-2rc/vPwrqBm03gO9b26qSBZLP50= dependencies: amdefine ">=0.0.4" spdx-correct@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" + integrity sha1-SzBz2TP/UfORLwOsVRlJikFQ20A= dependencies: spdx-license-ids "^1.0.2" spdx-expression-parse@~1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz#9bdf2f20e1f40ed447fbe273266191fced51626c" + integrity sha1-m98vIOH0DtRH++JzJmGR/O1RYmw= spdx-license-ids@^1.0.2: version "1.2.2" resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz#c9df7a3424594ade6bd11900d596696dc06bac57" + integrity sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc= sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= sshpk@^1.7.0: version "1.13.1" resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.13.1.tgz#512df6da6287144316dc4c18fe1cf1d940739be3" + integrity sha1-US322mKHFEMW3EwY/hzx2UBzm+M= dependencies: asn1 "~0.2.3" assert-plus "^1.0.0" @@ -1817,12 +2111,14 @@ sshpk@^1.7.0: string-length@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/string-length/-/string-length-1.0.1.tgz#56970fb1c38558e9e70b728bf3de269ac45adfac" + integrity sha1-VpcPscOFWOnnC3KL894mmsRa36w= dependencies: strip-ansi "^3.0.0" string-width@^1.0.1, string-width@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= dependencies: code-point-at "^1.0.0" is-fullwidth-code-point "^1.0.0" @@ -1831,40 +2127,48 @@ string-width@^1.0.1, string-width@^1.0.2: stringstream@~0.0.4: version "0.0.5" resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" + integrity sha1-TkhM1N5aC7vuGORjB3EKioFiGHg= strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= dependencies: ansi-regex "^2.0.0" strip-bom@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= strip-bom@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" + integrity sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4= dependencies: is-utf8 "^0.2.0" supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= supports-color@^3.1.2: version "3.2.3" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" + integrity sha1-ZawFBLOVQXHYpklGsq48u4pfVPY= dependencies: has-flag "^1.0.0" symbol-tree@^3.2.1: version "3.2.2" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" + integrity sha1-rifbOPZgp64uHDt9G8KQgZuFGeY= test-exclude@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.1.1.tgz#4d84964b0966b0087ecc334a2ce002d3d9341e26" + integrity sha512-35+Asrsk3XHJDBgf/VRFexPgh3UyETv8IAn/LRTiZjVy6rjPVqdEk8dJcJYBzl1w0XCJM48lvTy8SfEsCWS4nA== dependencies: arrify "^1.0.1" micromatch "^2.3.11" @@ -1875,56 +2179,68 @@ test-exclude@^4.1.1: throat@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/throat/-/throat-3.2.0.tgz#50cb0670edbc40237b9e347d7e1f88e4620af836" + integrity sha512-/EY8VpvlqJ+sFtLPeOgc8Pl7kQVOWv0woD87KTXVHPIAE842FGT+rokxIhe8xIUP1cfgrkt0as0vDLjDiMtr8w== tmpl@1.0.x: version "1.0.4" resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" + integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= to-fast-properties@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" + integrity sha1-uDVx+k2MJbguIxsG46MFXeTKGkc= tough-cookie@^2.3.2, tough-cookie@~2.3.0: version "2.3.2" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.2.tgz#f081f76e4c85720e6c37a5faced737150d84072a" + integrity sha1-8IH3bkyFcg5sN6X6ztc3FQ2EByo= dependencies: punycode "^1.4.1" tr46@~0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" + integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= dependencies: safe-buffer "^5.0.1" tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= dependencies: prelude-ls "~1.1.2" type-detect@0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822" + integrity sha1-C6XsKohWQORw6k6FBZcZANrFiCI= type-detect@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2" + integrity sha1-diIXzAbbJY7EiQihKY6LlRIejqI= uglify-js@^2.6: version "2.8.29" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" + integrity sha1-KcVzMUgFe7Th913zW3qcty5qWd0= dependencies: source-map "~0.5.1" yargs "~3.10.0" @@ -1934,14 +2250,17 @@ uglify-js@^2.6: uglify-to-browserify@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" + integrity sha1-bgkk1r2mta/jSeOabWMoUKD4grc= uuid@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" + integrity sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g== validate-npm-package-license@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc" + integrity sha1-KAS6vnEq0zeUWaz74kdGqywwP7w= dependencies: spdx-correct "~1.0.0" spdx-expression-parse "~1.0.0" @@ -1949,36 +2268,43 @@ validate-npm-package-license@^3.0.1: verror@1.3.6: version "1.3.6" resolved "https://registry.yarnpkg.com/verror/-/verror-1.3.6.tgz#cff5df12946d297d2baaefaa2689e25be01c005c" + integrity sha1-z/XfEpRtKX0rqu+qJoniW+AcAFw= dependencies: extsprintf "1.0.2" walker@~1.0.5: version "1.0.7" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" + integrity sha1-L3+bj9ENZ3JisYqITijRlhjgKPs= dependencies: makeerror "1.0.x" watch@~0.10.0: version "0.10.0" resolved "https://registry.yarnpkg.com/watch/-/watch-0.10.0.tgz#77798b2da0f9910d595f1ace5b0c2258521f21dc" + integrity sha1-d3mLLaD5kQ1ZXxrOWwwiWFIfIdw= webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= webidl-conversions@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.1.tgz#8015a17ab83e7e1b311638486ace81da6ce206a0" + integrity sha1-gBWherg+fhsxFjhIas6B2mziBqA= whatwg-encoding@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.1.tgz#3c6c451a198ee7aec55b1ec61d0920c67801a5f4" + integrity sha1-PGxFGhmO567FWx7GHQkgxngBpfQ= dependencies: iconv-lite "0.4.13" whatwg-url@^4.3.0: version "4.8.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.8.0.tgz#d2981aa9148c1e00a41c5a6131166ab4683bbcc0" + integrity sha1-0pgaqRSMHgCkHFphMRZqtGg7vMA= dependencies: tr46 "~0.0.3" webidl-conversions "^3.0.0" @@ -1986,32 +2312,39 @@ whatwg-url@^4.3.0: which-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" + integrity sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8= which@^1.2.12: version "1.2.14" resolved "https://registry.yarnpkg.com/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5" + integrity sha1-mofEN48D6CfOyvGs31bHNsAcFOU= dependencies: isexe "^2.0.0" window-size@0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" + integrity sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0= wordwrap@0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" + integrity sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8= wordwrap@~0.0.2: version "0.0.3" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" + integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc= wordwrap@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= worker-farm@^1.3.1: version "1.4.1" resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.4.1.tgz#a438bc993a7a7d133bcb6547c95eca7cff4897d8" + integrity sha512-tgFAtgOYLPutkAyzgpS6VJFL5HY+0ui1Tvua+fITgz8ByaJTMFGtazR6xxQfwfiAcbwE+2fLG/K49wc2TfwCNw== dependencies: errno "^0.1.4" xtend "^4.0.1" @@ -2019,6 +2352,7 @@ worker-farm@^1.3.1: wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + integrity sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU= dependencies: string-width "^1.0.1" strip-ansi "^3.0.1" @@ -2026,28 +2360,34 @@ wrap-ansi@^2.0.0: wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= xml-name-validator@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-2.0.1.tgz#4d8b8f1eccd3419aa362061becef515e1e559635" + integrity sha1-TYuPHszTQZqjYgYb7O9RXh5VljU= xtend@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" + integrity sha1-pcbVMr5lbiPbgg77lDofBJmNY68= y18n@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" + integrity sha1-bRX7qITAhnnA136I53WegR4H+kE= yargs-parser@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.0.tgz#275ecf0d7ffe05c77e64e7c86e4cd94bf0e1228a" + integrity sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo= dependencies: camelcase "^3.0.0" yargs@^7.0.2: version "7.1.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.1.0.tgz#6ba318eb16961727f5d284f8ea003e8d6154d0c8" + integrity sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg= dependencies: camelcase "^3.0.0" cliui "^3.2.0" @@ -2066,6 +2406,7 @@ yargs@^7.0.2: yargs@~3.10.0: version "3.10.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" + integrity sha1-9+572FfdfB0tOMDnTvvWgdFDH9E= dependencies: camelcase "^1.0.2" cliui "^2.1.0" @@ -2075,3 +2416,4 @@ yargs@~3.10.0: zen-observable@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.6.0.tgz#8a6157ed15348d185d948cfc4a59d90a2c0f70ee" + integrity sha512-G5v4eFZ1+qJC9U3iyldcc7OLsYfFf6/+/vywU3acbq0qq1PdFXsyfqtOUaQSTwhdbejO7AQWil3GzHxYlMchIg== diff --git a/lib/graphql/static_validation/base_visitor.rb b/lib/graphql/static_validation/base_visitor.rb index 0894365bcc..f53942f33f 100644 --- a/lib/graphql/static_validation/base_visitor.rb +++ b/lib/graphql/static_validation/base_visitor.rb @@ -174,6 +174,7 @@ def on_fragment_with_type(node) # Error `message` is located at `node` def add_error(message, nodes, path: nil) + # Add an optional hash here that message adds onto the response object - then easy to vary for all items path ||= @path.dup nodes = Array(nodes) m = GraphQL::StaticValidation::Message.new(message, nodes: nodes, path: path) diff --git a/lib/graphql/static_validation/message.rb b/lib/graphql/static_validation/message.rb index 073a5f398b..3e7842cc33 100644 --- a/lib/graphql/static_validation/message.rb +++ b/lib/graphql/static_validation/message.rb @@ -7,6 +7,7 @@ class Message module MessageHelper # Error `message` is located at `node` def message(message, nodes, context: nil, path: nil) + # TODO: also add object hash of extras as in base_visitor path ||= context.path nodes = Array(nodes) GraphQL::StaticValidation::Message.new(message, nodes: nodes, path: path) @@ -26,7 +27,7 @@ def to_h { "message" => message, "locations" => locations, - "fields" => path, + "path" => path, } end diff --git a/spec/graphql/execution/multiplex_spec.rb b/spec/graphql/execution/multiplex_spec.rb index 65db926ede..5e098221af 100644 --- a/spec/graphql/execution/multiplex_spec.rb +++ b/spec/graphql/execution/multiplex_spec.rb @@ -94,7 +94,7 @@ def multiplex(*a) "errors" => [{ "message"=>"Field must have selections (field 'nullableNestedSum' returns LazySum but has no selections. Did you mean 'nullableNestedSum { ... }'?)", "locations"=>[{"line"=>1, "column"=>4}], - "fields"=>["query", "validationError"] + "path"=>["query", "validationError"] }] }, ] diff --git a/spec/graphql/static_validation/rules/argument_literals_are_compatible_spec.rb b/spec/graphql/static_validation/rules/argument_literals_are_compatible_spec.rb index 897ebc602b..47b6f3d188 100644 --- a/spec/graphql/static_validation/rules/argument_literals_are_compatible_spec.rb +++ b/spec/graphql/static_validation/rules/argument_literals_are_compatible_spec.rb @@ -27,42 +27,42 @@ query_root_error = { "message"=>"Argument 'id' on Field 'stringCheese' has an invalid value. Expected type 'Int!'.", "locations"=>[{"line"=>3, "column"=>7}], - "fields"=>["query getCheese", "stringCheese", "id"], + "path"=>["query getCheese", "stringCheese", "id"], } assert_includes(errors, query_root_error) directive_error = { "message"=>"Argument 'if' on Directive 'skip' has an invalid value. Expected type 'Boolean!'.", "locations"=>[{"line"=>4, "column"=>30}], - "fields"=>["query getCheese", "cheese", "source", "if"], + "path"=>["query getCheese", "cheese", "source", "if"], } assert_includes(errors, directive_error) input_object_error = { "message"=>"Argument 'product' on Field 'badSource' has an invalid value. Expected type '[DairyProductInput]'.", "locations"=>[{"line"=>6, "column"=>7}], - "fields"=>["query getCheese", "badSource", "product"], + "path"=>["query getCheese", "badSource", "product"], } assert_includes(errors, input_object_error) input_object_field_error = { "message"=>"Argument 'source' on InputObject 'DairyProductInput' has an invalid value. Expected type 'DairyAnimal!'.", "locations"=>[{"line"=>6, "column"=>40}], - "fields"=>["query getCheese", "badSource", "product", "source"], + "path"=>["query getCheese", "badSource", "product", "source"], } assert_includes(errors, input_object_field_error) missing_required_field_error = { "message"=>"Argument 'product' on Field 'missingSource' has an invalid value. Expected type '[DairyProductInput]'.", "locations"=>[{"line"=>7, "column"=>7}], - "fields"=>["query getCheese", "missingSource", "product"], + "path"=>["query getCheese", "missingSource", "product"], } assert_includes(errors, missing_required_field_error) fragment_error = { "message"=>"Argument 'source' on Field 'similarCheese' has an invalid value. Expected type '[DairyAnimal!]!'.", "locations"=>[{"line"=>13, "column"=>7}], - "fields"=>["fragment cheeseFields", "similarCheese", "source"], + "path"=>["fragment cheeseFields", "similarCheese", "source"], } assert_includes(errors, fragment_error) end @@ -120,7 +120,7 @@ assert_equal [{ "message"=>"Argument 'arg' on Field 'field' has an invalid value. Expected type 'Int!'.", "locations"=>[{"line"=>3, "column"=>11}], - "fields"=>["query", "field", "arg"], + "path"=>["query", "field", "arg"], }], errors end end @@ -143,7 +143,7 @@ assert_equal [{ "message"=>"Argument 'arg' on Field 'field' has an invalid value. Expected type '[Int!]'.", "locations"=>[{"line"=>3, "column"=>11}], - "fields"=>["query", "field", "arg"], + "path"=>["query", "field", "arg"], }], errors end end @@ -192,13 +192,13 @@ assert_includes errors, { "message"=> "Argument 'arg' on Field 'field' has an invalid value. Expected type 'Input'.", "locations"=>[{"line"=>3, "column"=>11}], - "fields"=>["query", "field", "arg"] + "path"=>["query", "field", "arg"] } assert_includes errors, { "message"=>"Argument 'b' on InputObject 'Input' has an invalid value. Expected type 'Int!'.", "locations"=>[{"line"=>3, "column"=>22}], - "fields"=>["query", "field", "arg", "b"] + "path"=>["query", "field", "arg", "b"] } end end @@ -215,7 +215,7 @@ assert_includes(errors, { "message"=>"Argument 'name' on Field '__type' has an invalid value. Expected type 'String!'.", "locations"=>[{"line"=>3, "column"=>9}], - "fields"=>["query", "__type", "name"], + "path"=>["query", "__type", "name"], }) end end @@ -266,7 +266,7 @@ assert_includes errors, { "message"=> "cannot coerce to Float", "locations"=>[{"line"=>3, "column"=>9}], - "fields"=>["query", "time", "value"] + "path"=>["query", "time", "value"] } end end diff --git a/spec/graphql/static_validation/rules/argument_names_are_unique_spec.rb b/spec/graphql/static_validation/rules/argument_names_are_unique_spec.rb index efa442c0d9..0b79882f73 100644 --- a/spec/graphql/static_validation/rules/argument_names_are_unique_spec.rb +++ b/spec/graphql/static_validation/rules/argument_names_are_unique_spec.rb @@ -19,7 +19,7 @@ error = errors.first assert_equal 'There can be only one argument named "id"', error["message"] assert_equal [{ "line" => 2, "column" => 18}, { "line" => 2, "column" => 25 }], error["locations"] - assert_equal ["query GetStuff", "c1"], error["fields"] + assert_equal ["query GetStuff", "c1"], error["path"] end end @@ -38,7 +38,7 @@ error = errors.first assert_equal 'There can be only one argument named "if"', error["message"] assert_equal [{ "line" => 2, "column" => 34}, { "line" => 2, "column" => 44 }], error["locations"] - assert_equal ["query GetStuff", "c1"], error["fields"] + assert_equal ["query GetStuff", "c1"], error["path"] end end end diff --git a/spec/graphql/static_validation/rules/arguments_are_defined_spec.rb b/spec/graphql/static_validation/rules/arguments_are_defined_spec.rb index 0e82cc43ba..5306fe1981 100644 --- a/spec/graphql/static_validation/rules/arguments_are_defined_spec.rb +++ b/spec/graphql/static_validation/rules/arguments_are_defined_spec.rb @@ -25,28 +25,28 @@ query_root_error = { "message"=>"Field 'cheese' doesn't accept argument 'silly'", "locations"=>[{"line"=>4, "column"=>14}], - "fields"=>["query getCheese", "cheese", "silly"], + "path"=>["query getCheese", "cheese", "silly"], } assert_includes(errors, query_root_error) input_obj_record = { "message"=>"InputObject 'DairyProductInput' doesn't accept argument 'wacky'", "locations"=>[{"line"=>5, "column"=>30}], - "fields"=>["query getCheese", "searchDairy", "product", "wacky"], + "path"=>["query getCheese", "searchDairy", "product", "wacky"], } assert_includes(errors, input_obj_record) fragment_error = { "message"=>"Field 'similarCheese' doesn't accept argument 'nonsense'", "locations"=>[{"line"=>9, "column"=>36}], - "fields"=>["fragment cheeseFields", "similarCheese", "nonsense"], + "path"=>["fragment cheeseFields", "similarCheese", "nonsense"], } assert_includes(errors, fragment_error) directive_error = { "message"=>"Directive 'skip' doesn't accept argument 'something'", "locations"=>[{"line"=>10, "column"=>16}], - "fields"=>["fragment cheeseFields", "id", "something"], + "path"=>["fragment cheeseFields", "id", "something"], } assert_includes(errors, directive_error) end @@ -62,7 +62,7 @@ assert_includes(errors, { "message"=>"Field '__type' doesn't accept argument 'somethingInvalid'", "locations"=>[{"line"=>3, "column"=>16}], - "fields"=>["query", "__type", "somethingInvalid"], + "path"=>["query", "__type", "somethingInvalid"], }) end end diff --git a/spec/graphql/static_validation/rules/directives_are_defined_spec.rb b/spec/graphql/static_validation/rules/directives_are_defined_spec.rb index 79f6178a43..ac60c1767b 100644 --- a/spec/graphql/static_validation/rules/directives_are_defined_spec.rb +++ b/spec/graphql/static_validation/rules/directives_are_defined_spec.rb @@ -20,11 +20,11 @@ { "message"=>"Directive @nonsense is not defined", "locations"=>[{"line"=>5, "column"=>16}], - "fields"=>["query getCheese", "okCheese", "source"], + "path"=>["query getCheese", "okCheese", "source"], }, { "message"=>"Directive @moreNonsense is not defined", "locations"=>[{"line"=>7, "column"=>18}], - "fields"=>["query getCheese", "okCheese", "... on Cheese", "flavor"], + "path"=>["query getCheese", "okCheese", "... on Cheese", "flavor"], } ] assert_equal(expected, errors) diff --git a/spec/graphql/static_validation/rules/directives_are_in_valid_locations_spec.rb b/spec/graphql/static_validation/rules/directives_are_in_valid_locations_spec.rb index 076627a347..c5c60f85e9 100644 --- a/spec/graphql/static_validation/rules/directives_are_in_valid_locations_spec.rb +++ b/spec/graphql/static_validation/rules/directives_are_in_valid_locations_spec.rb @@ -26,12 +26,12 @@ { "message"=> "'@skip' can't be applied to queries (allowed: fields, fragment spreads, inline fragments)", "locations"=>[{"line"=>2, "column"=>21}], - "fields"=>["query getCheese"], + "path"=>["query getCheese"], }, { "message"=>"'@skip' can't be applied to fragment definitions (allowed: fields, fragment spreads, inline fragments)", "locations"=>[{"line"=>13, "column"=>33}], - "fields"=>["fragment whatever"], + "path"=>["fragment whatever"], }, ] assert_equal(expected, errors) diff --git a/spec/graphql/static_validation/rules/fields_are_defined_on_type_spec.rb b/spec/graphql/static_validation/rules/fields_are_defined_on_type_spec.rb index 4fb4360ed8..4fabc379a1 100644 --- a/spec/graphql/static_validation/rules/fields_are_defined_on_type_spec.rb +++ b/spec/graphql/static_validation/rules/fields_are_defined_on_type_spec.rb @@ -31,7 +31,7 @@ { "message"=>"Field 'notDefinedField' doesn't exist on type 'Query'", "locations"=>[{"line"=>1, "column"=>18}], - "fields"=>["query getStuff", "notDefinedField"], + "path"=>["query getStuff", "notDefinedField"], } ] assert_equal(expected_errors, errors) @@ -46,7 +46,7 @@ { "message"=>"Field 'amountThatILikeIt' doesn't exist on type 'Edible'", "locations"=>[{"line"=>1, "column"=>35}], - "fields"=>["query getStuff", "favoriteEdible", "amountThatILikeIt"], + "path"=>["query getStuff", "favoriteEdible", "amountThatILikeIt"], } ] assert_equal(expected_errors, errors) @@ -67,7 +67,7 @@ "locations"=>[ {"line"=>3, "column"=>7} ], - "fields"=>["fragment dpFields", "source"], + "path"=>["fragment dpFields", "source"], } ] assert_equal(expected_errors, errors) @@ -120,7 +120,7 @@ "locations"=>[ {"line"=>2, "column"=>33} ], - "fields"=>["query", "cheese", "__schema"], + "path"=>["query", "cheese", "__schema"], } ] assert_equal(expected_errors, errors) @@ -151,7 +151,7 @@ "locations"=>[ {"line"=>2, "column"=>33} ], - "fields"=>["query", "cheese", "__type"], + "path"=>["query", "cheese", "__type"], } ] assert_equal(expected_errors, errors) diff --git a/spec/graphql/static_validation/rules/fields_have_appropriate_selections_spec.rb b/spec/graphql/static_validation/rules/fields_have_appropriate_selections_spec.rb index b718a233c5..fc1e764a47 100644 --- a/spec/graphql/static_validation/rules/fields_have_appropriate_selections_spec.rb +++ b/spec/graphql/static_validation/rules/fields_have_appropriate_selections_spec.rb @@ -19,28 +19,28 @@ illegal_selection_error = { "message"=>"Selections can't be made on scalars (field 'id' returns Int but has selections [something, someFields])", "locations"=>[{"line"=>6, "column"=>47}], - "fields"=>["query getCheese", "illegalSelectionCheese", "id"], + "path"=>["query getCheese", "illegalSelectionCheese", "id"], } assert_includes(errors, illegal_selection_error, "finds illegal selections on scalars") objects_selection_required_error = { "message"=>"Field must have selections (field 'cheese' returns Cheese but has no selections. Did you mean 'cheese { ... }'?)", "locations"=>[{"line"=>4, "column"=>7}], - "fields"=>["query getCheese", "missingFieldsObject"], + "path"=>["query getCheese", "missingFieldsObject"], } assert_includes(errors, objects_selection_required_error, "finds objects without selections") interfaces_selection_required_error = { "message"=>"Field must have selections (field 'selfAsEdible' returns Edible but has no selections. Did you mean 'selfAsEdible { ... }'?)", "locations"=>[{"line"=>5, "column"=>47}], - "fields"=>["query getCheese", "missingFieldsInterface", "selfAsEdible"], + "path"=>["query getCheese", "missingFieldsInterface", "selfAsEdible"], } assert_includes(errors, interfaces_selection_required_error, "finds interfaces without selections") incorrect_fragment_error = { "message"=>"Selections can't be made on scalars (field 'flavor' returns String but has inline fragments [String])", "locations"=>[{"line"=>7, "column"=>48}], - "fields"=>["query getCheese", "incorrectFragmentSpread", "flavor"], + "path"=>["query getCheese", "incorrectFragmentSpread", "flavor"], } assert_includes(errors, incorrect_fragment_error, "finds scalar fields with selections") end @@ -53,7 +53,7 @@ selections_required_error = { "message"=> "Field must have selections (anonymous query returns Query but has no selections. Did you mean ' { ... }'?)", "locations"=>[{"line"=>1, "column"=>1}], - "fields"=>["query"] + "path"=>["query"] } assert_includes(errors, selections_required_error) end diff --git a/spec/graphql/static_validation/rules/fields_will_merge_spec.rb b/spec/graphql/static_validation/rules/fields_will_merge_spec.rb index ab777c9c69..cf8aeb12b3 100644 --- a/spec/graphql/static_validation/rules/fields_will_merge_spec.rb +++ b/spec/graphql/static_validation/rules/fields_will_merge_spec.rb @@ -381,7 +381,7 @@ {"line"=>4, "column"=>11}, {"line"=>8, "column"=>11} ], - "fields"=>[] + "path"=>[] } ] assert_equal expected_errors, errors diff --git a/spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb b/spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb index 331d0b13a1..68790a0b05 100644 --- a/spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb +++ b/spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb @@ -20,7 +20,7 @@ fragment_def_error = { "message"=>"Fragment name \"frag1\" must be unique", "locations"=>[{"line"=>8, "column"=>5}, {"line"=>9, "column"=>5}], - "fields"=>[], + "path"=>[], } assert_includes(errors, fragment_def_error) end diff --git a/spec/graphql/static_validation/rules/fragment_spreads_are_possible_spec.rb b/spec/graphql/static_validation/rules/fragment_spreads_are_possible_spec.rb index 1b964b35a7..d7a610eb56 100644 --- a/spec/graphql/static_validation/rules/fragment_spreads_are_possible_spec.rb +++ b/spec/graphql/static_validation/rules/fragment_spreads_are_possible_spec.rb @@ -31,17 +31,17 @@ { "message"=>"Fragment on Milk can't be spread inside Cheese", "locations"=>[{"line"=>6, "column"=>9}], - "fields"=>["query getCheese", "cheese", "... on Milk"], + "path"=>["query getCheese", "cheese", "... on Milk"], }, { "message"=>"Fragment milkFields on Milk can't be spread inside Cheese", "locations"=>[{"line"=>4, "column"=>9}], - "fields"=>["query getCheese", "cheese", "... milkFields"], + "path"=>["query getCheese", "cheese", "... milkFields"], }, { "message"=>"Fragment milkFields on Milk can't be spread inside Cheese", "locations"=>[{"line"=>18, "column"=>7}], - "fields"=>["fragment cheeseFields", "... milkFields"], + "path"=>["fragment cheeseFields", "... milkFields"], } ] assert_equal(expected, errors) diff --git a/spec/graphql/static_validation/rules/fragment_types_exist_spec.rb b/spec/graphql/static_validation/rules/fragment_types_exist_spec.rb index 029dbc8214..0781afce90 100644 --- a/spec/graphql/static_validation/rules/fragment_types_exist_spec.rb +++ b/spec/graphql/static_validation/rules/fragment_types_exist_spec.rb @@ -27,13 +27,13 @@ inline_fragment_error = { "message"=>"No such type Something, so it can't be a fragment condition", "locations"=>[{"line"=>11, "column"=>5}], - "fields"=>["fragment somethingFields"], + "path"=>["fragment somethingFields"], } assert_includes(errors, inline_fragment_error, "on inline fragments") fragment_def_error = { "message"=>"No such type Nothing, so it can't be a fragment condition", "locations"=>[{"line"=>5, "column"=>9}], - "fields"=>["query getCheese", "cheese", "... on Nothing"], + "path"=>["query getCheese", "cheese", "... on Nothing"], } assert_includes(errors, fragment_def_error, "on fragment definitions") end diff --git a/spec/graphql/static_validation/rules/fragments_are_finite_spec.rb b/spec/graphql/static_validation/rules/fragments_are_finite_spec.rb index 4a72dc9650..795c813fca 100644 --- a/spec/graphql/static_validation/rules/fragments_are_finite_spec.rb +++ b/spec/graphql/static_validation/rules/fragments_are_finite_spec.rb @@ -38,12 +38,12 @@ { "message"=>"Fragment sourceField contains an infinite loop", "locations"=>[{"line"=>12, "column"=>5}], - "fields"=>["fragment sourceField"], + "path"=>["fragment sourceField"], }, { "message"=>"Fragment flavorField contains an infinite loop", "locations"=>[{"line"=>17, "column"=>5}], - "fields"=>["fragment flavorField"], + "path"=>["fragment flavorField"], } ] assert_equal(expected, errors) diff --git a/spec/graphql/static_validation/rules/fragments_are_named_spec.rb b/spec/graphql/static_validation/rules/fragments_are_named_spec.rb index e86b09f156..0cb42ca6c1 100644 --- a/spec/graphql/static_validation/rules/fragments_are_named_spec.rb +++ b/spec/graphql/static_validation/rules/fragments_are_named_spec.rb @@ -16,7 +16,7 @@ fragment_def_error = { "message"=>"Fragment definition has no name", "locations"=>[{"line"=>2, "column"=>5}], - "fields"=>["fragment "], + "path"=>["fragment "], } assert_includes(errors, fragment_def_error, "on fragment definitions") end diff --git a/spec/graphql/static_validation/rules/fragments_are_on_composite_types_spec.rb b/spec/graphql/static_validation/rules/fragments_are_on_composite_types_spec.rb index 33f428f3c2..41c41f7b2a 100644 --- a/spec/graphql/static_validation/rules/fragments_are_on_composite_types_spec.rb +++ b/spec/graphql/static_validation/rules/fragments_are_on_composite_types_spec.rb @@ -35,17 +35,17 @@ { "message"=>"Invalid fragment on type Boolean (must be Union, Interface or Object)", "locations"=>[{"line"=>6, "column"=>11}], - "fields"=>["query getCheese", "cheese", "... on Cheese", "... on Boolean"], + "path"=>["query getCheese", "cheese", "... on Cheese", "... on Boolean"], }, { "message"=>"Invalid fragment on type DairyProductInput (must be Union, Interface or Object)", "locations"=>[{"line"=>16, "column"=>9}], - "fields"=>["query getCheese", "cheese", "... on DairyProductInput"], + "path"=>["query getCheese", "cheese", "... on DairyProductInput"], }, { "message"=>"Invalid fragment on type Int (must be Union, Interface or Object)", "locations"=>[{"line"=>22, "column"=>5}], - "fields"=>["fragment intFields"], + "path"=>["fragment intFields"], }, ] assert_equal(expected, errors) diff --git a/spec/graphql/static_validation/rules/fragments_are_used_spec.rb b/spec/graphql/static_validation/rules/fragments_are_used_spec.rb index de212e48b6..da4e9958bc 100644 --- a/spec/graphql/static_validation/rules/fragments_are_used_spec.rb +++ b/spec/graphql/static_validation/rules/fragments_are_used_spec.rb @@ -17,7 +17,7 @@ assert_includes(errors, { "message"=>"Fragment unusedFields was defined, but not used", "locations"=>[{"line"=>8, "column"=>5}], - "fields"=>["fragment unusedFields"], + "path"=>["fragment unusedFields"], }) end @@ -25,7 +25,7 @@ assert_includes(errors, { "message"=>"Fragment undefinedFields was used, but not defined", "locations"=>[{"line"=>5, "column"=>7}], - "fields"=>["query getCheese", "... undefinedFields"] + "path"=>["query getCheese", "... undefinedFields"] }) end diff --git a/spec/graphql/static_validation/rules/mutation_root_exists_spec.rb b/spec/graphql/static_validation/rules/mutation_root_exists_spec.rb index 367518ceb2..b0c4c0df89 100644 --- a/spec/graphql/static_validation/rules/mutation_root_exists_spec.rb +++ b/spec/graphql/static_validation/rules/mutation_root_exists_spec.rb @@ -31,7 +31,7 @@ missing_mutation_root_error = { "message"=>"Schema is not configured for mutations", "locations"=>[{"line"=>2, "column"=>5}], - "fields"=>["mutation addBagel"], + "path"=>["mutation addBagel"], } assert_includes(errors, missing_mutation_root_error) end diff --git a/spec/graphql/static_validation/rules/operation_names_are_valid_spec.rb b/spec/graphql/static_validation/rules/operation_names_are_valid_spec.rb index 62c0ab7790..68dae40958 100644 --- a/spec/graphql/static_validation/rules/operation_names_are_valid_spec.rb +++ b/spec/graphql/static_validation/rules/operation_names_are_valid_spec.rb @@ -25,7 +25,7 @@ requires_name_error = { "message"=>"Operation name is required when multiple operations are present", "locations"=>[{"line"=>5, "column"=>5}, {"line"=>9, "column"=>5}], - "fields"=>[], + "path"=>[], } assert_includes(errors, requires_name_error) end @@ -48,7 +48,7 @@ requires_name_error = { "message"=>"Operation name is required when multiple operations are present", "locations"=>[{"line"=>1, "column"=>5}, {"line"=>5, "column"=>5}], - "fields"=>[], + "path"=>[], } assert_includes(errors, requires_name_error) end @@ -71,7 +71,7 @@ name_uniqueness_error = { "message"=>'Operation name "getCheese" must be unique', "locations"=>[{"line"=>1, "column"=>5}, {"line"=>5, "column"=>5}], - "fields"=>[], + "path"=>[], } assert_includes(errors, name_uniqueness_error) end diff --git a/spec/graphql/static_validation/rules/required_arguments_are_present_spec.rb b/spec/graphql/static_validation/rules/required_arguments_are_present_spec.rb index 9efadd51ca..188f3e2e4d 100644 --- a/spec/graphql/static_validation/rules/required_arguments_are_present_spec.rb +++ b/spec/graphql/static_validation/rules/required_arguments_are_present_spec.rb @@ -22,21 +22,21 @@ query_root_error = { "message"=>"Field 'cheese' is missing required arguments: id", "locations"=>[{"line"=>4, "column"=>7}], - "fields"=>["query getCheese", "cheese"], + "path"=>["query getCheese", "cheese"], } assert_includes(errors, query_root_error) fragment_error = { "message"=>"Field 'similarCheese' is missing required arguments: source", "locations"=>[{"line"=>8, "column"=>7}], - "fields"=>["fragment cheeseFields", "similarCheese"], + "path"=>["fragment cheeseFields", "similarCheese"], } assert_includes(errors, fragment_error) directive_error = { "message"=>"Directive 'skip' is missing required arguments: if", "locations"=>[{"line"=>10, "column"=>10}], - "fields"=>["fragment cheeseFields", "id"], + "path"=>["fragment cheeseFields", "id"], } assert_includes(errors, directive_error) end @@ -55,7 +55,7 @@ "locations"=>[ {"line"=>3, "column"=>9} ], - "fields"=>["query", "__type"], + "path"=>["query", "__type"], } ] assert_equal(expected_errors, errors) diff --git a/spec/graphql/static_validation/rules/subscription_root_exists_spec.rb b/spec/graphql/static_validation/rules/subscription_root_exists_spec.rb index 5f160c40a4..2bcfa9f66e 100644 --- a/spec/graphql/static_validation/rules/subscription_root_exists_spec.rb +++ b/spec/graphql/static_validation/rules/subscription_root_exists_spec.rb @@ -26,7 +26,7 @@ missing_subscription_root_error = { "message"=>"Schema is not configured for subscriptions", "locations"=>[{"line"=>2, "column"=>5}], - "fields"=>["subscription"], + "path"=>["subscription"], } assert_includes(errors, missing_subscription_root_error) end diff --git a/spec/graphql/static_validation/rules/unique_directives_per_location_spec.rb b/spec/graphql/static_validation/rules/unique_directives_per_location_spec.rb index e4baddece7..b117789b3c 100644 --- a/spec/graphql/static_validation/rules/unique_directives_per_location_spec.rb +++ b/spec/graphql/static_validation/rules/unique_directives_per_location_spec.rb @@ -101,7 +101,7 @@ assert_includes errors, { "message" => 'The directive "A" can only be used once at this location.', "locations" => [{ "line" => 4, "column" => 17 }, { "line" => 4, "column" => 20 }], - "fields" => ["query", "type", "field"], + "path" => ["query", "type", "field"], } end end @@ -120,13 +120,13 @@ assert_includes errors, { "message" => 'The directive "A" can only be used once at this location.', "locations" => [{ "line" => 4, "column" => 17 }, { "line" => 4, "column" => 20 }], - "fields" => ["query", "type", "field"], + "path" => ["query", "type", "field"], } assert_includes errors, { "message" => 'The directive "A" can only be used once at this location.', "locations" => [{ "line" => 4, "column" => 17 }, { "line" => 4, "column" => 23 }], - "fields" => ["query", "type", "field"], + "path" => ["query", "type", "field"], } end end @@ -144,13 +144,13 @@ assert_includes errors, { "message" => 'The directive "A" can only be used once at this location.', "locations" => [{ "line" => 4, "column" => 17 }, { "line" => 4, "column" => 23 }], - "fields" => ["query", "type", "field"], + "path" => ["query", "type", "field"], } assert_includes errors, { "message" => 'The directive "B" can only be used once at this location.', "locations" => [{ "line" => 4, "column" => 20 }, { "line" => 4, "column" => 26 }], - "fields" => ["query", "type", "field"], + "path" => ["query", "type", "field"], } end end @@ -168,13 +168,13 @@ assert_includes errors, { "message" => 'The directive "A" can only be used once at this location.', "locations" => [{ "line" => 3, "column" => 14 }, { "line" => 3, "column" => 17 }], - "fields" => ["query", "type"], + "path" => ["query", "type"], } assert_includes errors, { "message" => 'The directive "A" can only be used once at this location.', "locations" => [{ "line" => 4, "column" => 17 }, { "line" => 4, "column" => 20 }], - "fields" => ["query", "type", "field"], + "path" => ["query", "type", "field"], } end end diff --git a/spec/graphql/static_validation/rules/variable_default_values_are_correctly_typed_spec.rb b/spec/graphql/static_validation/rules/variable_default_values_are_correctly_typed_spec.rb index c70b72a85a..9c2b40b28a 100644 --- a/spec/graphql/static_validation/rules/variable_default_values_are_correctly_typed_spec.rb +++ b/spec/graphql/static_validation/rules/variable_default_values_are_correctly_typed_spec.rb @@ -29,17 +29,17 @@ { "message"=>"Default value for $badInt doesn't match type Int", "locations"=>[{"line"=>6, "column"=>7}], - "fields"=>["query getCheese"], + "path"=>["query getCheese"], }, { "message"=>"Default value for $badInput doesn't match type DairyProductInput", "locations"=>[{"line"=>8, "column"=>7}], - "fields"=>["query getCheese"], + "path"=>["query getCheese"], }, { "message"=>"Non-null variable $nonNull can't have a default value", "locations"=>[{"line"=>9, "column"=>7}], - "fields"=>["query getCheese"], + "path"=>["query getCheese"], } ] assert_equal(expected, errors) @@ -116,17 +116,17 @@ { "message"=>"Non-null variable $a can't have a default value", "locations"=>[{"line"=>3, "column"=>11}], - "fields"=>["query getCheese"] + "path"=>["query getCheese"] }, { "message"=>"Non-null variable $b can't have a default value", "locations"=>[{"line"=>4, "column"=>11}], - "fields"=>["query getCheese"] + "path"=>["query getCheese"] }, { "message"=>"Default value for $c doesn't match type ComplexInput", "locations"=>[{"line"=>5, "column"=>11}], - "fields"=>["query getCheese"] + "path"=>["query getCheese"] } ] @@ -182,7 +182,7 @@ assert_includes errors, { "message"=> "cannot coerce to Float", "locations"=>[{"line"=>3, "column"=>9}], - "fields"=>["query"] + "path"=>["query"] } end end diff --git a/spec/graphql/static_validation/rules/variable_usages_are_allowed_spec.rb b/spec/graphql/static_validation/rules/variable_usages_are_allowed_spec.rb index e357275dee..6b4c2793cf 100644 --- a/spec/graphql/static_validation/rules/variable_usages_are_allowed_spec.rb +++ b/spec/graphql/static_validation/rules/variable_usages_are_allowed_spec.rb @@ -43,22 +43,22 @@ { "message"=>"Nullability mismatch on variable $badInt and argument id (Int / Int!)", "locations"=>[{"line"=>14, "column"=>28}], - "fields"=>["query getCheese", "badCheese", "id"], + "path"=>["query getCheese", "badCheese", "id"], }, { "message"=>"Type mismatch on variable $badStr and argument id (String! / Int!)", "locations"=>[{"line"=>15, "column"=>28}], - "fields"=>["query getCheese", "badStrCheese", "id"], + "path"=>["query getCheese", "badStrCheese", "id"], }, { "message"=>"Nullability mismatch on variable $badAnimals and argument source ([DairyAnimal]! / [DairyAnimal!]!)", "locations"=>[{"line"=>18, "column"=>30}], - "fields"=>["query getCheese", "cheese", "other", "source"], + "path"=>["query getCheese", "cheese", "other", "source"], }, { "message"=>"List dimension mismatch on variable $deepAnimals and argument source ([[DairyAnimal!]!]! / [DairyAnimal!]!)", "locations"=>[{"line"=>19, "column"=>32}], - "fields"=>["query getCheese", "cheese", "tooDeep", "source"], + "path"=>["query getCheese", "cheese", "tooDeep", "source"], } ] assert_equal(expected, errors) diff --git a/spec/graphql/static_validation/rules/variables_are_input_types_spec.rb b/spec/graphql/static_validation/rules/variables_are_input_types_spec.rb index a084910435..6a471499a2 100644 --- a/spec/graphql/static_validation/rules/variables_are_input_types_spec.rb +++ b/spec/graphql/static_validation/rules/variables_are_input_types_spec.rb @@ -22,25 +22,25 @@ assert_includes(errors, { "message"=>"AnimalProduct isn't a valid input type (on $interface)", "locations"=>[{"line"=>5, "column"=>7}], - "fields"=>["query getCheese"], + "path"=>["query getCheese"], }) assert_includes(errors, { "message"=>"Milk isn't a valid input type (on $object)", "locations"=>[{"line"=>6, "column"=>7}], - "fields"=>["query getCheese"], + "path"=>["query getCheese"], }) assert_includes(errors, { "message"=>"Cheese isn't a valid input type (on $objects)", "locations"=>[{"line"=>7, "column"=>7}], - "fields"=>["query getCheese"], + "path"=>["query getCheese"], }) assert_includes(errors, { "message"=>"Nonsense isn't a defined input type (on $unknownType)", "locations"=>[{"line"=>8, "column"=>7}], - "fields"=>["query getCheese"], + "path"=>["query getCheese"], }) end diff --git a/spec/graphql/static_validation/rules/variables_are_used_and_defined_spec.rb b/spec/graphql/static_validation/rules/variables_are_used_and_defined_spec.rb index 9f63f4082d..4514258b27 100644 --- a/spec/graphql/static_validation/rules/variables_are_used_and_defined_spec.rb +++ b/spec/graphql/static_validation/rules/variables_are_used_and_defined_spec.rb @@ -42,17 +42,17 @@ { "message"=>"Variable $notUsedVar is declared by getCheese but not used", "locations"=>[{"line"=>2, "column"=>5}], - "fields"=>["query getCheese"], + "path"=>["query getCheese"], }, { "message"=>"Variable $undefinedVar is used by getCheese but not declared", "locations"=>[{"line"=>19, "column"=>22}], - "fields"=>["query getCheese", "c3", "id"], + "path"=>["query getCheese", "c3", "id"], }, { "message"=>"Variable $undefinedFragmentVar is used by innerCheeseFields but not declared", "locations"=>[{"line"=>29, "column"=>22}], - "fields"=>["fragment innerCheeseFields", "c4", "id"], + "path"=>["fragment innerCheeseFields", "c4", "id"], }, ] diff --git a/spec/graphql/static_validation/validator_spec.rb b/spec/graphql/static_validation/validator_spec.rb index 8a41dc61f6..97a6ecfdf1 100644 --- a/spec/graphql/static_validation/validator_spec.rb +++ b/spec/graphql/static_validation/validator_spec.rb @@ -34,7 +34,7 @@ expected_errors = [{ "message" => "Variable $undefinedVar is used by but not declared", "locations" => [{"line" => 1, "column" => 14, "filename" => "not_a_real.graphql"}], - "fields" => ["query", "cheese", "id"] + "path" => ["query", "cheese", "id"] }] assert_equal expected_errors, errors end @@ -115,7 +115,7 @@ { "message"=>"Fragment cheeseFields contains an infinite loop", "locations"=>[{"line"=>10, "column"=>9}], - "fields"=>["fragment cheeseFields"] + "path"=>["fragment cheeseFields"] } ] assert_equal(expected, errors) From f495e91ef1a507aa8427112673fba10fe99fc632 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 22 Nov 2018 09:06:34 +0000 Subject: [PATCH 2/7] All the changes to populate and emit extensions details This commit standalone will fail CI/tests. They are to be fixed up in the next commit for ease of review. --- lib/graphql/static_validation/base_visitor.rb | 5 ++--- lib/graphql/static_validation/message.rb | 10 +++++----- .../rules/argument_literals_are_compatible.rb | 12 +++++++++++- .../rules/argument_names_are_unique.rb | 5 ++++- .../rules/arguments_are_defined.rb | 7 ++++++- .../rules/directives_are_defined.rb | 5 ++++- .../directives_are_in_valid_locations.rb | 11 +++++++++-- .../rules/fields_are_defined_on_type.rb | 6 +++++- .../fields_have_appropriate_selections.rb | 9 ++++++++- .../rules/fragment_names_are_unique.rb | 5 ++++- .../rules/fragment_spreads_are_possible.rb | 7 ++++++- .../rules/fragment_types_exist.rb | 5 ++++- .../rules/fragments_are_named.rb | 4 +++- .../rules/fragments_are_on_composite_types.rb | 5 ++++- .../rules/fragments_are_used.rb | 10 ++++++++-- .../rules/mutation_root_exists.rb | 4 +++- .../rules/no_definitions_are_present.rb | 4 +++- .../rules/operation_names_are_valid.rb | 9 +++++++-- .../rules/required_arguments_are_present.rb | 7 ++++++- .../rules/subscription_root_exists.rb | 4 +++- .../rules/unique_directives_per_location.rb | 6 +++++- ...able_default_values_are_correctly_typed.rb | 19 +++++++++++++------ .../rules/variable_names_are_unique.rb | 5 ++++- .../rules/variable_usages_are_allowed.rb | 8 +++++++- .../rules/variables_are_input_types.rb | 12 ++++++++++-- .../rules/variables_are_used_and_defined.rb | 12 ++++++++++-- 26 files changed, 154 insertions(+), 42 deletions(-) diff --git a/lib/graphql/static_validation/base_visitor.rb b/lib/graphql/static_validation/base_visitor.rb index f53942f33f..22df5a5923 100644 --- a/lib/graphql/static_validation/base_visitor.rb +++ b/lib/graphql/static_validation/base_visitor.rb @@ -173,11 +173,10 @@ def on_fragment_with_type(node) private # Error `message` is located at `node` - def add_error(message, nodes, path: nil) - # Add an optional hash here that message adds onto the response object - then easy to vary for all items + def add_error(message, nodes, path: nil, extensions: {}) path ||= @path.dup nodes = Array(nodes) - m = GraphQL::StaticValidation::Message.new(message, nodes: nodes, path: path) + m = GraphQL::StaticValidation::Message.new(message, nodes: nodes, path: path, extensions: extensions) context.errors << m end end diff --git a/lib/graphql/static_validation/message.rb b/lib/graphql/static_validation/message.rb index 3e7842cc33..383ca43925 100644 --- a/lib/graphql/static_validation/message.rb +++ b/lib/graphql/static_validation/message.rb @@ -6,20 +6,20 @@ class Message # Convenience for validators module MessageHelper # Error `message` is located at `node` - def message(message, nodes, context: nil, path: nil) - # TODO: also add object hash of extras as in base_visitor + def message(message, nodes, context: nil, path: nil, extensions: {}) path ||= context.path nodes = Array(nodes) - GraphQL::StaticValidation::Message.new(message, nodes: nodes, path: path) + GraphQL::StaticValidation::Message.new(message, nodes: nodes, path: path, extensions: extensions) end end attr_reader :message, :path - def initialize(message, path: [], nodes: []) + def initialize(message, path: [], nodes: [], extensions: {}) @message = message @nodes = nodes @path = path + @extensions = extensions end # A hash representation of this Message @@ -28,7 +28,7 @@ def to_h "message" => message, "locations" => locations, "path" => path, - } + }.tap { |hash| hash["extensions"] = @extensions unless @extensions.empty? } end private diff --git a/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb b/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb index 476d3dcce2..4c49fefc3d 100644 --- a/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb +++ b/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb @@ -32,6 +32,10 @@ def on_argument(node, parent) valid = context.valid_literal?(node.value, arg_defn.type) rescue GraphQL::CoercionError => err error_message = err.message + extensions = { + "rule": "StaticValidation::ArgumentLiteralsAreCompatible", + "type": "CoercionError" + } end if !valid @@ -41,7 +45,13 @@ def on_argument(node, parent) "Argument '#{node.name}' on #{kind_of_node} '#{error_arg_name}' has an invalid value. Expected type '#{arg_defn.type}'." end - add_error(error_message, parent) + extensions ||= { + "rule": "StaticValidation::ArgumentLiteralsAreCompatible", + "argument": node.name, + "type": node_type(parent) + } + + add_error(error_message, parent, extensions: extensions) end end end diff --git a/lib/graphql/static_validation/rules/argument_names_are_unique.rb b/lib/graphql/static_validation/rules/argument_names_are_unique.rb index cb77e4f60c..7fa39e9e62 100644 --- a/lib/graphql/static_validation/rules/argument_names_are_unique.rb +++ b/lib/graphql/static_validation/rules/argument_names_are_unique.rb @@ -21,7 +21,10 @@ def validate_arguments(node) argument_defns.each { |a| args_by_name[a.name] << a } args_by_name.each do |name, defns| if defns.size > 1 - add_error("There can be only one argument named \"#{name}\"", defns) + add_error("There can be only one argument named \"#{name}\"", defns, extensions: { + "rule": "StaticValidation::ArgumentNamesAreUnique", + "name": name + }) end end end diff --git a/lib/graphql/static_validation/rules/arguments_are_defined.rb b/lib/graphql/static_validation/rules/arguments_are_defined.rb index 6f99ea4dd0..c71869ab7c 100644 --- a/lib/graphql/static_validation/rules/arguments_are_defined.rb +++ b/lib/graphql/static_validation/rules/arguments_are_defined.rb @@ -29,7 +29,12 @@ def on_argument(node, parent) elsif parent_defn kind_of_node = node_type(parent) error_arg_name = parent_name(parent, parent_defn) - add_error("#{kind_of_node} '#{error_arg_name}' doesn't accept argument '#{node.name}'", node) + add_error("#{kind_of_node} '#{error_arg_name}' doesn't accept argument '#{node.name}'", node, extensions: { + "rule": "StaticValidation::ArgumentsAreDefined", + "type": kind_of_node, + "name": error_arg_name, + "argument": node.name + }) else # Some other weird error super diff --git a/lib/graphql/static_validation/rules/directives_are_defined.rb b/lib/graphql/static_validation/rules/directives_are_defined.rb index e2f14347fb..7a2af933e6 100644 --- a/lib/graphql/static_validation/rules/directives_are_defined.rb +++ b/lib/graphql/static_validation/rules/directives_are_defined.rb @@ -9,7 +9,10 @@ def initialize(*) def on_directive(node, parent) if !@directive_names.include?(node.name) - add_error("Directive @#{node.name} is not defined", node) + add_error("Directive @#{node.name} is not defined", node, extensions: { + "rule": "StaticValidation::DirectivesAreDefined", + "directive": node.name + }) else super end diff --git a/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb b/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb index 5a52d03593..f8bc9a9b0b 100644 --- a/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb +++ b/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb @@ -40,7 +40,10 @@ def validate_location(ast_directive, ast_parent, directives) required_location = SIMPLE_LOCATIONS[ast_parent.class] assert_includes_location(directive_defn, ast_directive, required_location) else - add_error("Directives can't be applied to #{ast_parent.class.name}s", ast_directive) + add_error("Directives can't be applied to #{ast_parent.class.name}s", ast_directive, extensions: { + "rule": "StaticValidation::DirectivesAreInValidLocations", + "target": ast_parent.class.name + }) end end @@ -48,7 +51,11 @@ def assert_includes_location(directive_defn, directive_ast, required_location) if !directive_defn.locations.include?(required_location) location_name = LOCATION_MESSAGE_NAMES[required_location] allowed_location_names = directive_defn.locations.map { |loc| LOCATION_MESSAGE_NAMES[loc] } - add_error("'@#{directive_defn.name}' can't be applied to #{location_name} (allowed: #{allowed_location_names.join(", ")})", directive_ast) + add_error("'@#{directive_defn.name}' can't be applied to #{location_name} (allowed: #{allowed_location_names.join(", ")})", directive_ast, extensions: { + "rule": "StaticValidation::DirectivesAreInValidLocations", + "name": directive_defn.name, + "target": location_name + }) end end end diff --git a/lib/graphql/static_validation/rules/fields_are_defined_on_type.rb b/lib/graphql/static_validation/rules/fields_are_defined_on_type.rb index d942de9558..b64cfb46e2 100644 --- a/lib/graphql/static_validation/rules/fields_are_defined_on_type.rb +++ b/lib/graphql/static_validation/rules/fields_are_defined_on_type.rb @@ -10,7 +10,11 @@ def on_field(node, parent) if parent_type.kind.union? add_error("Selections can't be made directly on unions (see selections on #{parent_type.name})", parent) else - add_error("Field '#{node.name}' doesn't exist on type '#{parent_type.name}'", node) + add_error("Field '#{node.name}' doesn't exist on type '#{parent_type.name}'", node, extensions: { + "rule": "StaticValidation::FieldsAreDefinedOnType", + "field": node.name, + "type": parent_type.name + }) end else super diff --git a/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb b/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb index 865fb6efa2..88b14cad59 100644 --- a/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb +++ b/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb @@ -50,7 +50,14 @@ def validate_field_selections(ast_node, resolved_type) else raise("Unexpected node #{ast_node}") end - add_error(msg % { node_name: node_name }, ast_node) + extensions = { + "rule": "StaticValidation::FieldsHaveAppropriateSelections", + "name": node_name + } + unless resolved_type.nil? + extensions["type"] = resolved_type + end + add_error(msg % { node_name: node_name }, ast_node, extensions: extensions) false else true diff --git a/lib/graphql/static_validation/rules/fragment_names_are_unique.rb b/lib/graphql/static_validation/rules/fragment_names_are_unique.rb index aa650ccfbe..8f4291dc34 100644 --- a/lib/graphql/static_validation/rules/fragment_names_are_unique.rb +++ b/lib/graphql/static_validation/rules/fragment_names_are_unique.rb @@ -17,7 +17,10 @@ def on_document(_n, _p) super @fragments_by_name.each do |name, fragments| if fragments.length > 1 - add_error(%|Fragment name "#{name}" must be unique|, fragments) + add_error(%|Fragment name "#{name}" must be unique|, fragments, extensions: { + "rule": "StaticValidation::FragmentNamesAreUnique", + "name": name + }) end end end diff --git a/lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb b/lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb index 57421d1a38..7e24ddf9ef 100644 --- a/lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb +++ b/lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb @@ -49,7 +49,12 @@ def validate_fragment_in_scope(parent_type, child_type, node, context, path) if child_types.none? { |c| parent_types.include?(c) } name = node.respond_to?(:name) ? " #{node.name}" : "" - add_error("Fragment#{name} on #{child_type.name} can't be spread inside #{parent_type.name}", node, path: path) + add_error("Fragment#{name} on #{child_type.name} can't be spread inside #{parent_type.name}", node, path: path, extensions: { + "rule": "StaticValidation::FragmentSpreadsArePossible", + "name": name, + "type": child_type.name, + "parent": parent_type.name + }) end end diff --git a/lib/graphql/static_validation/rules/fragment_types_exist.rb b/lib/graphql/static_validation/rules/fragment_types_exist.rb index f087fc6e0b..d067a43d96 100644 --- a/lib/graphql/static_validation/rules/fragment_types_exist.rb +++ b/lib/graphql/static_validation/rules/fragment_types_exist.rb @@ -23,7 +23,10 @@ def validate_type_exists(fragment_node) type_name = fragment_node.type.name type = context.warden.get_type(type_name) if type.nil? - add_error("No such type #{type_name}, so it can't be a fragment condition", fragment_node) + add_error("No such type #{type_name}, so it can't be a fragment condition", fragment_node, extensions: { + "rule": "StaticValidation::FragmentTypesExist", + "type": type_name + }) false else true diff --git a/lib/graphql/static_validation/rules/fragments_are_named.rb b/lib/graphql/static_validation/rules/fragments_are_named.rb index c460ad0adb..a812213040 100644 --- a/lib/graphql/static_validation/rules/fragments_are_named.rb +++ b/lib/graphql/static_validation/rules/fragments_are_named.rb @@ -4,7 +4,9 @@ module StaticValidation module FragmentsAreNamed def on_fragment_definition(node, _parent) if node.name.nil? - add_error("Fragment definition has no name", node) + add_error("Fragment definition has no name", node, extensions: { + "rule": "StaticValidation::FragmentsAreNamed" + }) end super end diff --git a/lib/graphql/static_validation/rules/fragments_are_on_composite_types.rb b/lib/graphql/static_validation/rules/fragments_are_on_composite_types.rb index ce92ca1beb..30ade4f64b 100644 --- a/lib/graphql/static_validation/rules/fragments_are_on_composite_types.rb +++ b/lib/graphql/static_validation/rules/fragments_are_on_composite_types.rb @@ -21,7 +21,10 @@ def validate_type_is_composite(node) type_name = node_type.to_query_string type_def = context.warden.get_type(type_name) if type_def.nil? || !type_def.kind.composite? - add_error("Invalid fragment on type #{type_name} (must be Union, Interface or Object)", node) + add_error("Invalid fragment on type #{type_name} (must be Union, Interface or Object)", node, extensions: { + "rule": "StaticValidation::FragmentsAreOnCompositeTypes", + "type": type_name + }) false else true diff --git a/lib/graphql/static_validation/rules/fragments_are_used.rb b/lib/graphql/static_validation/rules/fragments_are_used.rb index 0d76ef224a..889bd381e8 100644 --- a/lib/graphql/static_validation/rules/fragments_are_used.rb +++ b/lib/graphql/static_validation/rules/fragments_are_used.rb @@ -7,13 +7,19 @@ def on_document(node, parent) dependency_map = context.dependencies dependency_map.unmet_dependencies.each do |op_defn, spreads| spreads.each do |fragment_spread| - add_error("Fragment #{fragment_spread.name} was used, but not defined", fragment_spread.node, path: fragment_spread.path) + add_error("Fragment #{fragment_spread.name} was used, but not defined", fragment_spread.node, path: fragment_spread.path, extensions: { + "rule": "StaticValidation::FragmentsAreUsed", + "fragement": fragment_spread.name + }) end end dependency_map.unused_dependencies.each do |fragment| if !fragment.name.nil? - add_error("Fragment #{fragment.name} was defined, but not used", fragment.node, path: fragment.path) + add_error("Fragment #{fragment.name} was defined, but not used", fragment.node, path: fragment.path, extensions: { + "rule": "StaticValidation::FragmentsAreUsed", + "fragement": fragement.name + }) end end end diff --git a/lib/graphql/static_validation/rules/mutation_root_exists.rb b/lib/graphql/static_validation/rules/mutation_root_exists.rb index 8d65f95e0e..4c8d917954 100644 --- a/lib/graphql/static_validation/rules/mutation_root_exists.rb +++ b/lib/graphql/static_validation/rules/mutation_root_exists.rb @@ -4,7 +4,9 @@ module StaticValidation module MutationRootExists def on_operation_definition(node, _parent) if node.operation_type == 'mutation' && context.warden.root_type_for_operation("mutation").nil? - add_error('Schema is not configured for mutations', node) + add_error('Schema is not configured for mutations', node, extensions: { + "rule": "StaticValidation::MutationRootExists" + }) else super end diff --git a/lib/graphql/static_validation/rules/no_definitions_are_present.rb b/lib/graphql/static_validation/rules/no_definitions_are_present.rb index 5818fd7152..0964f06da5 100644 --- a/lib/graphql/static_validation/rules/no_definitions_are_present.rb +++ b/lib/graphql/static_validation/rules/no_definitions_are_present.rb @@ -33,7 +33,9 @@ def on_invalid_node(node, parent) def on_document(node, parent) super if @schema_definition_nodes.any? - add_error(%|Query cannot contain schema definitions|, @schema_definition_nodes) + add_error(%|Query cannot contain schema definitions|, @schema_definition_nodes, extensions: { + "rule": "StaticValidation::NoDefinitionsArePresent" + }) end end end diff --git a/lib/graphql/static_validation/rules/operation_names_are_valid.rb b/lib/graphql/static_validation/rules/operation_names_are_valid.rb index 9a7ad2226e..81658fac39 100644 --- a/lib/graphql/static_validation/rules/operation_names_are_valid.rb +++ b/lib/graphql/static_validation/rules/operation_names_are_valid.rb @@ -18,9 +18,14 @@ def on_document(node, parent) @operation_names.each do |name, nodes| if name.nil? && op_count > 1 - add_error(%|Operation name is required when multiple operations are present|, nodes) + add_error(%|Operation name is required when multiple operations are present|, nodes, extensions: { + "rule": "StaticValidation::OperationNamesAreValid" + }) elsif nodes.length > 1 - add_error(%|Operation name "#{name}" must be unique|, nodes) + add_error(%|Operation name "#{name}" must be unique|, nodes, extensions: { + "rule": "StaticValidation::OperationNamesAreValid", + "name": name + }) end end end diff --git a/lib/graphql/static_validation/rules/required_arguments_are_present.rb b/lib/graphql/static_validation/rules/required_arguments_are_present.rb index 3569dd910f..87ead12a38 100644 --- a/lib/graphql/static_validation/rules/required_arguments_are_present.rb +++ b/lib/graphql/static_validation/rules/required_arguments_are_present.rb @@ -23,7 +23,12 @@ def assert_required_args(ast_node, defn) missing_names = required_argument_names - present_argument_names if missing_names.any? - add_error("#{ast_node.class.name.split("::").last} '#{ast_node.name}' is missing required arguments: #{missing_names.join(", ")}", ast_node) + add_error("#{ast_node.class.name.split("::").last} '#{ast_node.name}' is missing required arguments: #{missing_names.join(", ")}", ast_node, extensions: { + "rule": "StaticValidation::RequiredArgumentsArePresent", + "class": ast_node.class.name.split("::").last, + "name": ast_node.name, + "arguments": "#{missing_names.join(", ")}", + }) end end end diff --git a/lib/graphql/static_validation/rules/subscription_root_exists.rb b/lib/graphql/static_validation/rules/subscription_root_exists.rb index 1143aa7ef1..9ae0d35dc3 100644 --- a/lib/graphql/static_validation/rules/subscription_root_exists.rb +++ b/lib/graphql/static_validation/rules/subscription_root_exists.rb @@ -4,7 +4,9 @@ module StaticValidation module SubscriptionRootExists def on_operation_definition(node, _parent) if node.operation_type == "subscription" && context.warden.root_type_for_operation("subscription").nil? - add_error('Schema is not configured for subscriptions', node) + add_error('Schema is not configured for subscriptions', node, extensions: { + "rule": "StaticValidation::SubscriptionRootExists" + }) else super end diff --git a/lib/graphql/static_validation/rules/unique_directives_per_location.rb b/lib/graphql/static_validation/rules/unique_directives_per_location.rb index ec8370cedc..2d25c207f2 100644 --- a/lib/graphql/static_validation/rules/unique_directives_per_location.rb +++ b/lib/graphql/static_validation/rules/unique_directives_per_location.rb @@ -37,7 +37,11 @@ def validate_directive_location(node) if used_directives[directive_name] add_error( "The directive \"#{directive_name}\" can only be used once at this location.", - [used_directives[directive_name], ast_directive] + [used_directives[directive_name], ast_directive], + extensions: { + "rule": "StaticValidation::UniqueDirectivesPerLocation", + "directive": directive_name + } ) else used_directives[directive_name] = ast_directive diff --git a/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb b/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb index b799e0d202..3d15f2a6a4 100644 --- a/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb +++ b/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb @@ -6,7 +6,10 @@ def on_variable_definition(node, parent) if !node.default_value.nil? value = node.default_value if node.type.is_a?(GraphQL::Language::Nodes::NonNullType) - add_error("Non-null variable $#{node.name} can't have a default value", node) + add_error("Non-null variable $#{node.name} can't have a default value", node, extensions: { + "rule": "StaticValidation::VariableDefaultValuesAreCorrectlyTyped", + "name": node.name + }) else type = context.schema.type_from_ast(node.type) if type.nil? @@ -20,14 +23,18 @@ def on_variable_definition(node, parent) if !valid error_message ||= "Default value for $#{node.name} doesn't match type #{type}" - add_error(error_message, node) + add_error(error_message, node, extensions: { + "rule": "StaticValidation::VariableDefaultValuesAreCorrectlyTyped", + "name": node.name, + "type": type + }) end - end - end + end + end end - + super end end - end + end end diff --git a/lib/graphql/static_validation/rules/variable_names_are_unique.rb b/lib/graphql/static_validation/rules/variable_names_are_unique.rb index c8117a00ec..876c7dffc3 100644 --- a/lib/graphql/static_validation/rules/variable_names_are_unique.rb +++ b/lib/graphql/static_validation/rules/variable_names_are_unique.rb @@ -9,7 +9,10 @@ def on_operation_definition(node, parent) var_defns.each { |v| vars_by_name[v.name] << v } vars_by_name.each do |name, defns| if defns.size > 1 - add_error("There can only be one variable named \"#{name}\"", defns) + add_error("There can only be one variable named \"#{name}\"", defns, extensions: { + "rule": "StaticValidation::VariableNamesAreUnique", + "name": name + }) end end end diff --git a/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb b/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb index 5ce3605560..1c57e52171 100644 --- a/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb +++ b/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb @@ -84,7 +84,13 @@ def validate_usage(arguments, arg_node, ast_var) end def create_error(error_message, var_type, ast_var, arg_defn, arg_node) - add_error("#{error_message} on variable $#{ast_var.name} and argument #{arg_node.name} (#{var_type.to_s} / #{arg_defn.type.to_s})", arg_node) + add_error("#{error_message} on variable $#{ast_var.name} and argument #{arg_node.name} (#{var_type.to_s} / #{arg_defn.type.to_s})", arg_node, extensions: { + "rule": "StaticValidation::VariableUsagesAreAllowed", + "variable": ast_var.name, + "type": var_type.to_s, + "argument": arg_node.name, + "error": error_message + }) end def wrap_var_type_with_depth_of_arg(var_type, arg_node) diff --git a/lib/graphql/static_validation/rules/variables_are_input_types.rb b/lib/graphql/static_validation/rules/variables_are_input_types.rb index 01f1a5be36..2f5d7d7a10 100644 --- a/lib/graphql/static_validation/rules/variables_are_input_types.rb +++ b/lib/graphql/static_validation/rules/variables_are_input_types.rb @@ -7,9 +7,17 @@ def on_variable_definition(node, parent) type = context.warden.get_type(type_name) if type.nil? - add_error("#{type_name} isn't a defined input type (on $#{node.name})", node) + add_error("#{type_name} isn't a defined input type (on $#{node.name})", node, extensions: { + "rule": "StaticValidation::VariablesAreInputTypes", + "name": node.name, + "type": type_name + }) elsif !type.kind.input? - add_error("#{type.name} isn't a valid input type (on $#{node.name})", node) + add_error("#{type.name} isn't a valid input type (on $#{node.name})", node, extensions: { + "rule": "StaticValidation::VariablesAreInputTypes", + "name": node.name, + "type": type.name + }) end super diff --git a/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb b/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb index 380748d09b..e32eeba0e1 100644 --- a/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb +++ b/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb @@ -125,12 +125,20 @@ def create_errors(node_variables) # Declared but not used: node_variables .select { |name, usage| usage.declared? && !usage.used? } - .each { |var_name, usage| add_error("Variable $#{var_name} is declared by #{usage.declared_by.name} but not used", usage.declared_by, path: usage.path) } + .each { |var_name, usage| add_error("Variable $#{var_name} is declared by #{usage.declared_by.name} but not used", usage.declared_by, path: usage.path, extensions: { + "rule": "StaticValidation::VariablesAreUsedAndDefined", + "variable": var_name, + "usage": "delcared by #{usage.declared_by.name}" + }) } # Used but not declared: node_variables .select { |name, usage| usage.used? && !usage.declared? } - .each { |var_name, usage| add_error("Variable $#{var_name} is used by #{usage.used_by.name} but not declared", usage.ast_node, path: usage.path) } + .each { |var_name, usage| add_error("Variable $#{var_name} is used by #{usage.used_by.name} but not declared", usage.ast_node, path: usage.path, extensions: { + "rule": "StaticValidation::VariablesAreUsedAndDefined", + "variable": var_name, + "usage": "not declared" + }) } end end end From 1be06f2e208ce213ed6cc9655af786d541ec5da9 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 22 Nov 2018 11:38:08 +0000 Subject: [PATCH 3/7] Update all the tests This contains the output from the updated exceptions hash on static validation messages. --- lib/graphql/static_validation/message.rb | 2 +- .../fields_have_appropriate_selections.rb | 4 ++-- .../rules/fragments_are_used.rb | 2 +- ...iable_default_values_are_correctly_typed.rb | 2 +- spec/graphql/execution/multiplex_spec.rb | 3 ++- .../argument_literals_are_compatible_spec.rb | 18 +++++++++++++++--- .../rules/arguments_are_defined_spec.rb | 5 +++++ .../rules/directives_are_defined_spec.rb | 2 ++ .../directives_are_in_valid_locations_spec.rb | 2 ++ .../rules/fields_are_defined_on_type_spec.rb | 4 ++++ .../fields_have_appropriate_selections_spec.rb | 7 ++++++- .../rules/fragment_names_are_unique_spec.rb | 1 + .../fragment_spreads_are_possible_spec.rb | 3 +++ .../rules/fragment_types_exist_spec.rb | 2 ++ .../rules/fragments_are_named_spec.rb | 1 + .../fragments_are_on_composite_types_spec.rb | 3 +++ .../rules/fragments_are_used_spec.rb | 4 +++- .../rules/mutation_root_exists_spec.rb | 1 + .../rules/operation_names_are_valid_spec.rb | 3 +++ .../required_arguments_are_present_spec.rb | 9 +++++++++ .../rules/subscription_root_exists_spec.rb | 1 + .../unique_directives_per_location_spec.rb | 7 +++++++ ..._default_values_are_correctly_typed_spec.rb | 15 +++++++++++---- .../rules/variable_usages_are_allowed_spec.rb | 4 ++++ .../rules/variables_are_input_types_spec.rb | 4 ++++ .../variables_are_used_and_defined_spec.rb | 3 +++ .../static_validation/validator_spec.rb | 3 ++- 27 files changed, 99 insertions(+), 16 deletions(-) diff --git a/lib/graphql/static_validation/message.rb b/lib/graphql/static_validation/message.rb index 383ca43925..76aa2514bb 100644 --- a/lib/graphql/static_validation/message.rb +++ b/lib/graphql/static_validation/message.rb @@ -28,7 +28,7 @@ def to_h "message" => message, "locations" => locations, "path" => path, - }.tap { |hash| hash["extensions"] = @extensions unless @extensions.empty? } + }.tap { |hash| hash["extensions"] = @extensions.collect{ |k,v| [k.to_s, v] }.to_h unless @extensions.empty? } end private diff --git a/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb b/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb index 88b14cad59..fc040cdcd4 100644 --- a/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb +++ b/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb @@ -52,10 +52,10 @@ def validate_field_selections(ast_node, resolved_type) end extensions = { "rule": "StaticValidation::FieldsHaveAppropriateSelections", - "name": node_name + "name": node_name.to_s } unless resolved_type.nil? - extensions["type"] = resolved_type + extensions["type"] = resolved_type.to_s end add_error(msg % { node_name: node_name }, ast_node, extensions: extensions) false diff --git a/lib/graphql/static_validation/rules/fragments_are_used.rb b/lib/graphql/static_validation/rules/fragments_are_used.rb index 889bd381e8..3ec02a8ad7 100644 --- a/lib/graphql/static_validation/rules/fragments_are_used.rb +++ b/lib/graphql/static_validation/rules/fragments_are_used.rb @@ -18,7 +18,7 @@ def on_document(node, parent) if !fragment.name.nil? add_error("Fragment #{fragment.name} was defined, but not used", fragment.node, path: fragment.path, extensions: { "rule": "StaticValidation::FragmentsAreUsed", - "fragement": fragement.name + "fragment": fragment.name }) end end diff --git a/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb b/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb index 3d15f2a6a4..fda140eae3 100644 --- a/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb +++ b/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb @@ -26,7 +26,7 @@ def on_variable_definition(node, parent) add_error(error_message, node, extensions: { "rule": "StaticValidation::VariableDefaultValuesAreCorrectlyTyped", "name": node.name, - "type": type + "type": type.to_s }) end end diff --git a/spec/graphql/execution/multiplex_spec.rb b/spec/graphql/execution/multiplex_spec.rb index 5e098221af..015f69a108 100644 --- a/spec/graphql/execution/multiplex_spec.rb +++ b/spec/graphql/execution/multiplex_spec.rb @@ -94,7 +94,8 @@ def multiplex(*a) "errors" => [{ "message"=>"Field must have selections (field 'nullableNestedSum' returns LazySum but has no selections. Did you mean 'nullableNestedSum { ... }'?)", "locations"=>[{"line"=>1, "column"=>4}], - "path"=>["query", "validationError"] + "path"=>["query", "validationError"], + "extensions"=>{"rule"=>"StaticValidation::FieldsHaveAppropriateSelections", "name"=>"field 'nullableNestedSum'", "type"=>"LazySum"} }] }, ] diff --git a/spec/graphql/static_validation/rules/argument_literals_are_compatible_spec.rb b/spec/graphql/static_validation/rules/argument_literals_are_compatible_spec.rb index 47b6f3d188..d1f11633c2 100644 --- a/spec/graphql/static_validation/rules/argument_literals_are_compatible_spec.rb +++ b/spec/graphql/static_validation/rules/argument_literals_are_compatible_spec.rb @@ -28,6 +28,7 @@ "message"=>"Argument 'id' on Field 'stringCheese' has an invalid value. Expected type 'Int!'.", "locations"=>[{"line"=>3, "column"=>7}], "path"=>["query getCheese", "stringCheese", "id"], + "extensions"=> {"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"id", "type"=>"Field"} } assert_includes(errors, query_root_error) @@ -35,6 +36,7 @@ "message"=>"Argument 'if' on Directive 'skip' has an invalid value. Expected type 'Boolean!'.", "locations"=>[{"line"=>4, "column"=>30}], "path"=>["query getCheese", "cheese", "source", "if"], + "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"if", "type"=>"Directive"} } assert_includes(errors, directive_error) @@ -42,6 +44,7 @@ "message"=>"Argument 'product' on Field 'badSource' has an invalid value. Expected type '[DairyProductInput]'.", "locations"=>[{"line"=>6, "column"=>7}], "path"=>["query getCheese", "badSource", "product"], + "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"product", "type"=>"Field"} } assert_includes(errors, input_object_error) @@ -49,6 +52,7 @@ "message"=>"Argument 'source' on InputObject 'DairyProductInput' has an invalid value. Expected type 'DairyAnimal!'.", "locations"=>[{"line"=>6, "column"=>40}], "path"=>["query getCheese", "badSource", "product", "source"], + "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"source", "type"=>"InputObject"} } assert_includes(errors, input_object_field_error) @@ -56,6 +60,7 @@ "message"=>"Argument 'product' on Field 'missingSource' has an invalid value. Expected type '[DairyProductInput]'.", "locations"=>[{"line"=>7, "column"=>7}], "path"=>["query getCheese", "missingSource", "product"], + "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"product", "type"=>"Field"} } assert_includes(errors, missing_required_field_error) @@ -63,6 +68,7 @@ "message"=>"Argument 'source' on Field 'similarCheese' has an invalid value. Expected type '[DairyAnimal!]!'.", "locations"=>[{"line"=>13, "column"=>7}], "path"=>["fragment cheeseFields", "similarCheese", "source"], + "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"source", "type"=>"Field"} } assert_includes(errors, fragment_error) end @@ -121,6 +127,7 @@ "message"=>"Argument 'arg' on Field 'field' has an invalid value. Expected type 'Int!'.", "locations"=>[{"line"=>3, "column"=>11}], "path"=>["query", "field", "arg"], + "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"arg", "type"=>"Field"} }], errors end end @@ -144,6 +151,7 @@ "message"=>"Argument 'arg' on Field 'field' has an invalid value. Expected type '[Int!]'.", "locations"=>[{"line"=>3, "column"=>11}], "path"=>["query", "field", "arg"], + "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"arg", "type"=>"Field"} }], errors end end @@ -192,13 +200,15 @@ assert_includes errors, { "message"=> "Argument 'arg' on Field 'field' has an invalid value. Expected type 'Input'.", "locations"=>[{"line"=>3, "column"=>11}], - "path"=>["query", "field", "arg"] + "path"=>["query", "field", "arg"], + "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"arg", "type"=>"Field"} } assert_includes errors, { "message"=>"Argument 'b' on InputObject 'Input' has an invalid value. Expected type 'Int!'.", "locations"=>[{"line"=>3, "column"=>22}], - "path"=>["query", "field", "arg", "b"] + "path"=>["query", "field", "arg", "b"], + "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"b", "type"=>"InputObject"} } end end @@ -216,6 +226,7 @@ "message"=>"Argument 'name' on Field '__type' has an invalid value. Expected type 'String!'.", "locations"=>[{"line"=>3, "column"=>9}], "path"=>["query", "__type", "name"], + "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"name", "type"=>"Field"} }) end end @@ -266,7 +277,8 @@ assert_includes errors, { "message"=> "cannot coerce to Float", "locations"=>[{"line"=>3, "column"=>9}], - "path"=>["query", "time", "value"] + "path"=>["query", "time", "value"], + "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "type"=>"CoercionError"} } end end diff --git a/spec/graphql/static_validation/rules/arguments_are_defined_spec.rb b/spec/graphql/static_validation/rules/arguments_are_defined_spec.rb index 5306fe1981..03dd0da852 100644 --- a/spec/graphql/static_validation/rules/arguments_are_defined_spec.rb +++ b/spec/graphql/static_validation/rules/arguments_are_defined_spec.rb @@ -26,6 +26,7 @@ "message"=>"Field 'cheese' doesn't accept argument 'silly'", "locations"=>[{"line"=>4, "column"=>14}], "path"=>["query getCheese", "cheese", "silly"], + "extensions"=>{"rule"=>"StaticValidation::ArgumentsAreDefined", "type"=>"Field", "name"=>"cheese", "argument"=>"silly"} } assert_includes(errors, query_root_error) @@ -33,6 +34,7 @@ "message"=>"InputObject 'DairyProductInput' doesn't accept argument 'wacky'", "locations"=>[{"line"=>5, "column"=>30}], "path"=>["query getCheese", "searchDairy", "product", "wacky"], + "extensions"=>{"rule"=>"StaticValidation::ArgumentsAreDefined", "type"=>"InputObject", "name"=>"DairyProductInput", "argument"=>"wacky"} } assert_includes(errors, input_obj_record) @@ -40,6 +42,7 @@ "message"=>"Field 'similarCheese' doesn't accept argument 'nonsense'", "locations"=>[{"line"=>9, "column"=>36}], "path"=>["fragment cheeseFields", "similarCheese", "nonsense"], + "extensions"=>{"rule"=>"StaticValidation::ArgumentsAreDefined", "type"=>"Field", "name"=>"similarCheese", "argument"=>"nonsense"} } assert_includes(errors, fragment_error) @@ -47,6 +50,7 @@ "message"=>"Directive 'skip' doesn't accept argument 'something'", "locations"=>[{"line"=>10, "column"=>16}], "path"=>["fragment cheeseFields", "id", "something"], + "extensions"=>{"rule"=>"StaticValidation::ArgumentsAreDefined", "type"=>"Directive", "name"=>"skip", "argument"=>"something"} } assert_includes(errors, directive_error) end @@ -63,6 +67,7 @@ "message"=>"Field '__type' doesn't accept argument 'somethingInvalid'", "locations"=>[{"line"=>3, "column"=>16}], "path"=>["query", "__type", "somethingInvalid"], + "extensions"=> {"rule"=>"StaticValidation::ArgumentsAreDefined", "type"=>"Field", "name"=>"__type", "argument"=>"somethingInvalid"} }) end end diff --git a/spec/graphql/static_validation/rules/directives_are_defined_spec.rb b/spec/graphql/static_validation/rules/directives_are_defined_spec.rb index ac60c1767b..29456fc2ea 100644 --- a/spec/graphql/static_validation/rules/directives_are_defined_spec.rb +++ b/spec/graphql/static_validation/rules/directives_are_defined_spec.rb @@ -21,10 +21,12 @@ "message"=>"Directive @nonsense is not defined", "locations"=>[{"line"=>5, "column"=>16}], "path"=>["query getCheese", "okCheese", "source"], + "extensions"=>{"rule"=>"StaticValidation::DirectivesAreDefined", "directive"=>"nonsense"} }, { "message"=>"Directive @moreNonsense is not defined", "locations"=>[{"line"=>7, "column"=>18}], "path"=>["query getCheese", "okCheese", "... on Cheese", "flavor"], + "extensions"=>{"rule"=>"StaticValidation::DirectivesAreDefined", "directive"=>"moreNonsense"} } ] assert_equal(expected, errors) diff --git a/spec/graphql/static_validation/rules/directives_are_in_valid_locations_spec.rb b/spec/graphql/static_validation/rules/directives_are_in_valid_locations_spec.rb index c5c60f85e9..f0a172af54 100644 --- a/spec/graphql/static_validation/rules/directives_are_in_valid_locations_spec.rb +++ b/spec/graphql/static_validation/rules/directives_are_in_valid_locations_spec.rb @@ -27,11 +27,13 @@ "message"=> "'@skip' can't be applied to queries (allowed: fields, fragment spreads, inline fragments)", "locations"=>[{"line"=>2, "column"=>21}], "path"=>["query getCheese"], + "extensions"=>{"rule"=>"StaticValidation::DirectivesAreInValidLocations", "name"=>"skip", "target"=>"queries"} }, { "message"=>"'@skip' can't be applied to fragment definitions (allowed: fields, fragment spreads, inline fragments)", "locations"=>[{"line"=>13, "column"=>33}], "path"=>["fragment whatever"], + "extensions"=>{"rule"=>"StaticValidation::DirectivesAreInValidLocations", "name"=>"skip", "target"=>"fragment definitions"} }, ] assert_equal(expected, errors) diff --git a/spec/graphql/static_validation/rules/fields_are_defined_on_type_spec.rb b/spec/graphql/static_validation/rules/fields_are_defined_on_type_spec.rb index 4fabc379a1..e3a04dad85 100644 --- a/spec/graphql/static_validation/rules/fields_are_defined_on_type_spec.rb +++ b/spec/graphql/static_validation/rules/fields_are_defined_on_type_spec.rb @@ -32,6 +32,7 @@ "message"=>"Field 'notDefinedField' doesn't exist on type 'Query'", "locations"=>[{"line"=>1, "column"=>18}], "path"=>["query getStuff", "notDefinedField"], + "extensions"=>{"rule"=>"StaticValidation::FieldsAreDefinedOnType", "field"=>"notDefinedField", "type"=>"Query"} } ] assert_equal(expected_errors, errors) @@ -47,6 +48,7 @@ "message"=>"Field 'amountThatILikeIt' doesn't exist on type 'Edible'", "locations"=>[{"line"=>1, "column"=>35}], "path"=>["query getStuff", "favoriteEdible", "amountThatILikeIt"], + "extensions"=>{"rule"=>"StaticValidation::FieldsAreDefinedOnType", "field"=>"amountThatILikeIt", "type"=>"Edible"} } ] assert_equal(expected_errors, errors) @@ -121,6 +123,7 @@ {"line"=>2, "column"=>33} ], "path"=>["query", "cheese", "__schema"], + "extensions"=>{"rule"=>"StaticValidation::FieldsAreDefinedOnType", "field"=>"__schema", "type"=>"Cheese"} } ] assert_equal(expected_errors, errors) @@ -152,6 +155,7 @@ {"line"=>2, "column"=>33} ], "path"=>["query", "cheese", "__type"], + "extensions"=>{"rule"=>"StaticValidation::FieldsAreDefinedOnType", "field"=>"__type", "type"=>"Cheese"} } ] assert_equal(expected_errors, errors) diff --git a/spec/graphql/static_validation/rules/fields_have_appropriate_selections_spec.rb b/spec/graphql/static_validation/rules/fields_have_appropriate_selections_spec.rb index fc1e764a47..891ea7757d 100644 --- a/spec/graphql/static_validation/rules/fields_have_appropriate_selections_spec.rb +++ b/spec/graphql/static_validation/rules/fields_have_appropriate_selections_spec.rb @@ -20,6 +20,7 @@ "message"=>"Selections can't be made on scalars (field 'id' returns Int but has selections [something, someFields])", "locations"=>[{"line"=>6, "column"=>47}], "path"=>["query getCheese", "illegalSelectionCheese", "id"], + "extensions"=>{"rule"=>"StaticValidation::FieldsHaveAppropriateSelections", "name"=>"field 'id'", "type"=>"Int"} } assert_includes(errors, illegal_selection_error, "finds illegal selections on scalars") @@ -27,6 +28,7 @@ "message"=>"Field must have selections (field 'cheese' returns Cheese but has no selections. Did you mean 'cheese { ... }'?)", "locations"=>[{"line"=>4, "column"=>7}], "path"=>["query getCheese", "missingFieldsObject"], + "extensions"=>{"rule"=>"StaticValidation::FieldsHaveAppropriateSelections", "name"=>"field 'cheese'", "type"=>"Cheese"} } assert_includes(errors, objects_selection_required_error, "finds objects without selections") @@ -34,6 +36,7 @@ "message"=>"Field must have selections (field 'selfAsEdible' returns Edible but has no selections. Did you mean 'selfAsEdible { ... }'?)", "locations"=>[{"line"=>5, "column"=>47}], "path"=>["query getCheese", "missingFieldsInterface", "selfAsEdible"], + "extensions"=>{"rule"=>"StaticValidation::FieldsHaveAppropriateSelections", "name"=>"field 'selfAsEdible'", "type"=>"Edible"} } assert_includes(errors, interfaces_selection_required_error, "finds interfaces without selections") @@ -41,6 +44,7 @@ "message"=>"Selections can't be made on scalars (field 'flavor' returns String but has inline fragments [String])", "locations"=>[{"line"=>7, "column"=>48}], "path"=>["query getCheese", "incorrectFragmentSpread", "flavor"], + "extensions"=>{"rule"=>"StaticValidation::FieldsHaveAppropriateSelections", "name"=>"field 'flavor'", "type"=>"String"} } assert_includes(errors, incorrect_fragment_error, "finds scalar fields with selections") end @@ -53,7 +57,8 @@ selections_required_error = { "message"=> "Field must have selections (anonymous query returns Query but has no selections. Did you mean ' { ... }'?)", "locations"=>[{"line"=>1, "column"=>1}], - "path"=>["query"] + "path"=>["query"], + "extensions"=>{"rule"=>"StaticValidation::FieldsHaveAppropriateSelections", "name"=>"anonymous query", "type"=>"Query"} } assert_includes(errors, selections_required_error) end diff --git a/spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb b/spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb index 68790a0b05..b19152745a 100644 --- a/spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb +++ b/spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb @@ -21,6 +21,7 @@ "message"=>"Fragment name \"frag1\" must be unique", "locations"=>[{"line"=>8, "column"=>5}, {"line"=>9, "column"=>5}], "path"=>[], + "extensions"=>{"rule"=>"StaticValidation::FragmentNamesAreUnique", "name"=>"frag1"} } assert_includes(errors, fragment_def_error) end diff --git a/spec/graphql/static_validation/rules/fragment_spreads_are_possible_spec.rb b/spec/graphql/static_validation/rules/fragment_spreads_are_possible_spec.rb index d7a610eb56..9fc7f3f6e7 100644 --- a/spec/graphql/static_validation/rules/fragment_spreads_are_possible_spec.rb +++ b/spec/graphql/static_validation/rules/fragment_spreads_are_possible_spec.rb @@ -32,16 +32,19 @@ "message"=>"Fragment on Milk can't be spread inside Cheese", "locations"=>[{"line"=>6, "column"=>9}], "path"=>["query getCheese", "cheese", "... on Milk"], + "extensions"=>{"rule"=>"StaticValidation::FragmentSpreadsArePossible", "name"=>"", "type"=>"Milk", "parent"=>"Cheese"} }, { "message"=>"Fragment milkFields on Milk can't be spread inside Cheese", "locations"=>[{"line"=>4, "column"=>9}], "path"=>["query getCheese", "cheese", "... milkFields"], + "extensions"=>{"rule"=>"StaticValidation::FragmentSpreadsArePossible", "name"=>" milkFields", "type"=>"Milk", "parent"=>"Cheese"} }, { "message"=>"Fragment milkFields on Milk can't be spread inside Cheese", "locations"=>[{"line"=>18, "column"=>7}], "path"=>["fragment cheeseFields", "... milkFields"], + "extensions"=>{"rule"=>"StaticValidation::FragmentSpreadsArePossible", "name"=>" milkFields", "type"=>"Milk", "parent"=>"Cheese"} } ] assert_equal(expected, errors) diff --git a/spec/graphql/static_validation/rules/fragment_types_exist_spec.rb b/spec/graphql/static_validation/rules/fragment_types_exist_spec.rb index 0781afce90..24cc52e0cf 100644 --- a/spec/graphql/static_validation/rules/fragment_types_exist_spec.rb +++ b/spec/graphql/static_validation/rules/fragment_types_exist_spec.rb @@ -28,12 +28,14 @@ "message"=>"No such type Something, so it can't be a fragment condition", "locations"=>[{"line"=>11, "column"=>5}], "path"=>["fragment somethingFields"], + "extensions"=>{"rule"=>"StaticValidation::FragmentTypesExist", "type"=>"Something"} } assert_includes(errors, inline_fragment_error, "on inline fragments") fragment_def_error = { "message"=>"No such type Nothing, so it can't be a fragment condition", "locations"=>[{"line"=>5, "column"=>9}], "path"=>["query getCheese", "cheese", "... on Nothing"], + "extensions"=>{"rule"=>"StaticValidation::FragmentTypesExist", "type"=>"Nothing"} } assert_includes(errors, fragment_def_error, "on fragment definitions") end diff --git a/spec/graphql/static_validation/rules/fragments_are_named_spec.rb b/spec/graphql/static_validation/rules/fragments_are_named_spec.rb index 0cb42ca6c1..1594e66efa 100644 --- a/spec/graphql/static_validation/rules/fragments_are_named_spec.rb +++ b/spec/graphql/static_validation/rules/fragments_are_named_spec.rb @@ -17,6 +17,7 @@ "message"=>"Fragment definition has no name", "locations"=>[{"line"=>2, "column"=>5}], "path"=>["fragment "], + "extensions"=>{"rule"=>"StaticValidation::FragmentsAreNamed"} } assert_includes(errors, fragment_def_error, "on fragment definitions") end diff --git a/spec/graphql/static_validation/rules/fragments_are_on_composite_types_spec.rb b/spec/graphql/static_validation/rules/fragments_are_on_composite_types_spec.rb index 41c41f7b2a..27682f9539 100644 --- a/spec/graphql/static_validation/rules/fragments_are_on_composite_types_spec.rb +++ b/spec/graphql/static_validation/rules/fragments_are_on_composite_types_spec.rb @@ -36,16 +36,19 @@ "message"=>"Invalid fragment on type Boolean (must be Union, Interface or Object)", "locations"=>[{"line"=>6, "column"=>11}], "path"=>["query getCheese", "cheese", "... on Cheese", "... on Boolean"], + "extensions"=>{"rule"=>"StaticValidation::FragmentsAreOnCompositeTypes", "type"=>"Boolean"} }, { "message"=>"Invalid fragment on type DairyProductInput (must be Union, Interface or Object)", "locations"=>[{"line"=>16, "column"=>9}], "path"=>["query getCheese", "cheese", "... on DairyProductInput"], + "extensions"=>{"rule"=>"StaticValidation::FragmentsAreOnCompositeTypes", "type"=>"DairyProductInput"} }, { "message"=>"Invalid fragment on type Int (must be Union, Interface or Object)", "locations"=>[{"line"=>22, "column"=>5}], "path"=>["fragment intFields"], + "extensions"=>{"rule"=>"StaticValidation::FragmentsAreOnCompositeTypes", "type"=>"Int"} }, ] assert_equal(expected, errors) diff --git a/spec/graphql/static_validation/rules/fragments_are_used_spec.rb b/spec/graphql/static_validation/rules/fragments_are_used_spec.rb index da4e9958bc..c544041b97 100644 --- a/spec/graphql/static_validation/rules/fragments_are_used_spec.rb +++ b/spec/graphql/static_validation/rules/fragments_are_used_spec.rb @@ -18,6 +18,7 @@ "message"=>"Fragment unusedFields was defined, but not used", "locations"=>[{"line"=>8, "column"=>5}], "path"=>["fragment unusedFields"], + "extensions"=>{"rule"=>"StaticValidation::FragmentsAreUsed", "fragment"=>"unusedFields"} }) end @@ -25,7 +26,8 @@ assert_includes(errors, { "message"=>"Fragment undefinedFields was used, but not defined", "locations"=>[{"line"=>5, "column"=>7}], - "path"=>["query getCheese", "... undefinedFields"] + "path"=>["query getCheese", "... undefinedFields"], + "extensions"=>{"rule"=>"StaticValidation::FragmentsAreUsed", "fragement"=>"undefinedFields"} }) end diff --git a/spec/graphql/static_validation/rules/mutation_root_exists_spec.rb b/spec/graphql/static_validation/rules/mutation_root_exists_spec.rb index b0c4c0df89..27d16d0f1a 100644 --- a/spec/graphql/static_validation/rules/mutation_root_exists_spec.rb +++ b/spec/graphql/static_validation/rules/mutation_root_exists_spec.rb @@ -32,6 +32,7 @@ "message"=>"Schema is not configured for mutations", "locations"=>[{"line"=>2, "column"=>5}], "path"=>["mutation addBagel"], + "extensions"=>{"rule"=>"StaticValidation::MutationRootExists"} } assert_includes(errors, missing_mutation_root_error) end diff --git a/spec/graphql/static_validation/rules/operation_names_are_valid_spec.rb b/spec/graphql/static_validation/rules/operation_names_are_valid_spec.rb index 68dae40958..c6a679d259 100644 --- a/spec/graphql/static_validation/rules/operation_names_are_valid_spec.rb +++ b/spec/graphql/static_validation/rules/operation_names_are_valid_spec.rb @@ -26,6 +26,7 @@ "message"=>"Operation name is required when multiple operations are present", "locations"=>[{"line"=>5, "column"=>5}, {"line"=>9, "column"=>5}], "path"=>[], + "extensions"=>{"rule"=>"StaticValidation::OperationNamesAreValid"} } assert_includes(errors, requires_name_error) end @@ -49,6 +50,7 @@ "message"=>"Operation name is required when multiple operations are present", "locations"=>[{"line"=>1, "column"=>5}, {"line"=>5, "column"=>5}], "path"=>[], + "extensions"=>{"rule"=>"StaticValidation::OperationNamesAreValid"} } assert_includes(errors, requires_name_error) end @@ -72,6 +74,7 @@ "message"=>'Operation name "getCheese" must be unique', "locations"=>[{"line"=>1, "column"=>5}, {"line"=>5, "column"=>5}], "path"=>[], + "extensions"=>{"rule"=>"StaticValidation::OperationNamesAreValid", "name"=>"getCheese"} } assert_includes(errors, name_uniqueness_error) end diff --git a/spec/graphql/static_validation/rules/required_arguments_are_present_spec.rb b/spec/graphql/static_validation/rules/required_arguments_are_present_spec.rb index 188f3e2e4d..defc2e0c59 100644 --- a/spec/graphql/static_validation/rules/required_arguments_are_present_spec.rb +++ b/spec/graphql/static_validation/rules/required_arguments_are_present_spec.rb @@ -23,6 +23,7 @@ "message"=>"Field 'cheese' is missing required arguments: id", "locations"=>[{"line"=>4, "column"=>7}], "path"=>["query getCheese", "cheese"], + "extensions"=>{"rule"=>"StaticValidation::RequiredArgumentsArePresent", "class"=>"Field", "name"=>"cheese", "arguments"=>"id"} } assert_includes(errors, query_root_error) @@ -30,6 +31,7 @@ "message"=>"Field 'similarCheese' is missing required arguments: source", "locations"=>[{"line"=>8, "column"=>7}], "path"=>["fragment cheeseFields", "similarCheese"], + "extensions"=>{"rule"=>"StaticValidation::RequiredArgumentsArePresent", "class"=>"Field", "name"=>"similarCheese", "arguments"=>"source"} } assert_includes(errors, fragment_error) @@ -37,6 +39,7 @@ "message"=>"Directive 'skip' is missing required arguments: if", "locations"=>[{"line"=>10, "column"=>10}], "path"=>["fragment cheeseFields", "id"], + "extensions"=>{"rule"=>"StaticValidation::RequiredArgumentsArePresent", "class"=>"Directive", "name"=>"skip", "arguments"=>"if"} } assert_includes(errors, directive_error) end @@ -56,6 +59,12 @@ {"line"=>3, "column"=>9} ], "path"=>["query", "__type"], + "extensions"=>{ + "rule"=>"StaticValidation::RequiredArgumentsArePresent", + "class"=>"Field", + "name"=>"__type", + "arguments"=>"name" + } } ] assert_equal(expected_errors, errors) diff --git a/spec/graphql/static_validation/rules/subscription_root_exists_spec.rb b/spec/graphql/static_validation/rules/subscription_root_exists_spec.rb index 2bcfa9f66e..dd814d9b0b 100644 --- a/spec/graphql/static_validation/rules/subscription_root_exists_spec.rb +++ b/spec/graphql/static_validation/rules/subscription_root_exists_spec.rb @@ -27,6 +27,7 @@ "message"=>"Schema is not configured for subscriptions", "locations"=>[{"line"=>2, "column"=>5}], "path"=>["subscription"], + "extensions"=>{"rule"=>"StaticValidation::SubscriptionRootExists"} } assert_includes(errors, missing_subscription_root_error) end diff --git a/spec/graphql/static_validation/rules/unique_directives_per_location_spec.rb b/spec/graphql/static_validation/rules/unique_directives_per_location_spec.rb index b117789b3c..a360640614 100644 --- a/spec/graphql/static_validation/rules/unique_directives_per_location_spec.rb +++ b/spec/graphql/static_validation/rules/unique_directives_per_location_spec.rb @@ -102,6 +102,7 @@ "message" => 'The directive "A" can only be used once at this location.', "locations" => [{ "line" => 4, "column" => 17 }, { "line" => 4, "column" => 20 }], "path" => ["query", "type", "field"], + "extensions"=>{"rule"=>"StaticValidation::UniqueDirectivesPerLocation", "directive"=>"A"} } end end @@ -121,12 +122,14 @@ "message" => 'The directive "A" can only be used once at this location.', "locations" => [{ "line" => 4, "column" => 17 }, { "line" => 4, "column" => 20 }], "path" => ["query", "type", "field"], + "extensions"=> {"rule"=>"StaticValidation::UniqueDirectivesPerLocation", "directive"=>"A"} } assert_includes errors, { "message" => 'The directive "A" can only be used once at this location.', "locations" => [{ "line" => 4, "column" => 17 }, { "line" => 4, "column" => 23 }], "path" => ["query", "type", "field"], + "extensions"=> {"rule"=>"StaticValidation::UniqueDirectivesPerLocation", "directive"=>"A"} } end end @@ -145,12 +148,14 @@ "message" => 'The directive "A" can only be used once at this location.', "locations" => [{ "line" => 4, "column" => 17 }, { "line" => 4, "column" => 23 }], "path" => ["query", "type", "field"], + "extensions"=>{"rule"=>"StaticValidation::UniqueDirectivesPerLocation", "directive"=>"A"} } assert_includes errors, { "message" => 'The directive "B" can only be used once at this location.', "locations" => [{ "line" => 4, "column" => 20 }, { "line" => 4, "column" => 26 }], "path" => ["query", "type", "field"], + "extensions"=>{"rule"=>"StaticValidation::UniqueDirectivesPerLocation", "directive"=>"B"} } end end @@ -169,12 +174,14 @@ "message" => 'The directive "A" can only be used once at this location.', "locations" => [{ "line" => 3, "column" => 14 }, { "line" => 3, "column" => 17 }], "path" => ["query", "type"], + "extensions" => {"rule" => "StaticValidation::UniqueDirectivesPerLocation", "directive" => "A"} } assert_includes errors, { "message" => 'The directive "A" can only be used once at this location.', "locations" => [{ "line" => 4, "column" => 17 }, { "line" => 4, "column" => 20 }], "path" => ["query", "type", "field"], + "extensions" => {"rule" => "StaticValidation::UniqueDirectivesPerLocation", "directive" => "A"} } end end diff --git a/spec/graphql/static_validation/rules/variable_default_values_are_correctly_typed_spec.rb b/spec/graphql/static_validation/rules/variable_default_values_are_correctly_typed_spec.rb index 9c2b40b28a..30cf3487e3 100644 --- a/spec/graphql/static_validation/rules/variable_default_values_are_correctly_typed_spec.rb +++ b/spec/graphql/static_validation/rules/variable_default_values_are_correctly_typed_spec.rb @@ -30,16 +30,19 @@ "message"=>"Default value for $badInt doesn't match type Int", "locations"=>[{"line"=>6, "column"=>7}], "path"=>["query getCheese"], + "extensions"=>{"rule"=>"StaticValidation::VariableDefaultValuesAreCorrectlyTyped", "name"=>"badInt", "type"=>"Int"} }, { "message"=>"Default value for $badInput doesn't match type DairyProductInput", "locations"=>[{"line"=>8, "column"=>7}], "path"=>["query getCheese"], + "extensions"=>{"rule"=>"StaticValidation::VariableDefaultValuesAreCorrectlyTyped", "name"=>"badInput", "type"=>"DairyProductInput"} }, { "message"=>"Non-null variable $nonNull can't have a default value", "locations"=>[{"line"=>9, "column"=>7}], "path"=>["query getCheese"], + "extensions"=>{"rule"=>"StaticValidation::VariableDefaultValuesAreCorrectlyTyped", "name"=>"nonNull"} } ] assert_equal(expected, errors) @@ -116,17 +119,20 @@ { "message"=>"Non-null variable $a can't have a default value", "locations"=>[{"line"=>3, "column"=>11}], - "path"=>["query getCheese"] + "path"=>["query getCheese"], + "extensions"=>{"rule"=>"StaticValidation::VariableDefaultValuesAreCorrectlyTyped", "name"=>"a"} }, { "message"=>"Non-null variable $b can't have a default value", "locations"=>[{"line"=>4, "column"=>11}], - "path"=>["query getCheese"] + "path"=>["query getCheese"], + "extensions"=>{"rule"=>"StaticValidation::VariableDefaultValuesAreCorrectlyTyped", "name"=>"b"} }, { "message"=>"Default value for $c doesn't match type ComplexInput", "locations"=>[{"line"=>5, "column"=>11}], - "path"=>["query getCheese"] + "path"=>["query getCheese"], + "extensions"=>{"rule"=>"StaticValidation::VariableDefaultValuesAreCorrectlyTyped", "name"=>"c", "type"=>"ComplexInput"} } ] @@ -182,7 +188,8 @@ assert_includes errors, { "message"=> "cannot coerce to Float", "locations"=>[{"line"=>3, "column"=>9}], - "path"=>["query"] + "path"=>["query"], + "extensions"=>{"rule"=>"StaticValidation::VariableDefaultValuesAreCorrectlyTyped", "name"=>"value", "type"=>"Time"} } end end diff --git a/spec/graphql/static_validation/rules/variable_usages_are_allowed_spec.rb b/spec/graphql/static_validation/rules/variable_usages_are_allowed_spec.rb index 6b4c2793cf..e2d551638f 100644 --- a/spec/graphql/static_validation/rules/variable_usages_are_allowed_spec.rb +++ b/spec/graphql/static_validation/rules/variable_usages_are_allowed_spec.rb @@ -44,21 +44,25 @@ "message"=>"Nullability mismatch on variable $badInt and argument id (Int / Int!)", "locations"=>[{"line"=>14, "column"=>28}], "path"=>["query getCheese", "badCheese", "id"], + "extensions"=>{"rule"=>"StaticValidation::VariableUsagesAreAllowed", "variable"=>"badInt", "type"=>"Int", "argument"=>"id", "error"=>"Nullability mismatch"} }, { "message"=>"Type mismatch on variable $badStr and argument id (String! / Int!)", "locations"=>[{"line"=>15, "column"=>28}], "path"=>["query getCheese", "badStrCheese", "id"], + "extensions"=>{"rule"=>"StaticValidation::VariableUsagesAreAllowed", "variable"=>"badStr", "type"=>"String!", "argument"=>"id", "error"=>"Type mismatch"} }, { "message"=>"Nullability mismatch on variable $badAnimals and argument source ([DairyAnimal]! / [DairyAnimal!]!)", "locations"=>[{"line"=>18, "column"=>30}], "path"=>["query getCheese", "cheese", "other", "source"], + "extensions"=>{"rule"=>"StaticValidation::VariableUsagesAreAllowed", "variable"=>"badAnimals", "type"=>"[DairyAnimal]!", "argument"=>"source", "error"=>"Nullability mismatch"} }, { "message"=>"List dimension mismatch on variable $deepAnimals and argument source ([[DairyAnimal!]!]! / [DairyAnimal!]!)", "locations"=>[{"line"=>19, "column"=>32}], "path"=>["query getCheese", "cheese", "tooDeep", "source"], + "extensions"=>{"rule"=>"StaticValidation::VariableUsagesAreAllowed", "variable"=>"deepAnimals", "type"=>"[[DairyAnimal!]!]!", "argument"=>"source", "error"=>"List dimension mismatch"} } ] assert_equal(expected, errors) diff --git a/spec/graphql/static_validation/rules/variables_are_input_types_spec.rb b/spec/graphql/static_validation/rules/variables_are_input_types_spec.rb index 6a471499a2..6b56c195f4 100644 --- a/spec/graphql/static_validation/rules/variables_are_input_types_spec.rb +++ b/spec/graphql/static_validation/rules/variables_are_input_types_spec.rb @@ -23,24 +23,28 @@ "message"=>"AnimalProduct isn't a valid input type (on $interface)", "locations"=>[{"line"=>5, "column"=>7}], "path"=>["query getCheese"], + "extensions"=>{"rule"=>"StaticValidation::VariablesAreInputTypes", "name"=>"interface", "type"=>"AnimalProduct"} }) assert_includes(errors, { "message"=>"Milk isn't a valid input type (on $object)", "locations"=>[{"line"=>6, "column"=>7}], "path"=>["query getCheese"], + "extensions"=>{"rule"=>"StaticValidation::VariablesAreInputTypes", "name"=>"object", "type"=>"Milk"} }) assert_includes(errors, { "message"=>"Cheese isn't a valid input type (on $objects)", "locations"=>[{"line"=>7, "column"=>7}], "path"=>["query getCheese"], + "extensions"=>{"rule"=>"StaticValidation::VariablesAreInputTypes", "name"=>"objects", "type"=>"Cheese"} }) assert_includes(errors, { "message"=>"Nonsense isn't a defined input type (on $unknownType)", "locations"=>[{"line"=>8, "column"=>7}], "path"=>["query getCheese"], + "extensions"=>{"rule"=>"StaticValidation::VariablesAreInputTypes", "name"=>"unknownType", "type"=>"Nonsense"} }) end diff --git a/spec/graphql/static_validation/rules/variables_are_used_and_defined_spec.rb b/spec/graphql/static_validation/rules/variables_are_used_and_defined_spec.rb index 4514258b27..a2402f9703 100644 --- a/spec/graphql/static_validation/rules/variables_are_used_and_defined_spec.rb +++ b/spec/graphql/static_validation/rules/variables_are_used_and_defined_spec.rb @@ -43,16 +43,19 @@ "message"=>"Variable $notUsedVar is declared by getCheese but not used", "locations"=>[{"line"=>2, "column"=>5}], "path"=>["query getCheese"], + "extensions"=>{"rule"=>"StaticValidation::VariablesAreUsedAndDefined", "variable"=>"notUsedVar", "usage"=>"delcared by getCheese"} }, { "message"=>"Variable $undefinedVar is used by getCheese but not declared", "locations"=>[{"line"=>19, "column"=>22}], "path"=>["query getCheese", "c3", "id"], + "extensions"=>{"rule"=>"StaticValidation::VariablesAreUsedAndDefined", "variable"=>"undefinedVar", "usage"=>"not declared"} }, { "message"=>"Variable $undefinedFragmentVar is used by innerCheeseFields but not declared", "locations"=>[{"line"=>29, "column"=>22}], "path"=>["fragment innerCheeseFields", "c4", "id"], + "extensions"=>{"rule"=>"StaticValidation::VariablesAreUsedAndDefined", "variable"=>"undefinedFragmentVar", "usage"=>"not declared"} }, ] diff --git a/spec/graphql/static_validation/validator_spec.rb b/spec/graphql/static_validation/validator_spec.rb index 97a6ecfdf1..6b4dc0bc69 100644 --- a/spec/graphql/static_validation/validator_spec.rb +++ b/spec/graphql/static_validation/validator_spec.rb @@ -34,7 +34,8 @@ expected_errors = [{ "message" => "Variable $undefinedVar is used by but not declared", "locations" => [{"line" => 1, "column" => 14, "filename" => "not_a_real.graphql"}], - "path" => ["query", "cheese", "id"] + "path" => ["query", "cheese", "id"], + "extensions"=>{"rule"=>"StaticValidation::VariablesAreUsedAndDefined", "variable"=>"undefinedVar", "usage"=>"not declared"} }] assert_equal expected_errors, errors end From ff59465641c8e352dde38b587710aec585543631 Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 3 Dec 2018 17:01:04 +0000 Subject: [PATCH 4/7] Rework errors to be ruby classes. Also improve the error messages with codes and having better naming in the JSON extensions hash --- lib/graphql/static_validation/base_visitor.rb | 10 ++--- lib/graphql/static_validation/message.rb | 15 ++++--- .../rules/argument_literals_are_compatible.rb | 25 +++++------- .../argument_literals_are_compatible_error.rb | 32 +++++++++++++++ .../rules/argument_names_are_unique.rb | 5 +-- .../rules/argument_names_are_unique_error.rb | 31 ++++++++++++++ .../rules/arguments_are_defined.rb | 13 +++--- .../rules/arguments_are_defined_error.rb | 36 +++++++++++++++++ .../rules/directives_are_defined.rb | 9 +++-- .../rules/directives_are_defined_error.rb | 30 ++++++++++++++ .../directives_are_in_valid_locations.rb | 20 +++++----- ...directives_are_in_valid_locations_error.rb | 32 +++++++++++++++ .../rules/fields_are_defined_on_type.rb | 17 +++++--- .../rules/fields_are_defined_on_type_error.rb | 33 +++++++++++++++ .../fields_have_appropriate_selections.rb | 7 +++- ...ields_have_appropriate_selections_error.rb | 32 +++++++++++++++ .../rules/fields_will_merge.rb | 16 +++++++- .../rules/fields_will_merge_error.rb | 33 +++++++++++++++ .../rules/fragment_names_are_unique.rb | 9 +++-- .../rules/fragment_names_are_unique_error.rb | 30 ++++++++++++++ .../rules/fragment_spreads_are_possible.rb | 14 ++++--- .../fragment_spreads_are_possible_error.rb | 36 +++++++++++++++++ .../rules/fragment_types_exist.rb | 9 +++-- .../rules/fragment_types_exist_error.rb | 30 ++++++++++++++ .../rules/fragments_are_finite.rb | 7 +++- .../rules/fragments_are_finite_error.rb | 30 ++++++++++++++ .../rules/fragments_are_named.rb | 7 ++-- .../rules/fragments_are_named_error.rb | 27 +++++++++++++ .../rules/fragments_are_on_composite_types.rb | 9 +++-- .../fragments_are_on_composite_types_error.rb | 31 ++++++++++++++ .../rules/fragments_are_used.rb | 20 ++++++---- .../rules/fragments_are_used_error.rb | 30 ++++++++++++++ .../rules/mutation_root_exists.rb | 7 ++-- .../rules/mutation_root_exists_error.rb | 27 +++++++++++++ .../rules/no_definitions_are_present.rb | 4 +- .../rules/no_definitions_are_present_error.rb | 26 ++++++++++++ .../rules/operation_names_are_valid.rb | 16 ++++---- .../rules/operation_names_are_valid_error.rb | 29 ++++++++++++++ .../rules/required_arguments_are_present.rb | 13 +++--- .../required_arguments_are_present_error.rb | 36 +++++++++++++++++ .../rules/subscription_root_exists.rb | 7 ++-- .../rules/subscription_root_exists_error.rb | 27 +++++++++++++ .../rules/unique_directives_per_location.rb | 11 ++--- .../unique_directives_per_location_error.rb | 30 ++++++++++++++ ...able_default_values_are_correctly_typed.rb | 23 ++++++----- ...efault_values_are_correctly_typed_error.rb | 40 +++++++++++++++++++ .../rules/variable_names_are_unique.rb | 9 +++-- .../rules/variable_names_are_unique_error.rb | 30 ++++++++++++++ .../rules/variable_usages_are_allowed.rb | 15 +++---- .../variable_usages_are_allowed_error.rb | 39 ++++++++++++++++++ .../rules/variables_are_input_types.rb | 22 +++++----- .../rules/variables_are_input_types_error.rb | 33 +++++++++++++++ .../rules/variables_are_used_and_defined.rb | 28 ++++++++----- .../variables_are_used_and_defined_error.rb | 38 ++++++++++++++++++ spec/graphql/execution/multiplex_spec.rb | 2 +- .../argument_literals_are_compatible_spec.rb | 24 +++++------ .../rules/arguments_are_defined_spec.rb | 10 ++--- .../rules/directives_are_defined_spec.rb | 4 +- .../directives_are_in_valid_locations_spec.rb | 4 +- .../rules/fields_are_defined_on_type_spec.rb | 9 +++-- ...fields_have_appropriate_selections_spec.rb | 10 ++--- .../rules/fields_will_merge_spec.rb | 3 +- .../rules/fragment_names_are_unique_spec.rb | 2 +- .../fragment_spreads_are_possible_spec.rb | 6 +-- .../rules/fragment_types_exist_spec.rb | 4 +- .../rules/fragments_are_finite_spec.rb | 2 + .../rules/fragments_are_named_spec.rb | 2 +- .../fragments_are_on_composite_types_spec.rb | 6 +-- .../rules/fragments_are_used_spec.rb | 4 +- .../rules/mutation_root_exists_spec.rb | 2 +- .../rules/operation_names_are_valid_spec.rb | 6 +-- .../required_arguments_are_present_spec.rb | 10 ++--- .../rules/subscription_root_exists_spec.rb | 2 +- .../unique_directives_per_location_spec.rb | 14 +++---- ...default_values_are_correctly_typed_spec.rb | 14 +++---- .../rules/variable_usages_are_allowed_spec.rb | 8 ++-- .../rules/variables_are_input_types_spec.rb | 8 ++-- .../variables_are_used_and_defined_spec.rb | 6 +-- .../static_validation/validator_spec.rb | 5 ++- 79 files changed, 1121 insertions(+), 241 deletions(-) create mode 100644 lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb create mode 100644 lib/graphql/static_validation/rules/argument_names_are_unique_error.rb create mode 100644 lib/graphql/static_validation/rules/arguments_are_defined_error.rb create mode 100644 lib/graphql/static_validation/rules/directives_are_defined_error.rb create mode 100644 lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb create mode 100644 lib/graphql/static_validation/rules/fields_are_defined_on_type_error.rb create mode 100644 lib/graphql/static_validation/rules/fields_have_appropriate_selections_error.rb create mode 100644 lib/graphql/static_validation/rules/fields_will_merge_error.rb create mode 100644 lib/graphql/static_validation/rules/fragment_names_are_unique_error.rb create mode 100644 lib/graphql/static_validation/rules/fragment_spreads_are_possible_error.rb create mode 100644 lib/graphql/static_validation/rules/fragment_types_exist_error.rb create mode 100644 lib/graphql/static_validation/rules/fragments_are_finite_error.rb create mode 100644 lib/graphql/static_validation/rules/fragments_are_named_error.rb create mode 100644 lib/graphql/static_validation/rules/fragments_are_on_composite_types_error.rb create mode 100644 lib/graphql/static_validation/rules/fragments_are_used_error.rb create mode 100644 lib/graphql/static_validation/rules/mutation_root_exists_error.rb create mode 100644 lib/graphql/static_validation/rules/no_definitions_are_present_error.rb create mode 100644 lib/graphql/static_validation/rules/operation_names_are_valid_error.rb create mode 100644 lib/graphql/static_validation/rules/required_arguments_are_present_error.rb create mode 100644 lib/graphql/static_validation/rules/subscription_root_exists_error.rb create mode 100644 lib/graphql/static_validation/rules/unique_directives_per_location_error.rb create mode 100644 lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb create mode 100644 lib/graphql/static_validation/rules/variable_names_are_unique_error.rb create mode 100644 lib/graphql/static_validation/rules/variable_usages_are_allowed_error.rb create mode 100644 lib/graphql/static_validation/rules/variables_are_input_types_error.rb create mode 100644 lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb diff --git a/lib/graphql/static_validation/base_visitor.rb b/lib/graphql/static_validation/base_visitor.rb index 22df5a5923..56fd343f92 100644 --- a/lib/graphql/static_validation/base_visitor.rb +++ b/lib/graphql/static_validation/base_visitor.rb @@ -172,13 +172,11 @@ def on_fragment_with_type(node) private - # Error `message` is located at `node` - def add_error(message, nodes, path: nil, extensions: {}) - path ||= @path.dup - nodes = Array(nodes) - m = GraphQL::StaticValidation::Message.new(message, nodes: nodes, path: path, extensions: extensions) - context.errors << m + def add_error(error) + error.path ||= @path.dup + context.errors << error end + end end end diff --git a/lib/graphql/static_validation/message.rb b/lib/graphql/static_validation/message.rb index 76aa2514bb..d57930f8b5 100644 --- a/lib/graphql/static_validation/message.rb +++ b/lib/graphql/static_validation/message.rb @@ -9,26 +9,25 @@ module MessageHelper def message(message, nodes, context: nil, path: nil, extensions: {}) path ||= context.path nodes = Array(nodes) - GraphQL::StaticValidation::Message.new(message, nodes: nodes, path: path, extensions: extensions) + GraphQL::StaticValidation::Message.new(message, nodes: nodes, path: path) end end - attr_reader :message, :path + attr_reader :message + attr_accessor :path - def initialize(message, path: [], nodes: [], extensions: {}) + def initialize(message, path: nil, nodes: []) @message = message - @nodes = nodes + @nodes = Array(nodes) @path = path - @extensions = extensions end # A hash representation of this Message def to_h { "message" => message, - "locations" => locations, - "path" => path, - }.tap { |hash| hash["extensions"] = @extensions.collect{ |k,v| [k.to_s, v] }.to_h unless @extensions.empty? } + "locations" => locations + }.tap { |h| h["path"] = path unless path.nil? } end private diff --git a/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb b/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb index 4c49fefc3d..e550f16550 100644 --- a/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb +++ b/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb @@ -31,27 +31,22 @@ def on_argument(node, parent) begin valid = context.valid_literal?(node.value, arg_defn.type) rescue GraphQL::CoercionError => err - error_message = err.message - extensions = { - "rule": "StaticValidation::ArgumentLiteralsAreCompatible", - "type": "CoercionError" - } + error = GraphQL::StaticValidation::ArgumentLiteralsAreCompatibleError.new(err.message, nodes: parent, type: "CoercionError") end if !valid - error_message ||= begin + error ||= begin kind_of_node = node_type(parent) error_arg_name = parent_name(parent, parent_defn) - "Argument '#{node.name}' on #{kind_of_node} '#{error_arg_name}' has an invalid value. Expected type '#{arg_defn.type}'." - end - - extensions ||= { - "rule": "StaticValidation::ArgumentLiteralsAreCompatible", - "argument": node.name, - "type": node_type(parent) - } - add_error(error_message, parent, extensions: extensions) + GraphQL::StaticValidation::ArgumentLiteralsAreCompatibleError.new( + "Argument '#{node.name}' on #{kind_of_node} '#{error_arg_name}' has an invalid value. Expected type '#{arg_defn.type}'.", + nodes: parent, + type: kind_of_node, + argument: node.name + ) + end + add_error(error) end end end diff --git a/lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb b/lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb new file mode 100644 index 0000000000..a5ff52be09 --- /dev/null +++ b/lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class ArgumentLiteralsAreCompatibleError < Message + attr_reader :type_name + attr_reader :argument_name + + def initialize(message, path: nil, nodes: [], type:, argument: nil) + super(message, path: path, nodes: nodes) + @type_name = type + @argument_name = argument + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "typeName" => type_name + }.tap { |h| h["argumentName"] = argument_name unless argument_name.nil? } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "argumentLiteralsIncompatible" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/argument_names_are_unique.rb b/lib/graphql/static_validation/rules/argument_names_are_unique.rb index 7fa39e9e62..efa6ce5332 100644 --- a/lib/graphql/static_validation/rules/argument_names_are_unique.rb +++ b/lib/graphql/static_validation/rules/argument_names_are_unique.rb @@ -21,10 +21,7 @@ def validate_arguments(node) argument_defns.each { |a| args_by_name[a.name] << a } args_by_name.each do |name, defns| if defns.size > 1 - add_error("There can be only one argument named \"#{name}\"", defns, extensions: { - "rule": "StaticValidation::ArgumentNamesAreUnique", - "name": name - }) + add_error(GraphQL::StaticValidation::ArgumentNamesAreUniqueError.new("There can be only one argument named \"#{name}\"", nodes: defns, name: name)) end end end diff --git a/lib/graphql/static_validation/rules/argument_names_are_unique_error.rb b/lib/graphql/static_validation/rules/argument_names_are_unique_error.rb new file mode 100644 index 0000000000..03f0c18d66 --- /dev/null +++ b/lib/graphql/static_validation/rules/argument_names_are_unique_error.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class ArgumentNamesAreUniqueError < Message + attr_reader :name + + def initialize(message, path: nil, nodes: [], name:) + super(message, path: path, nodes: nodes) + @name = name + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "name" => name + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "argumentNotUnique" + end + end + end +end + diff --git a/lib/graphql/static_validation/rules/arguments_are_defined.rb b/lib/graphql/static_validation/rules/arguments_are_defined.rb index c71869ab7c..205e419a94 100644 --- a/lib/graphql/static_validation/rules/arguments_are_defined.rb +++ b/lib/graphql/static_validation/rules/arguments_are_defined.rb @@ -29,12 +29,13 @@ def on_argument(node, parent) elsif parent_defn kind_of_node = node_type(parent) error_arg_name = parent_name(parent, parent_defn) - add_error("#{kind_of_node} '#{error_arg_name}' doesn't accept argument '#{node.name}'", node, extensions: { - "rule": "StaticValidation::ArgumentsAreDefined", - "type": kind_of_node, - "name": error_arg_name, - "argument": node.name - }) + add_error(GraphQL::StaticValidation::ArgumentsAreDefinedError.new( + "#{kind_of_node} '#{error_arg_name}' doesn't accept argument '#{node.name}'", + nodes: node, + name: error_arg_name, + type: kind_of_node, + argument: node.name + )) else # Some other weird error super diff --git a/lib/graphql/static_validation/rules/arguments_are_defined_error.rb b/lib/graphql/static_validation/rules/arguments_are_defined_error.rb new file mode 100644 index 0000000000..56aa21e5d9 --- /dev/null +++ b/lib/graphql/static_validation/rules/arguments_are_defined_error.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class ArgumentsAreDefinedError < Message + attr_reader :name + attr_reader :type_name + attr_reader :argument_name + + def initialize(message, path: nil, nodes: [], name:, type:, argument:) + super(message, path: path, nodes: nodes) + @name = name + @type_name = type + @argument_name = argument + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "name" => name, + "typeName" => type_name, + "argumentName" => argument_name + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "argumentNotAccepted" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/directives_are_defined.rb b/lib/graphql/static_validation/rules/directives_are_defined.rb index 7a2af933e6..d93bf70d37 100644 --- a/lib/graphql/static_validation/rules/directives_are_defined.rb +++ b/lib/graphql/static_validation/rules/directives_are_defined.rb @@ -9,10 +9,11 @@ def initialize(*) def on_directive(node, parent) if !@directive_names.include?(node.name) - add_error("Directive @#{node.name} is not defined", node, extensions: { - "rule": "StaticValidation::DirectivesAreDefined", - "directive": node.name - }) + add_error(GraphQL::StaticValidation::DirectivesAreDefinedError.new( + "Directive @#{node.name} is not defined", + nodes: node, + directive: node.name + )) else super end diff --git a/lib/graphql/static_validation/rules/directives_are_defined_error.rb b/lib/graphql/static_validation/rules/directives_are_defined_error.rb new file mode 100644 index 0000000000..7fefa819cb --- /dev/null +++ b/lib/graphql/static_validation/rules/directives_are_defined_error.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class DirectivesAreDefinedError < Message + attr_reader :directive_name + + def initialize(message, path: nil, nodes: [], directive:) + super(message, path: path, nodes: nodes) + @directive_name = directive + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "directiveName" => directive_name + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "undefinedDirective" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb b/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb index f8bc9a9b0b..0d03dc1d2d 100644 --- a/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb +++ b/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb @@ -40,10 +40,11 @@ def validate_location(ast_directive, ast_parent, directives) required_location = SIMPLE_LOCATIONS[ast_parent.class] assert_includes_location(directive_defn, ast_directive, required_location) else - add_error("Directives can't be applied to #{ast_parent.class.name}s", ast_directive, extensions: { - "rule": "StaticValidation::DirectivesAreInValidLocations", - "target": ast_parent.class.name - }) + add_error(GraphQL::StaticValidation::DirectivesAreInValidLocationsError.new( + "Directives can't be applied to #{ast_parent.class.name}s", + nodes: ast_directive, + target: ast_parent.class.name + )) end end @@ -51,11 +52,12 @@ def assert_includes_location(directive_defn, directive_ast, required_location) if !directive_defn.locations.include?(required_location) location_name = LOCATION_MESSAGE_NAMES[required_location] allowed_location_names = directive_defn.locations.map { |loc| LOCATION_MESSAGE_NAMES[loc] } - add_error("'@#{directive_defn.name}' can't be applied to #{location_name} (allowed: #{allowed_location_names.join(", ")})", directive_ast, extensions: { - "rule": "StaticValidation::DirectivesAreInValidLocations", - "name": directive_defn.name, - "target": location_name - }) + add_error(GraphQL::StaticValidation::DirectivesAreInValidLocationsError.new( + "'@#{directive_defn.name}' can't be applied to #{location_name} (allowed: #{allowed_location_names.join(", ")})", + nodes: directive_ast, + target: location_name, + name: directive_defn.name + )) end end end diff --git a/lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb b/lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb new file mode 100644 index 0000000000..b0483738f6 --- /dev/null +++ b/lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class DirectivesAreInValidLocationsError < Message + attr_reader :target_name + attr_reader :name + + def initialize(message, path: nil, nodes: [], target:, name: nil) + super(message, path: path, nodes: nodes) + @target_name = target + @name = name + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "targetName" => target_name + }.tap { |h| h["name"] = name unless name.nil? } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "directiveCannotBeApplied" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/fields_are_defined_on_type.rb b/lib/graphql/static_validation/rules/fields_are_defined_on_type.rb index b64cfb46e2..d1cac120fc 100644 --- a/lib/graphql/static_validation/rules/fields_are_defined_on_type.rb +++ b/lib/graphql/static_validation/rules/fields_are_defined_on_type.rb @@ -8,13 +8,18 @@ def on_field(node, parent) if field.nil? if parent_type.kind.union? - add_error("Selections can't be made directly on unions (see selections on #{parent_type.name})", parent) + add_error(GraphQL::StaticValidation::FieldsHaveAppropriateSelectionsError.new( + "Selections can't be made directly on unions (see selections on #{parent_type.name})", + nodes: parent, + node_name: parent_type.name + )) else - add_error("Field '#{node.name}' doesn't exist on type '#{parent_type.name}'", node, extensions: { - "rule": "StaticValidation::FieldsAreDefinedOnType", - "field": node.name, - "type": parent_type.name - }) + add_error(GraphQL::StaticValidation::FieldsAreDefinedOnTypeError.new( + "Field '#{node.name}' doesn't exist on type '#{parent_type.name}'", + nodes: node, + field: node.name, + type: parent_type.name + )) end else super diff --git a/lib/graphql/static_validation/rules/fields_are_defined_on_type_error.rb b/lib/graphql/static_validation/rules/fields_are_defined_on_type_error.rb new file mode 100644 index 0000000000..26071a57c4 --- /dev/null +++ b/lib/graphql/static_validation/rules/fields_are_defined_on_type_error.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class FieldsAreDefinedOnTypeError < Message + attr_reader :type_name + attr_reader :field_name + + def initialize(message, path: nil, nodes: [], type:, field:) + super(message, path: path, nodes: nodes) + @type_name = type + @field_name = field + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "typeName" => type_name, + "fieldName" => field_name + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "undefinedField" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb b/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb index fc040cdcd4..c8aca7ab64 100644 --- a/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb +++ b/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb @@ -57,7 +57,12 @@ def validate_field_selections(ast_node, resolved_type) unless resolved_type.nil? extensions["type"] = resolved_type.to_s end - add_error(msg % { node_name: node_name }, ast_node, extensions: extensions) + add_error(GraphQL::StaticValidation::FieldsHaveAppropriateSelectionsError.new( + msg % { node_name: node_name }, + nodes: ast_node, + node_name: node_name.to_s, + type: resolved_type.nil? ? nil : resolved_type.to_s + )) false else true diff --git a/lib/graphql/static_validation/rules/fields_have_appropriate_selections_error.rb b/lib/graphql/static_validation/rules/fields_have_appropriate_selections_error.rb new file mode 100644 index 0000000000..7a5bdef07b --- /dev/null +++ b/lib/graphql/static_validation/rules/fields_have_appropriate_selections_error.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class FieldsHaveAppropriateSelectionsError < Message + attr_reader :type_name + attr_reader :node_name + + def initialize(message, path: nil, nodes: [], node_name:, type: nil) + super(message, path: path, nodes: nodes) + @node_name = node_name + @type_name = type + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "nodeName" => node_name + }.tap { |h| h["typeName"] = type_name unless type_name.nil? } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "selectionMismatch" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/fields_will_merge.rb b/lib/graphql/static_validation/rules/fields_will_merge.rb index 6d17bf7b79..8ac33c4dcf 100644 --- a/lib/graphql/static_validation/rules/fields_will_merge.rb +++ b/lib/graphql/static_validation/rules/fields_will_merge.rb @@ -193,13 +193,25 @@ def find_conflict(response_key, field1, field2, mutually_exclusive: false) if node1.name != node2.name errored_nodes = [node1.name, node2.name].sort.join(" or ") msg = "Field '#{response_key}' has a field conflict: #{errored_nodes}?" - context.errors << GraphQL::StaticValidation::Message.new(msg, nodes: [node1, node2]) + context.errors << GraphQL::StaticValidation::FieldsWillMergeError.new( + msg, + nodes: [node1, node2], + path: [], + field_name: response_key, + conflicts: errored_nodes + ) end args = possible_arguments(node1, node2) if args.size > 1 msg = "Field '#{response_key}' has an argument conflict: #{args.map { |arg| GraphQL::Language.serialize(arg) }.join(" or ")}?" - context.errors << GraphQL::StaticValidation::Message.new(msg, nodes: [node1, node2]) + context.errors << GraphQL::StaticValidation::FieldsWillMergeError.new( + msg, + nodes: [node1, node2], + path: [], + field_name: response_key, + conflicts: args.map { |arg| GraphQL::Language.serialize(arg) }.join(" or ") + ) end end diff --git a/lib/graphql/static_validation/rules/fields_will_merge_error.rb b/lib/graphql/static_validation/rules/fields_will_merge_error.rb new file mode 100644 index 0000000000..e2bd9ffb6d --- /dev/null +++ b/lib/graphql/static_validation/rules/fields_will_merge_error.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class FieldsWillMergeError < Message + attr_reader :field_name + attr_reader :conflicts + + def initialize(message, path: nil, nodes: [], field_name:, conflicts:) + super(message, path: path, nodes: nodes) + @field_name = field_name + @conflicts = conflicts + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "fieldName" => field_name, + "conflicts" => conflicts + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "fieldConflict" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/fragment_names_are_unique.rb b/lib/graphql/static_validation/rules/fragment_names_are_unique.rb index 8f4291dc34..7f31d3cbdd 100644 --- a/lib/graphql/static_validation/rules/fragment_names_are_unique.rb +++ b/lib/graphql/static_validation/rules/fragment_names_are_unique.rb @@ -17,10 +17,11 @@ def on_document(_n, _p) super @fragments_by_name.each do |name, fragments| if fragments.length > 1 - add_error(%|Fragment name "#{name}" must be unique|, fragments, extensions: { - "rule": "StaticValidation::FragmentNamesAreUnique", - "name": name - }) + add_error(GraphQL::StaticValidation::FragmentNamesAreUniqueError.new( + %|Fragment name "#{name}" must be unique|, + nodes: fragments, + name: name + )) end end end diff --git a/lib/graphql/static_validation/rules/fragment_names_are_unique_error.rb b/lib/graphql/static_validation/rules/fragment_names_are_unique_error.rb new file mode 100644 index 0000000000..5d77dc58bc --- /dev/null +++ b/lib/graphql/static_validation/rules/fragment_names_are_unique_error.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class FragmentNamesAreUniqueError < Message + attr_reader :fragment_name + + def initialize(message, path: nil, nodes: [], name:) + super(message, path: path, nodes: nodes) + @fragment_name = name + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "fragmentName" => fragment_name + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "fragmentNotUnique" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb b/lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb index 7e24ddf9ef..972850919d 100644 --- a/lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb +++ b/lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb @@ -49,12 +49,14 @@ def validate_fragment_in_scope(parent_type, child_type, node, context, path) if child_types.none? { |c| parent_types.include?(c) } name = node.respond_to?(:name) ? " #{node.name}" : "" - add_error("Fragment#{name} on #{child_type.name} can't be spread inside #{parent_type.name}", node, path: path, extensions: { - "rule": "StaticValidation::FragmentSpreadsArePossible", - "name": name, - "type": child_type.name, - "parent": parent_type.name - }) + add_error(GraphQL::StaticValidation::FragmentSpreadsArePossibleError.new( + "Fragment#{name} on #{child_type.name} can't be spread inside #{parent_type.name}", + nodes: node, + path: path, + fragment_name: name.empty? ? "unknown" : name, + type: child_type.name, + parent: parent_type.name + )) end end diff --git a/lib/graphql/static_validation/rules/fragment_spreads_are_possible_error.rb b/lib/graphql/static_validation/rules/fragment_spreads_are_possible_error.rb new file mode 100644 index 0000000000..8d3d420bf9 --- /dev/null +++ b/lib/graphql/static_validation/rules/fragment_spreads_are_possible_error.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class FragmentSpreadsArePossibleError < Message + attr_reader :type_name + attr_reader :fragment_name + attr_reader :parent_name + + def initialize(message, path: nil, nodes: [], type:, fragment_name:, parent:) + super(message, path: path, nodes: nodes) + @type_name = type + @fragment_name = fragment_name + @parent_name = parent + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "typeName" => type_name, + "fragmentName" => fragment_name, + "parentName" => parent_name + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "cannotSpreadFragment" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/fragment_types_exist.rb b/lib/graphql/static_validation/rules/fragment_types_exist.rb index d067a43d96..9863eaa968 100644 --- a/lib/graphql/static_validation/rules/fragment_types_exist.rb +++ b/lib/graphql/static_validation/rules/fragment_types_exist.rb @@ -23,10 +23,11 @@ def validate_type_exists(fragment_node) type_name = fragment_node.type.name type = context.warden.get_type(type_name) if type.nil? - add_error("No such type #{type_name}, so it can't be a fragment condition", fragment_node, extensions: { - "rule": "StaticValidation::FragmentTypesExist", - "type": type_name - }) + add_error(GraphQL::StaticValidation::FragmentTypesExistError.new( + "No such type #{type_name}, so it can't be a fragment condition", + nodes: fragment_node, + type: type_name + )) false else true diff --git a/lib/graphql/static_validation/rules/fragment_types_exist_error.rb b/lib/graphql/static_validation/rules/fragment_types_exist_error.rb new file mode 100644 index 0000000000..38a77731c3 --- /dev/null +++ b/lib/graphql/static_validation/rules/fragment_types_exist_error.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class FragmentTypesExistError < Message + attr_reader :type_name + + def initialize(message, path: nil, nodes: [], type:) + super(message, path: path, nodes: nodes) + @type_name = type + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "typeName" => type_name + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "undefinedType" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/fragments_are_finite.rb b/lib/graphql/static_validation/rules/fragments_are_finite.rb index d0bd368e55..e0e147c0cd 100644 --- a/lib/graphql/static_validation/rules/fragments_are_finite.rb +++ b/lib/graphql/static_validation/rules/fragments_are_finite.rb @@ -7,7 +7,12 @@ def on_document(_n, _p) dependency_map = context.dependencies dependency_map.cyclical_definitions.each do |defn| if defn.node.is_a?(GraphQL::Language::Nodes::FragmentDefinition) - context.errors << message("Fragment #{defn.name} contains an infinite loop", defn.node, path: defn.path) + context.errors << GraphQL::StaticValidation::FragmentsAreFiniteError.new( + "Fragment #{defn.name} contains an infinite loop", + nodes: defn.node, + path: defn.path, + name: defn.name + ) end end end diff --git a/lib/graphql/static_validation/rules/fragments_are_finite_error.rb b/lib/graphql/static_validation/rules/fragments_are_finite_error.rb new file mode 100644 index 0000000000..a4e7e5c6ab --- /dev/null +++ b/lib/graphql/static_validation/rules/fragments_are_finite_error.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class FragmentsAreFiniteError < Message + attr_reader :fragment_name + + def initialize(message, path: nil, nodes: [], name:) + super(message, path: path, nodes: nodes) + @fragment_name = name + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "fragmentName" => fragment_name + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "infiniteLoop" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/fragments_are_named.rb b/lib/graphql/static_validation/rules/fragments_are_named.rb index a812213040..42f58bec8c 100644 --- a/lib/graphql/static_validation/rules/fragments_are_named.rb +++ b/lib/graphql/static_validation/rules/fragments_are_named.rb @@ -4,9 +4,10 @@ module StaticValidation module FragmentsAreNamed def on_fragment_definition(node, _parent) if node.name.nil? - add_error("Fragment definition has no name", node, extensions: { - "rule": "StaticValidation::FragmentsAreNamed" - }) + add_error(GraphQL::StaticValidation::FragmentsAreNamedError.new( + "Fragment definition has no name", + nodes: node + )) end super end diff --git a/lib/graphql/static_validation/rules/fragments_are_named_error.rb b/lib/graphql/static_validation/rules/fragments_are_named_error.rb new file mode 100644 index 0000000000..fff391c7d0 --- /dev/null +++ b/lib/graphql/static_validation/rules/fragments_are_named_error.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class FragmentsAreNamedError < Message + + def initialize(message, path: nil, nodes: []) + super(message, path: path, nodes: nodes) + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "anonymousFragment" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/fragments_are_on_composite_types.rb b/lib/graphql/static_validation/rules/fragments_are_on_composite_types.rb index 30ade4f64b..c97b6f8284 100644 --- a/lib/graphql/static_validation/rules/fragments_are_on_composite_types.rb +++ b/lib/graphql/static_validation/rules/fragments_are_on_composite_types.rb @@ -21,10 +21,11 @@ def validate_type_is_composite(node) type_name = node_type.to_query_string type_def = context.warden.get_type(type_name) if type_def.nil? || !type_def.kind.composite? - add_error("Invalid fragment on type #{type_name} (must be Union, Interface or Object)", node, extensions: { - "rule": "StaticValidation::FragmentsAreOnCompositeTypes", - "type": type_name - }) + add_error(GraphQL::StaticValidation::FragmentsAreOnCompositeTypesError.new( + "Invalid fragment on type #{type_name} (must be Union, Interface or Object)", + nodes: node, + type: type_name + )) false else true diff --git a/lib/graphql/static_validation/rules/fragments_are_on_composite_types_error.rb b/lib/graphql/static_validation/rules/fragments_are_on_composite_types_error.rb new file mode 100644 index 0000000000..29767249ab --- /dev/null +++ b/lib/graphql/static_validation/rules/fragments_are_on_composite_types_error.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class FragmentsAreOnCompositeTypesError < Message + attr_reader :type_name + attr_reader :argument_name + + def initialize(message, path: nil, nodes: [], type:) + super(message, path: path, nodes: nodes) + @type_name = type + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "typeName" => type_name + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "fragmentOnNonCompositeType" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/fragments_are_used.rb b/lib/graphql/static_validation/rules/fragments_are_used.rb index 3ec02a8ad7..ba98f9671b 100644 --- a/lib/graphql/static_validation/rules/fragments_are_used.rb +++ b/lib/graphql/static_validation/rules/fragments_are_used.rb @@ -7,19 +7,23 @@ def on_document(node, parent) dependency_map = context.dependencies dependency_map.unmet_dependencies.each do |op_defn, spreads| spreads.each do |fragment_spread| - add_error("Fragment #{fragment_spread.name} was used, but not defined", fragment_spread.node, path: fragment_spread.path, extensions: { - "rule": "StaticValidation::FragmentsAreUsed", - "fragement": fragment_spread.name - }) + add_error(GraphQL::StaticValidation::FragmentsAreUsedError.new( + "Fragment #{fragment_spread.name} was used, but not defined", + nodes: fragment_spread.node, + path: fragment_spread.path, + fragment: fragment_spread.name + )) end end dependency_map.unused_dependencies.each do |fragment| if !fragment.name.nil? - add_error("Fragment #{fragment.name} was defined, but not used", fragment.node, path: fragment.path, extensions: { - "rule": "StaticValidation::FragmentsAreUsed", - "fragment": fragment.name - }) + add_error(GraphQL::StaticValidation::FragmentsAreUsedError.new( + "Fragment #{fragment.name} was defined, but not used", + nodes: fragment.node, + path: fragment.path, + fragment: fragment.name + )) end end end diff --git a/lib/graphql/static_validation/rules/fragments_are_used_error.rb b/lib/graphql/static_validation/rules/fragments_are_used_error.rb new file mode 100644 index 0000000000..38f861e18a --- /dev/null +++ b/lib/graphql/static_validation/rules/fragments_are_used_error.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class FragmentsAreUsedError < Message + attr_reader :fragment_name + + def initialize(message, path: nil, nodes: [], fragment:) + super(message, path: path, nodes: nodes) + @fragment_name = fragment + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "fragmentName" => fragment_name + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "useAndDefineFragment" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/mutation_root_exists.rb b/lib/graphql/static_validation/rules/mutation_root_exists.rb index 4c8d917954..8a0929b687 100644 --- a/lib/graphql/static_validation/rules/mutation_root_exists.rb +++ b/lib/graphql/static_validation/rules/mutation_root_exists.rb @@ -4,9 +4,10 @@ module StaticValidation module MutationRootExists def on_operation_definition(node, _parent) if node.operation_type == 'mutation' && context.warden.root_type_for_operation("mutation").nil? - add_error('Schema is not configured for mutations', node, extensions: { - "rule": "StaticValidation::MutationRootExists" - }) + add_error(GraphQL::StaticValidation::MutationRootExistsError.new( + 'Schema is not configured for mutations', + nodes: node + )) else super end diff --git a/lib/graphql/static_validation/rules/mutation_root_exists_error.rb b/lib/graphql/static_validation/rules/mutation_root_exists_error.rb new file mode 100644 index 0000000000..e09ba067f2 --- /dev/null +++ b/lib/graphql/static_validation/rules/mutation_root_exists_error.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class MutationRootExistsError < Message + + def initialize(message, path: nil, nodes: []) + super(message, path: path, nodes: nodes) + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "missingMutationConfiguration" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/no_definitions_are_present.rb b/lib/graphql/static_validation/rules/no_definitions_are_present.rb index 0964f06da5..c631c6ca2c 100644 --- a/lib/graphql/static_validation/rules/no_definitions_are_present.rb +++ b/lib/graphql/static_validation/rules/no_definitions_are_present.rb @@ -33,9 +33,7 @@ def on_invalid_node(node, parent) def on_document(node, parent) super if @schema_definition_nodes.any? - add_error(%|Query cannot contain schema definitions|, @schema_definition_nodes, extensions: { - "rule": "StaticValidation::NoDefinitionsArePresent" - }) + add_error(GraphQL::StaticValidation::NoDefinitionsArePresentError.new(%|Query cannot contain schema definitions|, nodes: @schema_definition_nodes)) end end end diff --git a/lib/graphql/static_validation/rules/no_definitions_are_present_error.rb b/lib/graphql/static_validation/rules/no_definitions_are_present_error.rb new file mode 100644 index 0000000000..3dcd376954 --- /dev/null +++ b/lib/graphql/static_validation/rules/no_definitions_are_present_error.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class NoDefinitionsArePresentError < Message + def initialize(message, path: nil, nodes: []) + super(message, path: path, nodes: nodes) + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "queryContainsSchemaDefinitions" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/operation_names_are_valid.rb b/lib/graphql/static_validation/rules/operation_names_are_valid.rb index 81658fac39..d93f0de4b4 100644 --- a/lib/graphql/static_validation/rules/operation_names_are_valid.rb +++ b/lib/graphql/static_validation/rules/operation_names_are_valid.rb @@ -18,14 +18,16 @@ def on_document(node, parent) @operation_names.each do |name, nodes| if name.nil? && op_count > 1 - add_error(%|Operation name is required when multiple operations are present|, nodes, extensions: { - "rule": "StaticValidation::OperationNamesAreValid" - }) + add_error(GraphQL::StaticValidation::OperationNamesAreValidError.new( + %|Operation name is required when multiple operations are present|, + nodes: nodes + )) elsif nodes.length > 1 - add_error(%|Operation name "#{name}" must be unique|, nodes, extensions: { - "rule": "StaticValidation::OperationNamesAreValid", - "name": name - }) + add_error(GraphQL::StaticValidation::OperationNamesAreValidError.new( + %|Operation name "#{name}" must be unique|, + nodes: nodes, + name: name + )) end end end diff --git a/lib/graphql/static_validation/rules/operation_names_are_valid_error.rb b/lib/graphql/static_validation/rules/operation_names_are_valid_error.rb new file mode 100644 index 0000000000..5efa07b5bb --- /dev/null +++ b/lib/graphql/static_validation/rules/operation_names_are_valid_error.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class OperationNamesAreValidError < Message + attr_reader :operation_name + + def initialize(message, path: nil, nodes: [], name: nil) + super(message, path: path, nodes: nodes) + @operation_name = name + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code + }.tap { |h| h["operationName"] = operation_name unless operation_name.nil? } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "uniquelyNamedOperations" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/required_arguments_are_present.rb b/lib/graphql/static_validation/rules/required_arguments_are_present.rb index 87ead12a38..3f628ba182 100644 --- a/lib/graphql/static_validation/rules/required_arguments_are_present.rb +++ b/lib/graphql/static_validation/rules/required_arguments_are_present.rb @@ -23,12 +23,13 @@ def assert_required_args(ast_node, defn) missing_names = required_argument_names - present_argument_names if missing_names.any? - add_error("#{ast_node.class.name.split("::").last} '#{ast_node.name}' is missing required arguments: #{missing_names.join(", ")}", ast_node, extensions: { - "rule": "StaticValidation::RequiredArgumentsArePresent", - "class": ast_node.class.name.split("::").last, - "name": ast_node.name, - "arguments": "#{missing_names.join(", ")}", - }) + add_error(GraphQL::StaticValidation::RequiredArgumentsArePresentError.new( + "#{ast_node.class.name.split("::").last} '#{ast_node.name}' is missing required arguments: #{missing_names.join(", ")}", + nodes: ast_node, + class_name: ast_node.class.name.split("::").last, + name: ast_node.name, + arguments: "#{missing_names.join(", ")}" + )) end end end diff --git a/lib/graphql/static_validation/rules/required_arguments_are_present_error.rb b/lib/graphql/static_validation/rules/required_arguments_are_present_error.rb new file mode 100644 index 0000000000..edda186f99 --- /dev/null +++ b/lib/graphql/static_validation/rules/required_arguments_are_present_error.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class RequiredArgumentsArePresentError < Message + attr_reader :class_name + attr_reader :name + attr_reader :arguments + + def initialize(message, path: nil, nodes: [], class_name:, name:, arguments:) + super(message, path: path, nodes: nodes) + @class_name = class_name + @name = name + @arguments = arguments + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "className" => class_name, + "name" => name, + "arguments" => arguments + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "missingRequiredArguments" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/subscription_root_exists.rb b/lib/graphql/static_validation/rules/subscription_root_exists.rb index 9ae0d35dc3..b4ccf10f75 100644 --- a/lib/graphql/static_validation/rules/subscription_root_exists.rb +++ b/lib/graphql/static_validation/rules/subscription_root_exists.rb @@ -4,9 +4,10 @@ module StaticValidation module SubscriptionRootExists def on_operation_definition(node, _parent) if node.operation_type == "subscription" && context.warden.root_type_for_operation("subscription").nil? - add_error('Schema is not configured for subscriptions', node, extensions: { - "rule": "StaticValidation::SubscriptionRootExists" - }) + add_error(GraphQL::StaticValidation::SubscriptionRootExistsError.new( + 'Schema is not configured for subscriptions', + nodes: node + )) else super end diff --git a/lib/graphql/static_validation/rules/subscription_root_exists_error.rb b/lib/graphql/static_validation/rules/subscription_root_exists_error.rb new file mode 100644 index 0000000000..1807993f20 --- /dev/null +++ b/lib/graphql/static_validation/rules/subscription_root_exists_error.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class SubscriptionRootExistsError < Message + + def initialize(message, path: nil, nodes: []) + super(message, path: path, nodes: nodes) + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "missingSubscriptionConfiguration" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/unique_directives_per_location.rb b/lib/graphql/static_validation/rules/unique_directives_per_location.rb index 2d25c207f2..a04ee2862c 100644 --- a/lib/graphql/static_validation/rules/unique_directives_per_location.rb +++ b/lib/graphql/static_validation/rules/unique_directives_per_location.rb @@ -35,14 +35,11 @@ def validate_directive_location(node) node.directives.each do |ast_directive| directive_name = ast_directive.name if used_directives[directive_name] - add_error( + add_error(GraphQL::StaticValidation::UniqueDirectivesPerLocationError.new( "The directive \"#{directive_name}\" can only be used once at this location.", - [used_directives[directive_name], ast_directive], - extensions: { - "rule": "StaticValidation::UniqueDirectivesPerLocation", - "directive": directive_name - } - ) + nodes: [used_directives[directive_name], ast_directive], + directive: directive_name, + )) else used_directives[directive_name] = ast_directive end diff --git a/lib/graphql/static_validation/rules/unique_directives_per_location_error.rb b/lib/graphql/static_validation/rules/unique_directives_per_location_error.rb new file mode 100644 index 0000000000..b05226f645 --- /dev/null +++ b/lib/graphql/static_validation/rules/unique_directives_per_location_error.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class UniqueDirectivesPerLocationError < Message + attr_reader :directive_name + + def initialize(message, path: nil, nodes: [], directive:) + super(message, path: path, nodes: nodes) + @directive_name = directive + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "directiveName" => directive_name + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "directiveNotUniqueForLocation" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb b/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb index fda140eae3..d8320c1b65 100644 --- a/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb +++ b/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb @@ -6,10 +6,12 @@ def on_variable_definition(node, parent) if !node.default_value.nil? value = node.default_value if node.type.is_a?(GraphQL::Language::Nodes::NonNullType) - add_error("Non-null variable $#{node.name} can't have a default value", node, extensions: { - "rule": "StaticValidation::VariableDefaultValuesAreCorrectlyTyped", - "name": node.name - }) + add_error(GraphQL::StaticValidation::VariableDefaultValuesAreCorrectlyTypedError.new( + "Non-null variable $#{node.name} can't have a default value", + nodes: node, + name: node.name, + error_type: VariableDefaultValuesAreCorrectlyTypedError::VIOLATIONS[:INVALID_ON_NON_NULL] + )) else type = context.schema.type_from_ast(node.type) if type.nil? @@ -23,11 +25,14 @@ def on_variable_definition(node, parent) if !valid error_message ||= "Default value for $#{node.name} doesn't match type #{type}" - add_error(error_message, node, extensions: { - "rule": "StaticValidation::VariableDefaultValuesAreCorrectlyTyped", - "name": node.name, - "type": type.to_s - }) + VariableDefaultValuesAreCorrectlyTypedError + add_error(GraphQL::StaticValidation::VariableDefaultValuesAreCorrectlyTypedError.new( + error_message, + nodes: node, + name: node.name, + type: type.to_s, + error_type: VariableDefaultValuesAreCorrectlyTypedError::VIOLATIONS[:INVALID_TYPE] + )) end end end diff --git a/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb b/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb new file mode 100644 index 0000000000..c852f0d186 --- /dev/null +++ b/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class VariableDefaultValuesAreCorrectlyTypedError < Message + attr_reader :variable_name + attr_reader :type_name + attr_reader :violation + + VIOLATIONS = { + :INVALID_TYPE => "defaultValueInvalidType", + :INVALID_ON_NON_NULL => "defaultValueInvalidOnNonNullVariable", + } + + def initialize(message, path: nil, nodes: [], name:, type: nil, error_type:) + super(message, path: path, nodes: nodes) + @variable_name = name + @type_name = type + raise("Unexpected error type: #{error_type}") if !VIOLATIONS.values.include?(error_type) + @violation = error_type + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "variableName" => variable_name + }.tap { |h| h["typeName"] = type_name unless type_name.nil? } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + @violation + end + end + end +end diff --git a/lib/graphql/static_validation/rules/variable_names_are_unique.rb b/lib/graphql/static_validation/rules/variable_names_are_unique.rb index 876c7dffc3..8870846771 100644 --- a/lib/graphql/static_validation/rules/variable_names_are_unique.rb +++ b/lib/graphql/static_validation/rules/variable_names_are_unique.rb @@ -9,10 +9,11 @@ def on_operation_definition(node, parent) var_defns.each { |v| vars_by_name[v.name] << v } vars_by_name.each do |name, defns| if defns.size > 1 - add_error("There can only be one variable named \"#{name}\"", defns, extensions: { - "rule": "StaticValidation::VariableNamesAreUnique", - "name": name - }) + add_error(GraphQL::StaticValidation::VariableNamesAreUniqueError.new( + "There can only be one variable named \"#{name}\"", + nodes: defns, + name: name + )) end end end diff --git a/lib/graphql/static_validation/rules/variable_names_are_unique_error.rb b/lib/graphql/static_validation/rules/variable_names_are_unique_error.rb new file mode 100644 index 0000000000..e2be306e43 --- /dev/null +++ b/lib/graphql/static_validation/rules/variable_names_are_unique_error.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class VariableNamesAreUniqueError < Message + attr_reader :variable_name + + def initialize(message, path: nil, nodes: [], name:) + super(message, path: path, nodes: nodes) + @variable_name = name + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "variableName" => variable_name + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "variableNotUnique" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb b/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb index 1c57e52171..1e76d0cc08 100644 --- a/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb +++ b/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb @@ -84,13 +84,14 @@ def validate_usage(arguments, arg_node, ast_var) end def create_error(error_message, var_type, ast_var, arg_defn, arg_node) - add_error("#{error_message} on variable $#{ast_var.name} and argument #{arg_node.name} (#{var_type.to_s} / #{arg_defn.type.to_s})", arg_node, extensions: { - "rule": "StaticValidation::VariableUsagesAreAllowed", - "variable": ast_var.name, - "type": var_type.to_s, - "argument": arg_node.name, - "error": error_message - }) + add_error(GraphQL::StaticValidation::VariableUsagesAreAllowedError.new( + "#{error_message} on variable $#{ast_var.name} and argument #{arg_node.name} (#{var_type.to_s} / #{arg_defn.type.to_s})", + nodes: arg_node, + name: ast_var.name, + type: var_type.to_s, + argument: arg_node.name, + error: error_message + )) end def wrap_var_type_with_depth_of_arg(var_type, arg_node) diff --git a/lib/graphql/static_validation/rules/variable_usages_are_allowed_error.rb b/lib/graphql/static_validation/rules/variable_usages_are_allowed_error.rb new file mode 100644 index 0000000000..5998858d2b --- /dev/null +++ b/lib/graphql/static_validation/rules/variable_usages_are_allowed_error.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class VariableUsagesAreAllowedError < Message + attr_reader :type_name + attr_reader :variable_name + attr_reader :argument_name + attr_reader :error_message + + def initialize(message, path: nil, nodes: [], type:, name:, argument:, error:) + super(message, path: path, nodes: nodes) + @type_name = type + @variable_name = name + @argument_name = argument + @error_message = error + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "variableName" => variable_name, + "typeName" => type_name, + "argumentName" => argument_name, + "errorMessage" => error_message + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "variableMismatch" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/variables_are_input_types.rb b/lib/graphql/static_validation/rules/variables_are_input_types.rb index 2f5d7d7a10..78cebeeca0 100644 --- a/lib/graphql/static_validation/rules/variables_are_input_types.rb +++ b/lib/graphql/static_validation/rules/variables_are_input_types.rb @@ -7,17 +7,19 @@ def on_variable_definition(node, parent) type = context.warden.get_type(type_name) if type.nil? - add_error("#{type_name} isn't a defined input type (on $#{node.name})", node, extensions: { - "rule": "StaticValidation::VariablesAreInputTypes", - "name": node.name, - "type": type_name - }) + add_error(GraphQL::StaticValidation::VariablesAreInputTypesError.new( + "#{type_name} isn't a defined input type (on $#{node.name})", + nodes: node, + name: node.name, + type: type_name + )) elsif !type.kind.input? - add_error("#{type.name} isn't a valid input type (on $#{node.name})", node, extensions: { - "rule": "StaticValidation::VariablesAreInputTypes", - "name": node.name, - "type": type.name - }) + add_error(GraphQL::StaticValidation::VariablesAreInputTypesError.new( + "#{type.name} isn't a valid input type (on $#{node.name})", + nodes: node, + name: node.name, + type: type_name + )) end super diff --git a/lib/graphql/static_validation/rules/variables_are_input_types_error.rb b/lib/graphql/static_validation/rules/variables_are_input_types_error.rb new file mode 100644 index 0000000000..0104899bd3 --- /dev/null +++ b/lib/graphql/static_validation/rules/variables_are_input_types_error.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class VariablesAreInputTypesError < Message + attr_reader :type_name + attr_reader :variable_name + + def initialize(message, path: nil, nodes: [], type:, name:) + super(message, path: path, nodes: nodes) + @type_name = type + @variable_name = name + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "typeName" => type_name, + "variableName" => variable_name + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + "variableRequiresValidType" + end + end + end +end diff --git a/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb b/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb index e32eeba0e1..751edd34b6 100644 --- a/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb +++ b/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb @@ -125,20 +125,28 @@ def create_errors(node_variables) # Declared but not used: node_variables .select { |name, usage| usage.declared? && !usage.used? } - .each { |var_name, usage| add_error("Variable $#{var_name} is declared by #{usage.declared_by.name} but not used", usage.declared_by, path: usage.path, extensions: { - "rule": "StaticValidation::VariablesAreUsedAndDefined", - "variable": var_name, - "usage": "delcared by #{usage.declared_by.name}" - }) } + .each { |var_name, usage| + add_error(GraphQL::StaticValidation::VariablesAreUsedAndDefinedError.new( + "Variable $#{var_name} is declared by #{usage.declared_by.name} but not used", + nodes: usage.declared_by, + path: usage.path, + name: var_name, + error_type: VariablesAreUsedAndDefinedError::VIOLATIONS[:VARIABLE_NOT_USED] + )) + } # Used but not declared: node_variables .select { |name, usage| usage.used? && !usage.declared? } - .each { |var_name, usage| add_error("Variable $#{var_name} is used by #{usage.used_by.name} but not declared", usage.ast_node, path: usage.path, extensions: { - "rule": "StaticValidation::VariablesAreUsedAndDefined", - "variable": var_name, - "usage": "not declared" - }) } + .each { |var_name, usage| + add_error(GraphQL::StaticValidation::VariablesAreUsedAndDefinedError.new( + "Variable $#{var_name} is used by #{usage.used_by.name} but not declared", + nodes: usage.ast_node, + path: usage.path, + name: var_name, + error_type: VariablesAreUsedAndDefinedError::VIOLATIONS[:VARIABLE_NOT_DECLARED] + )) + } end end end diff --git a/lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb b/lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb new file mode 100644 index 0000000000..c371cd9722 --- /dev/null +++ b/lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true +module GraphQL + module StaticValidation + class VariablesAreUsedAndDefinedError < Message + attr_reader :variable_name + attr_reader :violation + + VIOLATIONS = { + :VARIABLE_NOT_USED => "variableNotUsed", + :VARIABLE_NOT_DECLARED => "variableNotDeclared", + } + + def initialize(message, path: nil, nodes: [], name:, error_type:) + super(message, path: path, nodes: nodes) + @variable_name = name + raise("Unexpected error type: #{error_type}") if !VIOLATIONS.values.include?(error_type) + @violation = error_type + end + + # A hash representation of this Message + def to_h + extensions = { + "code" => code, + "variableName" => variable_name + } + + super.merge({ + "extensions" => extensions + }) + end + + private + def code + @violation + end + end + end +end diff --git a/spec/graphql/execution/multiplex_spec.rb b/spec/graphql/execution/multiplex_spec.rb index 015f69a108..596fd3d507 100644 --- a/spec/graphql/execution/multiplex_spec.rb +++ b/spec/graphql/execution/multiplex_spec.rb @@ -95,7 +95,7 @@ def multiplex(*a) "message"=>"Field must have selections (field 'nullableNestedSum' returns LazySum but has no selections. Did you mean 'nullableNestedSum { ... }'?)", "locations"=>[{"line"=>1, "column"=>4}], "path"=>["query", "validationError"], - "extensions"=>{"rule"=>"StaticValidation::FieldsHaveAppropriateSelections", "name"=>"field 'nullableNestedSum'", "type"=>"LazySum"} + "extensions"=>{"code"=>"selectionMismatch", "nodeName"=>"field 'nullableNestedSum'", "typeName"=>"LazySum"} }] }, ] diff --git a/spec/graphql/static_validation/rules/argument_literals_are_compatible_spec.rb b/spec/graphql/static_validation/rules/argument_literals_are_compatible_spec.rb index d1f11633c2..b6522b28b5 100644 --- a/spec/graphql/static_validation/rules/argument_literals_are_compatible_spec.rb +++ b/spec/graphql/static_validation/rules/argument_literals_are_compatible_spec.rb @@ -28,7 +28,7 @@ "message"=>"Argument 'id' on Field 'stringCheese' has an invalid value. Expected type 'Int!'.", "locations"=>[{"line"=>3, "column"=>7}], "path"=>["query getCheese", "stringCheese", "id"], - "extensions"=> {"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"id", "type"=>"Field"} + "extensions"=>{"code"=>"argumentLiteralsIncompatible", "typeName"=>"Field", "argumentName"=>"id"} } assert_includes(errors, query_root_error) @@ -36,7 +36,7 @@ "message"=>"Argument 'if' on Directive 'skip' has an invalid value. Expected type 'Boolean!'.", "locations"=>[{"line"=>4, "column"=>30}], "path"=>["query getCheese", "cheese", "source", "if"], - "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"if", "type"=>"Directive"} + "extensions"=>{"code"=>"argumentLiteralsIncompatible", "typeName"=>"Directive", "argumentName"=>"if"} } assert_includes(errors, directive_error) @@ -44,7 +44,7 @@ "message"=>"Argument 'product' on Field 'badSource' has an invalid value. Expected type '[DairyProductInput]'.", "locations"=>[{"line"=>6, "column"=>7}], "path"=>["query getCheese", "badSource", "product"], - "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"product", "type"=>"Field"} + "extensions"=>{"code"=>"argumentLiteralsIncompatible", "typeName"=>"Field", "argumentName"=>"product"} } assert_includes(errors, input_object_error) @@ -52,7 +52,7 @@ "message"=>"Argument 'source' on InputObject 'DairyProductInput' has an invalid value. Expected type 'DairyAnimal!'.", "locations"=>[{"line"=>6, "column"=>40}], "path"=>["query getCheese", "badSource", "product", "source"], - "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"source", "type"=>"InputObject"} + "extensions"=>{"code"=>"argumentLiteralsIncompatible", "typeName"=>"InputObject", "argumentName"=>"source"} } assert_includes(errors, input_object_field_error) @@ -60,7 +60,7 @@ "message"=>"Argument 'product' on Field 'missingSource' has an invalid value. Expected type '[DairyProductInput]'.", "locations"=>[{"line"=>7, "column"=>7}], "path"=>["query getCheese", "missingSource", "product"], - "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"product", "type"=>"Field"} + "extensions"=>{"code"=>"argumentLiteralsIncompatible", "typeName"=>"Field", "argumentName"=>"product"} } assert_includes(errors, missing_required_field_error) @@ -68,7 +68,7 @@ "message"=>"Argument 'source' on Field 'similarCheese' has an invalid value. Expected type '[DairyAnimal!]!'.", "locations"=>[{"line"=>13, "column"=>7}], "path"=>["fragment cheeseFields", "similarCheese", "source"], - "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"source", "type"=>"Field"} + "extensions"=> {"code"=>"argumentLiteralsIncompatible", "typeName"=>"Field", "argumentName"=>"source"} } assert_includes(errors, fragment_error) end @@ -127,7 +127,7 @@ "message"=>"Argument 'arg' on Field 'field' has an invalid value. Expected type 'Int!'.", "locations"=>[{"line"=>3, "column"=>11}], "path"=>["query", "field", "arg"], - "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"arg", "type"=>"Field"} + "extensions"=>{"code"=>"argumentLiteralsIncompatible", "typeName"=>"Field", "argumentName"=>"arg"} }], errors end end @@ -151,7 +151,7 @@ "message"=>"Argument 'arg' on Field 'field' has an invalid value. Expected type '[Int!]'.", "locations"=>[{"line"=>3, "column"=>11}], "path"=>["query", "field", "arg"], - "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"arg", "type"=>"Field"} + "extensions"=>{"code"=>"argumentLiteralsIncompatible", "typeName"=>"Field", "argumentName"=>"arg"} }], errors end end @@ -201,14 +201,14 @@ "message"=> "Argument 'arg' on Field 'field' has an invalid value. Expected type 'Input'.", "locations"=>[{"line"=>3, "column"=>11}], "path"=>["query", "field", "arg"], - "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"arg", "type"=>"Field"} + "extensions"=>{"code"=>"argumentLiteralsIncompatible", "typeName"=>"Field", "argumentName"=>"arg"} } assert_includes errors, { "message"=>"Argument 'b' on InputObject 'Input' has an invalid value. Expected type 'Int!'.", "locations"=>[{"line"=>3, "column"=>22}], "path"=>["query", "field", "arg", "b"], - "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"b", "type"=>"InputObject"} + "extensions"=>{"code"=>"argumentLiteralsIncompatible", "typeName"=>"InputObject", "argumentName"=>"b"} } end end @@ -226,7 +226,7 @@ "message"=>"Argument 'name' on Field '__type' has an invalid value. Expected type 'String!'.", "locations"=>[{"line"=>3, "column"=>9}], "path"=>["query", "__type", "name"], - "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "argument"=>"name", "type"=>"Field"} + "extensions"=>{"code"=>"argumentLiteralsIncompatible", "typeName"=>"Field", "argumentName"=>"name"} }) end end @@ -278,7 +278,7 @@ "message"=> "cannot coerce to Float", "locations"=>[{"line"=>3, "column"=>9}], "path"=>["query", "time", "value"], - "extensions"=>{"rule"=>"StaticValidation::ArgumentLiteralsAreCompatible", "type"=>"CoercionError"} + "extensions"=>{"code"=>"argumentLiteralsIncompatible", "typeName"=>"CoercionError"} } end end diff --git a/spec/graphql/static_validation/rules/arguments_are_defined_spec.rb b/spec/graphql/static_validation/rules/arguments_are_defined_spec.rb index 03dd0da852..bd3b35fa40 100644 --- a/spec/graphql/static_validation/rules/arguments_are_defined_spec.rb +++ b/spec/graphql/static_validation/rules/arguments_are_defined_spec.rb @@ -26,7 +26,7 @@ "message"=>"Field 'cheese' doesn't accept argument 'silly'", "locations"=>[{"line"=>4, "column"=>14}], "path"=>["query getCheese", "cheese", "silly"], - "extensions"=>{"rule"=>"StaticValidation::ArgumentsAreDefined", "type"=>"Field", "name"=>"cheese", "argument"=>"silly"} + "extensions"=>{"code"=>"argumentNotAccepted", "name"=>"cheese", "typeName"=>"Field", "argumentName"=>"silly"} } assert_includes(errors, query_root_error) @@ -34,7 +34,7 @@ "message"=>"InputObject 'DairyProductInput' doesn't accept argument 'wacky'", "locations"=>[{"line"=>5, "column"=>30}], "path"=>["query getCheese", "searchDairy", "product", "wacky"], - "extensions"=>{"rule"=>"StaticValidation::ArgumentsAreDefined", "type"=>"InputObject", "name"=>"DairyProductInput", "argument"=>"wacky"} + "extensions"=>{"code"=>"argumentNotAccepted", "name"=>"DairyProductInput", "typeName"=>"InputObject", "argumentName"=>"wacky"} } assert_includes(errors, input_obj_record) @@ -42,7 +42,7 @@ "message"=>"Field 'similarCheese' doesn't accept argument 'nonsense'", "locations"=>[{"line"=>9, "column"=>36}], "path"=>["fragment cheeseFields", "similarCheese", "nonsense"], - "extensions"=>{"rule"=>"StaticValidation::ArgumentsAreDefined", "type"=>"Field", "name"=>"similarCheese", "argument"=>"nonsense"} + "extensions"=>{"code"=>"argumentNotAccepted", "name"=>"similarCheese", "typeName"=>"Field", "argumentName"=>"nonsense"} } assert_includes(errors, fragment_error) @@ -50,7 +50,7 @@ "message"=>"Directive 'skip' doesn't accept argument 'something'", "locations"=>[{"line"=>10, "column"=>16}], "path"=>["fragment cheeseFields", "id", "something"], - "extensions"=>{"rule"=>"StaticValidation::ArgumentsAreDefined", "type"=>"Directive", "name"=>"skip", "argument"=>"something"} + "extensions"=>{"code"=>"argumentNotAccepted", "name"=>"skip", "typeName"=>"Directive", "argumentName"=>"something"} } assert_includes(errors, directive_error) end @@ -67,7 +67,7 @@ "message"=>"Field '__type' doesn't accept argument 'somethingInvalid'", "locations"=>[{"line"=>3, "column"=>16}], "path"=>["query", "__type", "somethingInvalid"], - "extensions"=> {"rule"=>"StaticValidation::ArgumentsAreDefined", "type"=>"Field", "name"=>"__type", "argument"=>"somethingInvalid"} + "extensions"=>{"code"=>"argumentNotAccepted", "name"=>"__type", "typeName"=>"Field", "argumentName"=>"somethingInvalid"} }) end end diff --git a/spec/graphql/static_validation/rules/directives_are_defined_spec.rb b/spec/graphql/static_validation/rules/directives_are_defined_spec.rb index 29456fc2ea..fa8899be1e 100644 --- a/spec/graphql/static_validation/rules/directives_are_defined_spec.rb +++ b/spec/graphql/static_validation/rules/directives_are_defined_spec.rb @@ -21,12 +21,12 @@ "message"=>"Directive @nonsense is not defined", "locations"=>[{"line"=>5, "column"=>16}], "path"=>["query getCheese", "okCheese", "source"], - "extensions"=>{"rule"=>"StaticValidation::DirectivesAreDefined", "directive"=>"nonsense"} + "extensions"=>{"code"=>"undefinedDirective", "directiveName"=>"nonsense"} }, { "message"=>"Directive @moreNonsense is not defined", "locations"=>[{"line"=>7, "column"=>18}], "path"=>["query getCheese", "okCheese", "... on Cheese", "flavor"], - "extensions"=>{"rule"=>"StaticValidation::DirectivesAreDefined", "directive"=>"moreNonsense"} + "extensions"=>{"code"=>"undefinedDirective", "directiveName"=>"moreNonsense"} } ] assert_equal(expected, errors) diff --git a/spec/graphql/static_validation/rules/directives_are_in_valid_locations_spec.rb b/spec/graphql/static_validation/rules/directives_are_in_valid_locations_spec.rb index f0a172af54..50a01970f9 100644 --- a/spec/graphql/static_validation/rules/directives_are_in_valid_locations_spec.rb +++ b/spec/graphql/static_validation/rules/directives_are_in_valid_locations_spec.rb @@ -27,13 +27,13 @@ "message"=> "'@skip' can't be applied to queries (allowed: fields, fragment spreads, inline fragments)", "locations"=>[{"line"=>2, "column"=>21}], "path"=>["query getCheese"], - "extensions"=>{"rule"=>"StaticValidation::DirectivesAreInValidLocations", "name"=>"skip", "target"=>"queries"} + "extensions"=>{"code"=>"directiveCannotBeApplied", "targetName"=>"queries", "name"=>"skip"} }, { "message"=>"'@skip' can't be applied to fragment definitions (allowed: fields, fragment spreads, inline fragments)", "locations"=>[{"line"=>13, "column"=>33}], "path"=>["fragment whatever"], - "extensions"=>{"rule"=>"StaticValidation::DirectivesAreInValidLocations", "name"=>"skip", "target"=>"fragment definitions"} + "extensions"=>{"code"=>"directiveCannotBeApplied", "targetName"=>"fragment definitions", "name"=>"skip"} }, ] assert_equal(expected, errors) diff --git a/spec/graphql/static_validation/rules/fields_are_defined_on_type_spec.rb b/spec/graphql/static_validation/rules/fields_are_defined_on_type_spec.rb index e3a04dad85..4f02b93067 100644 --- a/spec/graphql/static_validation/rules/fields_are_defined_on_type_spec.rb +++ b/spec/graphql/static_validation/rules/fields_are_defined_on_type_spec.rb @@ -32,7 +32,7 @@ "message"=>"Field 'notDefinedField' doesn't exist on type 'Query'", "locations"=>[{"line"=>1, "column"=>18}], "path"=>["query getStuff", "notDefinedField"], - "extensions"=>{"rule"=>"StaticValidation::FieldsAreDefinedOnType", "field"=>"notDefinedField", "type"=>"Query"} + "extensions"=>{"code"=>"undefinedField", "typeName"=>"Query", "fieldName"=>"notDefinedField"} } ] assert_equal(expected_errors, errors) @@ -48,7 +48,7 @@ "message"=>"Field 'amountThatILikeIt' doesn't exist on type 'Edible'", "locations"=>[{"line"=>1, "column"=>35}], "path"=>["query getStuff", "favoriteEdible", "amountThatILikeIt"], - "extensions"=>{"rule"=>"StaticValidation::FieldsAreDefinedOnType", "field"=>"amountThatILikeIt", "type"=>"Edible"} + "extensions"=>{"code"=>"undefinedField", "typeName"=>"Edible", "fieldName"=>"amountThatILikeIt"} } ] assert_equal(expected_errors, errors) @@ -70,6 +70,7 @@ {"line"=>3, "column"=>7} ], "path"=>["fragment dpFields", "source"], + "extensions"=>{"code"=>"selectionMismatch", "nodeName"=>"DairyProduct"} } ] assert_equal(expected_errors, errors) @@ -123,7 +124,7 @@ {"line"=>2, "column"=>33} ], "path"=>["query", "cheese", "__schema"], - "extensions"=>{"rule"=>"StaticValidation::FieldsAreDefinedOnType", "field"=>"__schema", "type"=>"Cheese"} + "extensions"=>{"code"=>"undefinedField", "typeName"=>"Cheese", "fieldName"=>"__schema"} } ] assert_equal(expected_errors, errors) @@ -155,7 +156,7 @@ {"line"=>2, "column"=>33} ], "path"=>["query", "cheese", "__type"], - "extensions"=>{"rule"=>"StaticValidation::FieldsAreDefinedOnType", "field"=>"__type", "type"=>"Cheese"} + "extensions"=>{"code"=>"undefinedField", "typeName"=>"Cheese", "fieldName"=>"__type"} } ] assert_equal(expected_errors, errors) diff --git a/spec/graphql/static_validation/rules/fields_have_appropriate_selections_spec.rb b/spec/graphql/static_validation/rules/fields_have_appropriate_selections_spec.rb index 891ea7757d..a9881ec357 100644 --- a/spec/graphql/static_validation/rules/fields_have_appropriate_selections_spec.rb +++ b/spec/graphql/static_validation/rules/fields_have_appropriate_selections_spec.rb @@ -20,7 +20,7 @@ "message"=>"Selections can't be made on scalars (field 'id' returns Int but has selections [something, someFields])", "locations"=>[{"line"=>6, "column"=>47}], "path"=>["query getCheese", "illegalSelectionCheese", "id"], - "extensions"=>{"rule"=>"StaticValidation::FieldsHaveAppropriateSelections", "name"=>"field 'id'", "type"=>"Int"} + "extensions"=>{"code"=>"selectionMismatch", "nodeName"=>"field 'id'", "typeName"=>"Int"} } assert_includes(errors, illegal_selection_error, "finds illegal selections on scalars") @@ -28,7 +28,7 @@ "message"=>"Field must have selections (field 'cheese' returns Cheese but has no selections. Did you mean 'cheese { ... }'?)", "locations"=>[{"line"=>4, "column"=>7}], "path"=>["query getCheese", "missingFieldsObject"], - "extensions"=>{"rule"=>"StaticValidation::FieldsHaveAppropriateSelections", "name"=>"field 'cheese'", "type"=>"Cheese"} + "extensions"=>{"code"=>"selectionMismatch", "nodeName"=>"field 'cheese'", "typeName"=>"Cheese"} } assert_includes(errors, objects_selection_required_error, "finds objects without selections") @@ -36,7 +36,7 @@ "message"=>"Field must have selections (field 'selfAsEdible' returns Edible but has no selections. Did you mean 'selfAsEdible { ... }'?)", "locations"=>[{"line"=>5, "column"=>47}], "path"=>["query getCheese", "missingFieldsInterface", "selfAsEdible"], - "extensions"=>{"rule"=>"StaticValidation::FieldsHaveAppropriateSelections", "name"=>"field 'selfAsEdible'", "type"=>"Edible"} + "extensions"=>{"code"=>"selectionMismatch", "nodeName"=>"field 'selfAsEdible'", "typeName"=>"Edible"} } assert_includes(errors, interfaces_selection_required_error, "finds interfaces without selections") @@ -44,7 +44,7 @@ "message"=>"Selections can't be made on scalars (field 'flavor' returns String but has inline fragments [String])", "locations"=>[{"line"=>7, "column"=>48}], "path"=>["query getCheese", "incorrectFragmentSpread", "flavor"], - "extensions"=>{"rule"=>"StaticValidation::FieldsHaveAppropriateSelections", "name"=>"field 'flavor'", "type"=>"String"} + "extensions"=>{"code"=>"selectionMismatch", "nodeName"=>"field 'flavor'", "typeName"=>"String"} } assert_includes(errors, incorrect_fragment_error, "finds scalar fields with selections") end @@ -58,7 +58,7 @@ "message"=> "Field must have selections (anonymous query returns Query but has no selections. Did you mean ' { ... }'?)", "locations"=>[{"line"=>1, "column"=>1}], "path"=>["query"], - "extensions"=>{"rule"=>"StaticValidation::FieldsHaveAppropriateSelections", "name"=>"anonymous query", "type"=>"Query"} + "extensions"=>{"code"=>"selectionMismatch", "nodeName"=>"anonymous query", "typeName"=>"Query"} } assert_includes(errors, selections_required_error) end diff --git a/spec/graphql/static_validation/rules/fields_will_merge_spec.rb b/spec/graphql/static_validation/rules/fields_will_merge_spec.rb index cf8aeb12b3..327ab63a92 100644 --- a/spec/graphql/static_validation/rules/fields_will_merge_spec.rb +++ b/spec/graphql/static_validation/rules/fields_will_merge_spec.rb @@ -381,7 +381,8 @@ {"line"=>4, "column"=>11}, {"line"=>8, "column"=>11} ], - "path"=>[] + "path"=>[], + "extensions"=>{"code"=>"fieldConflict", "fieldName"=>"x", "conflicts"=>"name or nickname"} } ] assert_equal expected_errors, errors diff --git a/spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb b/spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb index b19152745a..9ec4f659ba 100644 --- a/spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb +++ b/spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb @@ -21,7 +21,7 @@ "message"=>"Fragment name \"frag1\" must be unique", "locations"=>[{"line"=>8, "column"=>5}, {"line"=>9, "column"=>5}], "path"=>[], - "extensions"=>{"rule"=>"StaticValidation::FragmentNamesAreUnique", "name"=>"frag1"} + "extensions"=>{"code"=>"fragmentNotUnique", "fragmentName"=>"frag1"} } assert_includes(errors, fragment_def_error) end diff --git a/spec/graphql/static_validation/rules/fragment_spreads_are_possible_spec.rb b/spec/graphql/static_validation/rules/fragment_spreads_are_possible_spec.rb index 9fc7f3f6e7..7e5bc2867f 100644 --- a/spec/graphql/static_validation/rules/fragment_spreads_are_possible_spec.rb +++ b/spec/graphql/static_validation/rules/fragment_spreads_are_possible_spec.rb @@ -32,19 +32,19 @@ "message"=>"Fragment on Milk can't be spread inside Cheese", "locations"=>[{"line"=>6, "column"=>9}], "path"=>["query getCheese", "cheese", "... on Milk"], - "extensions"=>{"rule"=>"StaticValidation::FragmentSpreadsArePossible", "name"=>"", "type"=>"Milk", "parent"=>"Cheese"} + "extensions"=>{"code"=>"cannotSpreadFragment", "typeName"=>"Milk", "fragmentName"=>"unknown", "parentName"=>"Cheese"} }, { "message"=>"Fragment milkFields on Milk can't be spread inside Cheese", "locations"=>[{"line"=>4, "column"=>9}], "path"=>["query getCheese", "cheese", "... milkFields"], - "extensions"=>{"rule"=>"StaticValidation::FragmentSpreadsArePossible", "name"=>" milkFields", "type"=>"Milk", "parent"=>"Cheese"} + "extensions"=>{"code"=>"cannotSpreadFragment", "typeName"=>"Milk", "fragmentName"=>" milkFields", "parentName"=>"Cheese"} }, { "message"=>"Fragment milkFields on Milk can't be spread inside Cheese", "locations"=>[{"line"=>18, "column"=>7}], "path"=>["fragment cheeseFields", "... milkFields"], - "extensions"=>{"rule"=>"StaticValidation::FragmentSpreadsArePossible", "name"=>" milkFields", "type"=>"Milk", "parent"=>"Cheese"} + "extensions"=>{"code"=>"cannotSpreadFragment", "typeName"=>"Milk", "fragmentName"=>" milkFields", "parentName"=>"Cheese"} } ] assert_equal(expected, errors) diff --git a/spec/graphql/static_validation/rules/fragment_types_exist_spec.rb b/spec/graphql/static_validation/rules/fragment_types_exist_spec.rb index 24cc52e0cf..d895b27544 100644 --- a/spec/graphql/static_validation/rules/fragment_types_exist_spec.rb +++ b/spec/graphql/static_validation/rules/fragment_types_exist_spec.rb @@ -28,14 +28,14 @@ "message"=>"No such type Something, so it can't be a fragment condition", "locations"=>[{"line"=>11, "column"=>5}], "path"=>["fragment somethingFields"], - "extensions"=>{"rule"=>"StaticValidation::FragmentTypesExist", "type"=>"Something"} + "extensions"=>{"code"=>"undefinedType", "typeName"=>"Something"} } assert_includes(errors, inline_fragment_error, "on inline fragments") fragment_def_error = { "message"=>"No such type Nothing, so it can't be a fragment condition", "locations"=>[{"line"=>5, "column"=>9}], "path"=>["query getCheese", "cheese", "... on Nothing"], - "extensions"=>{"rule"=>"StaticValidation::FragmentTypesExist", "type"=>"Nothing"} + "extensions"=>{"code"=>"undefinedType", "typeName"=>"Nothing"} } assert_includes(errors, fragment_def_error, "on fragment definitions") end diff --git a/spec/graphql/static_validation/rules/fragments_are_finite_spec.rb b/spec/graphql/static_validation/rules/fragments_are_finite_spec.rb index 795c813fca..538742f17c 100644 --- a/spec/graphql/static_validation/rules/fragments_are_finite_spec.rb +++ b/spec/graphql/static_validation/rules/fragments_are_finite_spec.rb @@ -39,11 +39,13 @@ "message"=>"Fragment sourceField contains an infinite loop", "locations"=>[{"line"=>12, "column"=>5}], "path"=>["fragment sourceField"], + "extensions"=>{"code"=>"infiniteLoop", "fragmentName"=>"sourceField"} }, { "message"=>"Fragment flavorField contains an infinite loop", "locations"=>[{"line"=>17, "column"=>5}], "path"=>["fragment flavorField"], + "extensions"=>{"code"=>"infiniteLoop", "fragmentName"=>"flavorField"} } ] assert_equal(expected, errors) diff --git a/spec/graphql/static_validation/rules/fragments_are_named_spec.rb b/spec/graphql/static_validation/rules/fragments_are_named_spec.rb index 1594e66efa..23fdb5d682 100644 --- a/spec/graphql/static_validation/rules/fragments_are_named_spec.rb +++ b/spec/graphql/static_validation/rules/fragments_are_named_spec.rb @@ -17,7 +17,7 @@ "message"=>"Fragment definition has no name", "locations"=>[{"line"=>2, "column"=>5}], "path"=>["fragment "], - "extensions"=>{"rule"=>"StaticValidation::FragmentsAreNamed"} + "extensions"=>{"code"=>"anonymousFragment"} } assert_includes(errors, fragment_def_error, "on fragment definitions") end diff --git a/spec/graphql/static_validation/rules/fragments_are_on_composite_types_spec.rb b/spec/graphql/static_validation/rules/fragments_are_on_composite_types_spec.rb index 27682f9539..3fa06a0205 100644 --- a/spec/graphql/static_validation/rules/fragments_are_on_composite_types_spec.rb +++ b/spec/graphql/static_validation/rules/fragments_are_on_composite_types_spec.rb @@ -36,19 +36,19 @@ "message"=>"Invalid fragment on type Boolean (must be Union, Interface or Object)", "locations"=>[{"line"=>6, "column"=>11}], "path"=>["query getCheese", "cheese", "... on Cheese", "... on Boolean"], - "extensions"=>{"rule"=>"StaticValidation::FragmentsAreOnCompositeTypes", "type"=>"Boolean"} + "extensions"=>{"code"=>"fragmentOnNonCompositeType", "typeName"=>"Boolean"} }, { "message"=>"Invalid fragment on type DairyProductInput (must be Union, Interface or Object)", "locations"=>[{"line"=>16, "column"=>9}], "path"=>["query getCheese", "cheese", "... on DairyProductInput"], - "extensions"=>{"rule"=>"StaticValidation::FragmentsAreOnCompositeTypes", "type"=>"DairyProductInput"} + "extensions"=>{"code"=>"fragmentOnNonCompositeType", "typeName"=>"DairyProductInput"} }, { "message"=>"Invalid fragment on type Int (must be Union, Interface or Object)", "locations"=>[{"line"=>22, "column"=>5}], "path"=>["fragment intFields"], - "extensions"=>{"rule"=>"StaticValidation::FragmentsAreOnCompositeTypes", "type"=>"Int"} + "extensions"=>{"code"=>"fragmentOnNonCompositeType", "typeName"=>"Int"} }, ] assert_equal(expected, errors) diff --git a/spec/graphql/static_validation/rules/fragments_are_used_spec.rb b/spec/graphql/static_validation/rules/fragments_are_used_spec.rb index c544041b97..43b400e826 100644 --- a/spec/graphql/static_validation/rules/fragments_are_used_spec.rb +++ b/spec/graphql/static_validation/rules/fragments_are_used_spec.rb @@ -18,7 +18,7 @@ "message"=>"Fragment unusedFields was defined, but not used", "locations"=>[{"line"=>8, "column"=>5}], "path"=>["fragment unusedFields"], - "extensions"=>{"rule"=>"StaticValidation::FragmentsAreUsed", "fragment"=>"unusedFields"} + "extensions"=>{"code"=>"useAndDefineFragment", "fragmentName"=>"unusedFields"} }) end @@ -27,7 +27,7 @@ "message"=>"Fragment undefinedFields was used, but not defined", "locations"=>[{"line"=>5, "column"=>7}], "path"=>["query getCheese", "... undefinedFields"], - "extensions"=>{"rule"=>"StaticValidation::FragmentsAreUsed", "fragement"=>"undefinedFields"} + "extensions"=>{"code"=>"useAndDefineFragment", "fragmentName"=>"undefinedFields"} }) end diff --git a/spec/graphql/static_validation/rules/mutation_root_exists_spec.rb b/spec/graphql/static_validation/rules/mutation_root_exists_spec.rb index 27d16d0f1a..20eea54953 100644 --- a/spec/graphql/static_validation/rules/mutation_root_exists_spec.rb +++ b/spec/graphql/static_validation/rules/mutation_root_exists_spec.rb @@ -32,7 +32,7 @@ "message"=>"Schema is not configured for mutations", "locations"=>[{"line"=>2, "column"=>5}], "path"=>["mutation addBagel"], - "extensions"=>{"rule"=>"StaticValidation::MutationRootExists"} + "extensions"=>{"code"=>"missingMutationConfiguration"} } assert_includes(errors, missing_mutation_root_error) end diff --git a/spec/graphql/static_validation/rules/operation_names_are_valid_spec.rb b/spec/graphql/static_validation/rules/operation_names_are_valid_spec.rb index c6a679d259..0db7751d01 100644 --- a/spec/graphql/static_validation/rules/operation_names_are_valid_spec.rb +++ b/spec/graphql/static_validation/rules/operation_names_are_valid_spec.rb @@ -26,7 +26,7 @@ "message"=>"Operation name is required when multiple operations are present", "locations"=>[{"line"=>5, "column"=>5}, {"line"=>9, "column"=>5}], "path"=>[], - "extensions"=>{"rule"=>"StaticValidation::OperationNamesAreValid"} + "extensions"=>{"code"=>"uniquelyNamedOperations"} } assert_includes(errors, requires_name_error) end @@ -50,7 +50,7 @@ "message"=>"Operation name is required when multiple operations are present", "locations"=>[{"line"=>1, "column"=>5}, {"line"=>5, "column"=>5}], "path"=>[], - "extensions"=>{"rule"=>"StaticValidation::OperationNamesAreValid"} + "extensions"=>{"code"=>"uniquelyNamedOperations"} } assert_includes(errors, requires_name_error) end @@ -74,7 +74,7 @@ "message"=>'Operation name "getCheese" must be unique', "locations"=>[{"line"=>1, "column"=>5}, {"line"=>5, "column"=>5}], "path"=>[], - "extensions"=>{"rule"=>"StaticValidation::OperationNamesAreValid", "name"=>"getCheese"} + "extensions"=>{"code"=>"uniquelyNamedOperations", "operationName"=>"getCheese"} } assert_includes(errors, name_uniqueness_error) end diff --git a/spec/graphql/static_validation/rules/required_arguments_are_present_spec.rb b/spec/graphql/static_validation/rules/required_arguments_are_present_spec.rb index defc2e0c59..4d34cc0685 100644 --- a/spec/graphql/static_validation/rules/required_arguments_are_present_spec.rb +++ b/spec/graphql/static_validation/rules/required_arguments_are_present_spec.rb @@ -23,7 +23,7 @@ "message"=>"Field 'cheese' is missing required arguments: id", "locations"=>[{"line"=>4, "column"=>7}], "path"=>["query getCheese", "cheese"], - "extensions"=>{"rule"=>"StaticValidation::RequiredArgumentsArePresent", "class"=>"Field", "name"=>"cheese", "arguments"=>"id"} + "extensions"=>{"code"=>"missingRequiredArguments", "className"=>"Field", "name"=>"cheese", "arguments"=>"id"} } assert_includes(errors, query_root_error) @@ -31,7 +31,7 @@ "message"=>"Field 'similarCheese' is missing required arguments: source", "locations"=>[{"line"=>8, "column"=>7}], "path"=>["fragment cheeseFields", "similarCheese"], - "extensions"=>{"rule"=>"StaticValidation::RequiredArgumentsArePresent", "class"=>"Field", "name"=>"similarCheese", "arguments"=>"source"} + "extensions"=>{"code"=>"missingRequiredArguments", "className"=>"Field", "name"=>"similarCheese", "arguments"=>"source"} } assert_includes(errors, fragment_error) @@ -39,7 +39,7 @@ "message"=>"Directive 'skip' is missing required arguments: if", "locations"=>[{"line"=>10, "column"=>10}], "path"=>["fragment cheeseFields", "id"], - "extensions"=>{"rule"=>"StaticValidation::RequiredArgumentsArePresent", "class"=>"Directive", "name"=>"skip", "arguments"=>"if"} + "extensions"=>{"code"=>"missingRequiredArguments", "className"=>"Directive", "name"=>"skip", "arguments"=>"if"} } assert_includes(errors, directive_error) end @@ -60,8 +60,8 @@ ], "path"=>["query", "__type"], "extensions"=>{ - "rule"=>"StaticValidation::RequiredArgumentsArePresent", - "class"=>"Field", + "code"=>"missingRequiredArguments", + "className"=>"Field", "name"=>"__type", "arguments"=>"name" } diff --git a/spec/graphql/static_validation/rules/subscription_root_exists_spec.rb b/spec/graphql/static_validation/rules/subscription_root_exists_spec.rb index dd814d9b0b..cd008544f5 100644 --- a/spec/graphql/static_validation/rules/subscription_root_exists_spec.rb +++ b/spec/graphql/static_validation/rules/subscription_root_exists_spec.rb @@ -27,7 +27,7 @@ "message"=>"Schema is not configured for subscriptions", "locations"=>[{"line"=>2, "column"=>5}], "path"=>["subscription"], - "extensions"=>{"rule"=>"StaticValidation::SubscriptionRootExists"} + "extensions"=>{"code"=>"missingSubscriptionConfiguration"} } assert_includes(errors, missing_subscription_root_error) end diff --git a/spec/graphql/static_validation/rules/unique_directives_per_location_spec.rb b/spec/graphql/static_validation/rules/unique_directives_per_location_spec.rb index a360640614..c4504538ca 100644 --- a/spec/graphql/static_validation/rules/unique_directives_per_location_spec.rb +++ b/spec/graphql/static_validation/rules/unique_directives_per_location_spec.rb @@ -102,7 +102,7 @@ "message" => 'The directive "A" can only be used once at this location.', "locations" => [{ "line" => 4, "column" => 17 }, { "line" => 4, "column" => 20 }], "path" => ["query", "type", "field"], - "extensions"=>{"rule"=>"StaticValidation::UniqueDirectivesPerLocation", "directive"=>"A"} + "extensions" => {"code"=>"directiveNotUniqueForLocation", "directiveName"=>"A"} } end end @@ -122,14 +122,14 @@ "message" => 'The directive "A" can only be used once at this location.', "locations" => [{ "line" => 4, "column" => 17 }, { "line" => 4, "column" => 20 }], "path" => ["query", "type", "field"], - "extensions"=> {"rule"=>"StaticValidation::UniqueDirectivesPerLocation", "directive"=>"A"} + "extensions" => {"code"=>"directiveNotUniqueForLocation", "directiveName"=>"A"} } assert_includes errors, { "message" => 'The directive "A" can only be used once at this location.', "locations" => [{ "line" => 4, "column" => 17 }, { "line" => 4, "column" => 23 }], "path" => ["query", "type", "field"], - "extensions"=> {"rule"=>"StaticValidation::UniqueDirectivesPerLocation", "directive"=>"A"} + "extensions" => {"code"=>"directiveNotUniqueForLocation", "directiveName"=>"A"} } end end @@ -148,14 +148,14 @@ "message" => 'The directive "A" can only be used once at this location.', "locations" => [{ "line" => 4, "column" => 17 }, { "line" => 4, "column" => 23 }], "path" => ["query", "type", "field"], - "extensions"=>{"rule"=>"StaticValidation::UniqueDirectivesPerLocation", "directive"=>"A"} + "extensions" => {"code"=>"directiveNotUniqueForLocation", "directiveName"=>"A"} } assert_includes errors, { "message" => 'The directive "B" can only be used once at this location.', "locations" => [{ "line" => 4, "column" => 20 }, { "line" => 4, "column" => 26 }], "path" => ["query", "type", "field"], - "extensions"=>{"rule"=>"StaticValidation::UniqueDirectivesPerLocation", "directive"=>"B"} + "extensions" => {"code"=>"directiveNotUniqueForLocation", "directiveName"=>"B"} } end end @@ -174,14 +174,14 @@ "message" => 'The directive "A" can only be used once at this location.', "locations" => [{ "line" => 3, "column" => 14 }, { "line" => 3, "column" => 17 }], "path" => ["query", "type"], - "extensions" => {"rule" => "StaticValidation::UniqueDirectivesPerLocation", "directive" => "A"} + "extensions" => {"code"=>"directiveNotUniqueForLocation", "directiveName"=>"A"} } assert_includes errors, { "message" => 'The directive "A" can only be used once at this location.', "locations" => [{ "line" => 4, "column" => 17 }, { "line" => 4, "column" => 20 }], "path" => ["query", "type", "field"], - "extensions" => {"rule" => "StaticValidation::UniqueDirectivesPerLocation", "directive" => "A"} + "extensions" => {"code"=>"directiveNotUniqueForLocation", "directiveName"=>"A"} } end end diff --git a/spec/graphql/static_validation/rules/variable_default_values_are_correctly_typed_spec.rb b/spec/graphql/static_validation/rules/variable_default_values_are_correctly_typed_spec.rb index 30cf3487e3..99f08cc19f 100644 --- a/spec/graphql/static_validation/rules/variable_default_values_are_correctly_typed_spec.rb +++ b/spec/graphql/static_validation/rules/variable_default_values_are_correctly_typed_spec.rb @@ -30,19 +30,19 @@ "message"=>"Default value for $badInt doesn't match type Int", "locations"=>[{"line"=>6, "column"=>7}], "path"=>["query getCheese"], - "extensions"=>{"rule"=>"StaticValidation::VariableDefaultValuesAreCorrectlyTyped", "name"=>"badInt", "type"=>"Int"} + "extensions"=>{"code"=>"defaultValueInvalidType", "variableName"=>"badInt", "typeName"=>"Int"} }, { "message"=>"Default value for $badInput doesn't match type DairyProductInput", "locations"=>[{"line"=>8, "column"=>7}], "path"=>["query getCheese"], - "extensions"=>{"rule"=>"StaticValidation::VariableDefaultValuesAreCorrectlyTyped", "name"=>"badInput", "type"=>"DairyProductInput"} + "extensions"=>{"code"=>"defaultValueInvalidType", "variableName"=>"badInput", "typeName"=>"DairyProductInput"} }, { "message"=>"Non-null variable $nonNull can't have a default value", "locations"=>[{"line"=>9, "column"=>7}], "path"=>["query getCheese"], - "extensions"=>{"rule"=>"StaticValidation::VariableDefaultValuesAreCorrectlyTyped", "name"=>"nonNull"} + "extensions"=>{"code"=>"defaultValueInvalidOnNonNullVariable", "variableName"=>"nonNull"} } ] assert_equal(expected, errors) @@ -120,19 +120,19 @@ "message"=>"Non-null variable $a can't have a default value", "locations"=>[{"line"=>3, "column"=>11}], "path"=>["query getCheese"], - "extensions"=>{"rule"=>"StaticValidation::VariableDefaultValuesAreCorrectlyTyped", "name"=>"a"} + "extensions"=>{"code"=>"defaultValueInvalidOnNonNullVariable", "variableName"=>"a"} }, { "message"=>"Non-null variable $b can't have a default value", "locations"=>[{"line"=>4, "column"=>11}], "path"=>["query getCheese"], - "extensions"=>{"rule"=>"StaticValidation::VariableDefaultValuesAreCorrectlyTyped", "name"=>"b"} + "extensions"=>{"code"=>"defaultValueInvalidOnNonNullVariable", "variableName"=>"b"} }, { "message"=>"Default value for $c doesn't match type ComplexInput", "locations"=>[{"line"=>5, "column"=>11}], "path"=>["query getCheese"], - "extensions"=>{"rule"=>"StaticValidation::VariableDefaultValuesAreCorrectlyTyped", "name"=>"c", "type"=>"ComplexInput"} + "extensions"=>{"code"=>"defaultValueInvalidType", "variableName"=>"c", "typeName"=>"ComplexInput"} } ] @@ -189,7 +189,7 @@ "message"=> "cannot coerce to Float", "locations"=>[{"line"=>3, "column"=>9}], "path"=>["query"], - "extensions"=>{"rule"=>"StaticValidation::VariableDefaultValuesAreCorrectlyTyped", "name"=>"value", "type"=>"Time"} + "extensions"=>{"code"=>"defaultValueInvalidType", "variableName"=>"value", "typeName"=>"Time"} } end end diff --git a/spec/graphql/static_validation/rules/variable_usages_are_allowed_spec.rb b/spec/graphql/static_validation/rules/variable_usages_are_allowed_spec.rb index e2d551638f..aeb9db7384 100644 --- a/spec/graphql/static_validation/rules/variable_usages_are_allowed_spec.rb +++ b/spec/graphql/static_validation/rules/variable_usages_are_allowed_spec.rb @@ -44,25 +44,25 @@ "message"=>"Nullability mismatch on variable $badInt and argument id (Int / Int!)", "locations"=>[{"line"=>14, "column"=>28}], "path"=>["query getCheese", "badCheese", "id"], - "extensions"=>{"rule"=>"StaticValidation::VariableUsagesAreAllowed", "variable"=>"badInt", "type"=>"Int", "argument"=>"id", "error"=>"Nullability mismatch"} + "extensions"=>{"code"=>"variableMismatch", "variableName"=>"badInt", "typeName"=>"Int", "argumentName"=>"id", "errorMessage"=>"Nullability mismatch"} }, { "message"=>"Type mismatch on variable $badStr and argument id (String! / Int!)", "locations"=>[{"line"=>15, "column"=>28}], "path"=>["query getCheese", "badStrCheese", "id"], - "extensions"=>{"rule"=>"StaticValidation::VariableUsagesAreAllowed", "variable"=>"badStr", "type"=>"String!", "argument"=>"id", "error"=>"Type mismatch"} + "extensions"=>{"code"=>"variableMismatch", "variableName"=>"badStr", "typeName"=>"String!", "argumentName"=>"id", "errorMessage"=>"Type mismatch"} }, { "message"=>"Nullability mismatch on variable $badAnimals and argument source ([DairyAnimal]! / [DairyAnimal!]!)", "locations"=>[{"line"=>18, "column"=>30}], "path"=>["query getCheese", "cheese", "other", "source"], - "extensions"=>{"rule"=>"StaticValidation::VariableUsagesAreAllowed", "variable"=>"badAnimals", "type"=>"[DairyAnimal]!", "argument"=>"source", "error"=>"Nullability mismatch"} + "extensions"=>{"code"=>"variableMismatch", "variableName"=>"badAnimals", "typeName"=>"[DairyAnimal]!", "argumentName"=>"source", "errorMessage"=>"Nullability mismatch"} }, { "message"=>"List dimension mismatch on variable $deepAnimals and argument source ([[DairyAnimal!]!]! / [DairyAnimal!]!)", "locations"=>[{"line"=>19, "column"=>32}], "path"=>["query getCheese", "cheese", "tooDeep", "source"], - "extensions"=>{"rule"=>"StaticValidation::VariableUsagesAreAllowed", "variable"=>"deepAnimals", "type"=>"[[DairyAnimal!]!]!", "argument"=>"source", "error"=>"List dimension mismatch"} + "extensions"=>{"code"=>"variableMismatch", "variableName"=>"deepAnimals", "typeName"=>"[[DairyAnimal!]!]!", "argumentName"=>"source", "errorMessage"=>"List dimension mismatch"} } ] assert_equal(expected, errors) diff --git a/spec/graphql/static_validation/rules/variables_are_input_types_spec.rb b/spec/graphql/static_validation/rules/variables_are_input_types_spec.rb index 6b56c195f4..7c90e80bb7 100644 --- a/spec/graphql/static_validation/rules/variables_are_input_types_spec.rb +++ b/spec/graphql/static_validation/rules/variables_are_input_types_spec.rb @@ -23,28 +23,28 @@ "message"=>"AnimalProduct isn't a valid input type (on $interface)", "locations"=>[{"line"=>5, "column"=>7}], "path"=>["query getCheese"], - "extensions"=>{"rule"=>"StaticValidation::VariablesAreInputTypes", "name"=>"interface", "type"=>"AnimalProduct"} + "extensions"=> {"code"=>"variableRequiresValidType", "typeName"=>"AnimalProduct", "variableName"=>"interface"} }) assert_includes(errors, { "message"=>"Milk isn't a valid input type (on $object)", "locations"=>[{"line"=>6, "column"=>7}], "path"=>["query getCheese"], - "extensions"=>{"rule"=>"StaticValidation::VariablesAreInputTypes", "name"=>"object", "type"=>"Milk"} + "extensions"=>{"code"=>"variableRequiresValidType", "typeName"=>"Milk", "variableName"=>"object"} }) assert_includes(errors, { "message"=>"Cheese isn't a valid input type (on $objects)", "locations"=>[{"line"=>7, "column"=>7}], "path"=>["query getCheese"], - "extensions"=>{"rule"=>"StaticValidation::VariablesAreInputTypes", "name"=>"objects", "type"=>"Cheese"} + "extensions"=>{"code"=>"variableRequiresValidType", "typeName"=>"Cheese", "variableName"=>"objects"} }) assert_includes(errors, { "message"=>"Nonsense isn't a defined input type (on $unknownType)", "locations"=>[{"line"=>8, "column"=>7}], "path"=>["query getCheese"], - "extensions"=>{"rule"=>"StaticValidation::VariablesAreInputTypes", "name"=>"unknownType", "type"=>"Nonsense"} + "extensions"=>{"code"=>"variableRequiresValidType", "typeName"=>"Nonsense", "variableName"=>"unknownType"} }) end diff --git a/spec/graphql/static_validation/rules/variables_are_used_and_defined_spec.rb b/spec/graphql/static_validation/rules/variables_are_used_and_defined_spec.rb index a2402f9703..81214acf9c 100644 --- a/spec/graphql/static_validation/rules/variables_are_used_and_defined_spec.rb +++ b/spec/graphql/static_validation/rules/variables_are_used_and_defined_spec.rb @@ -43,19 +43,19 @@ "message"=>"Variable $notUsedVar is declared by getCheese but not used", "locations"=>[{"line"=>2, "column"=>5}], "path"=>["query getCheese"], - "extensions"=>{"rule"=>"StaticValidation::VariablesAreUsedAndDefined", "variable"=>"notUsedVar", "usage"=>"delcared by getCheese"} + "extensions"=>{"code"=>"variableNotUsed", "variableName"=>"notUsedVar"} }, { "message"=>"Variable $undefinedVar is used by getCheese but not declared", "locations"=>[{"line"=>19, "column"=>22}], "path"=>["query getCheese", "c3", "id"], - "extensions"=>{"rule"=>"StaticValidation::VariablesAreUsedAndDefined", "variable"=>"undefinedVar", "usage"=>"not declared"} + "extensions"=>{"code"=>"variableNotDeclared", "variableName"=>"undefinedVar"} }, { "message"=>"Variable $undefinedFragmentVar is used by innerCheeseFields but not declared", "locations"=>[{"line"=>29, "column"=>22}], "path"=>["fragment innerCheeseFields", "c4", "id"], - "extensions"=>{"rule"=>"StaticValidation::VariablesAreUsedAndDefined", "variable"=>"undefinedFragmentVar", "usage"=>"not declared"} + "extensions"=>{"code"=>"variableNotDeclared", "variableName"=>"undefinedFragmentVar"} }, ] diff --git a/spec/graphql/static_validation/validator_spec.rb b/spec/graphql/static_validation/validator_spec.rb index 6b4dc0bc69..e7e50a45cf 100644 --- a/spec/graphql/static_validation/validator_spec.rb +++ b/spec/graphql/static_validation/validator_spec.rb @@ -35,7 +35,7 @@ "message" => "Variable $undefinedVar is used by but not declared", "locations" => [{"line" => 1, "column" => 14, "filename" => "not_a_real.graphql"}], "path" => ["query", "cheese", "id"], - "extensions"=>{"rule"=>"StaticValidation::VariablesAreUsedAndDefined", "variable"=>"undefinedVar", "usage"=>"not declared"} + "extensions"=>{"code"=>"variableNotDeclared", "variableName"=>"undefinedVar"} }] assert_equal expected_errors, errors end @@ -116,7 +116,8 @@ { "message"=>"Fragment cheeseFields contains an infinite loop", "locations"=>[{"line"=>10, "column"=>9}], - "path"=>["fragment cheeseFields"] + "path"=>["fragment cheeseFields"], + "extensions"=>{"code"=>"infiniteLoop", "fragmentName"=>"cheeseFields"} } ] assert_equal(expected, errors) From 9836b5fea0af2f1c780ece509fd23c898c43c886 Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 3 Dec 2018 17:58:35 +0000 Subject: [PATCH 5/7] Fix up test from branch to new style with extensions/path --- .../graphql/static_validation/rules/fragments_are_used_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/graphql/static_validation/rules/fragments_are_used_spec.rb b/spec/graphql/static_validation/rules/fragments_are_used_spec.rb index c2d88f450f..e6c8ee5fb4 100644 --- a/spec/graphql/static_validation/rules/fragments_are_used_spec.rb +++ b/spec/graphql/static_validation/rules/fragments_are_used_spec.rb @@ -53,7 +53,8 @@ assert_includes(errors, { "message"=>"No such type DoesNotExist, so it can't be a fragment condition", "locations"=>[{"line"=>5, "column"=>7}], - "fields"=>["fragment Invalid"] + "path"=>["fragment Invalid"], + "extensions"=>{"code"=>"undefinedType", "typeName"=>"DoesNotExist"} }) end end From eb83c01b1c1301eb64223c902f1ebd842ae2be92 Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 4 Dec 2018 17:48:12 +0000 Subject: [PATCH 6/7] Rename declared to defined from nit --- .../static_validation/rules/variables_are_used_and_defined.rb | 2 +- .../rules/variables_are_used_and_defined_error.rb | 4 ++-- .../rules/variables_are_used_and_defined_spec.rb | 4 ++-- spec/graphql/static_validation/validator_spec.rb | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb b/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb index 751edd34b6..334fd40c9d 100644 --- a/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb +++ b/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb @@ -144,7 +144,7 @@ def create_errors(node_variables) nodes: usage.ast_node, path: usage.path, name: var_name, - error_type: VariablesAreUsedAndDefinedError::VIOLATIONS[:VARIABLE_NOT_DECLARED] + error_type: VariablesAreUsedAndDefinedError::VIOLATIONS[:VARIABLE_NOT_DEFINED] )) } end diff --git a/lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb b/lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb index c371cd9722..99f3b39813 100644 --- a/lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb +++ b/lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb @@ -6,8 +6,8 @@ class VariablesAreUsedAndDefinedError < Message attr_reader :violation VIOLATIONS = { - :VARIABLE_NOT_USED => "variableNotUsed", - :VARIABLE_NOT_DECLARED => "variableNotDeclared", + :VARIABLE_NOT_USED => "variableNotUsed", + :VARIABLE_NOT_DEFINED => "variableNotDefined", } def initialize(message, path: nil, nodes: [], name:, error_type:) diff --git a/spec/graphql/static_validation/rules/variables_are_used_and_defined_spec.rb b/spec/graphql/static_validation/rules/variables_are_used_and_defined_spec.rb index 81214acf9c..7d332aade1 100644 --- a/spec/graphql/static_validation/rules/variables_are_used_and_defined_spec.rb +++ b/spec/graphql/static_validation/rules/variables_are_used_and_defined_spec.rb @@ -49,13 +49,13 @@ "message"=>"Variable $undefinedVar is used by getCheese but not declared", "locations"=>[{"line"=>19, "column"=>22}], "path"=>["query getCheese", "c3", "id"], - "extensions"=>{"code"=>"variableNotDeclared", "variableName"=>"undefinedVar"} + "extensions"=>{"code"=>"variableNotDefined", "variableName"=>"undefinedVar"} }, { "message"=>"Variable $undefinedFragmentVar is used by innerCheeseFields but not declared", "locations"=>[{"line"=>29, "column"=>22}], "path"=>["fragment innerCheeseFields", "c4", "id"], - "extensions"=>{"code"=>"variableNotDeclared", "variableName"=>"undefinedFragmentVar"} + "extensions"=>{"code"=>"variableNotDefined", "variableName"=>"undefinedFragmentVar"} }, ] diff --git a/spec/graphql/static_validation/validator_spec.rb b/spec/graphql/static_validation/validator_spec.rb index e7e50a45cf..c0f464e8cf 100644 --- a/spec/graphql/static_validation/validator_spec.rb +++ b/spec/graphql/static_validation/validator_spec.rb @@ -35,7 +35,7 @@ "message" => "Variable $undefinedVar is used by but not declared", "locations" => [{"line" => 1, "column" => 14, "filename" => "not_a_real.graphql"}], "path" => ["query", "cheese", "id"], - "extensions"=>{"code"=>"variableNotDeclared", "variableName"=>"undefinedVar"} + "extensions"=>{"code"=>"variableNotDefined", "variableName"=>"undefinedVar"} }] assert_equal expected_errors, errors end From 9a04fd8109f55f42ce7ac7884b4dadb40834db5f Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 4 Dec 2018 18:02:04 +0000 Subject: [PATCH 7/7] Rename `Message` to `Error` --- lib/graphql/query/validation_pipeline.rb | 2 +- lib/graphql/schema.rb | 2 +- lib/graphql/static_validation.rb | 2 +- lib/graphql/static_validation/{message.rb => error.rb} | 10 +++++----- .../rules/argument_literals_are_compatible_error.rb | 2 +- .../rules/argument_names_are_unique.rb | 2 +- .../rules/argument_names_are_unique_error.rb | 2 +- .../rules/arguments_are_defined_error.rb | 2 +- .../rules/directives_are_defined_error.rb | 2 +- .../rules/directives_are_in_valid_locations_error.rb | 2 +- .../rules/fields_are_defined_on_type_error.rb | 2 +- .../rules/fields_have_appropriate_selections.rb | 2 +- .../rules/fields_have_appropriate_selections_error.rb | 2 +- .../static_validation/rules/fields_will_merge_error.rb | 2 +- .../rules/fragment_names_are_unique_error.rb | 2 +- .../rules/fragment_spreads_are_possible_error.rb | 2 +- .../rules/fragment_types_exist_error.rb | 2 +- .../rules/fragments_are_finite_error.rb | 2 +- .../rules/fragments_are_named_error.rb | 2 +- .../rules/fragments_are_on_composite_types_error.rb | 2 +- .../rules/fragments_are_used_error.rb | 2 +- .../rules/mutation_root_exists_error.rb | 2 +- .../rules/no_definitions_are_present.rb | 2 +- .../rules/no_definitions_are_present_error.rb | 2 +- .../rules/operation_names_are_valid_error.rb | 2 +- .../rules/required_arguments_are_present_error.rb | 2 +- .../rules/subscription_root_exists_error.rb | 2 +- .../rules/unique_directives_per_location_error.rb | 2 +- ...ariable_default_values_are_correctly_typed_error.rb | 2 +- .../rules/variable_names_are_unique_error.rb | 2 +- .../rules/variable_usages_are_allowed_error.rb | 2 +- .../rules/variables_are_input_types_error.rb | 2 +- .../rules/variables_are_used_and_defined_error.rb | 2 +- spec/graphql/static_validation/validator_spec.rb | 4 ++-- 34 files changed, 39 insertions(+), 39 deletions(-) rename lib/graphql/static_validation/{message.rb => error.rb} (76%) diff --git a/lib/graphql/query/validation_pipeline.rb b/lib/graphql/query/validation_pipeline.rb index b5d380d61f..8e93f45d57 100644 --- a/lib/graphql/query/validation_pipeline.rb +++ b/lib/graphql/query/validation_pipeline.rb @@ -36,7 +36,7 @@ def valid? @valid end - # @return [Array] Static validation errors for the query string + # @return [Array] Static validation errors for the query string def validation_errors ensure_has_validated @validation_errors diff --git a/lib/graphql/schema.rb b/lib/graphql/schema.rb index ebc454737a..fd077b3bb9 100644 --- a/lib/graphql/schema.rb +++ b/lib/graphql/schema.rb @@ -225,7 +225,7 @@ def using_ast_analysis? # Validate a query string according to this schema. # @param string_or_document [String, GraphQL::Language::Nodes::Document] - # @return [Array] + # @return [Array] def validate(string_or_document, rules: nil) doc = if string_or_document.is_a?(String) GraphQL.parse(string_or_document) diff --git a/lib/graphql/static_validation.rb b/lib/graphql/static_validation.rb index 9727bd0203..0c6518702c 100644 --- a/lib/graphql/static_validation.rb +++ b/lib/graphql/static_validation.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require "graphql/static_validation/message" +require "graphql/static_validation/error" require "graphql/static_validation/definition_dependencies" require "graphql/static_validation/type_stack" require "graphql/static_validation/validator" diff --git a/lib/graphql/static_validation/message.rb b/lib/graphql/static_validation/error.rb similarity index 76% rename from lib/graphql/static_validation/message.rb rename to lib/graphql/static_validation/error.rb index d57930f8b5..7920f69994 100644 --- a/lib/graphql/static_validation/message.rb +++ b/lib/graphql/static_validation/error.rb @@ -2,14 +2,14 @@ module GraphQL module StaticValidation # Generates GraphQL-compliant validation message. - class Message + class Error # Convenience for validators - module MessageHelper - # Error `message` is located at `node` - def message(message, nodes, context: nil, path: nil, extensions: {}) + module ErrorHelper + # Error `error_message` is located at `node` + def error(error_message, nodes, context: nil, path: nil, extensions: {}) path ||= context.path nodes = Array(nodes) - GraphQL::StaticValidation::Message.new(message, nodes: nodes, path: path) + GraphQL::StaticValidation::Error.new(error_message, nodes: nodes, path: path) end end diff --git a/lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb b/lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb index a5ff52be09..55d1e02fdc 100644 --- a/lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb +++ b/lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class ArgumentLiteralsAreCompatibleError < Message + class ArgumentLiteralsAreCompatibleError < StaticValidation::Error attr_reader :type_name attr_reader :argument_name diff --git a/lib/graphql/static_validation/rules/argument_names_are_unique.rb b/lib/graphql/static_validation/rules/argument_names_are_unique.rb index efa6ce5332..bc8fcea305 100644 --- a/lib/graphql/static_validation/rules/argument_names_are_unique.rb +++ b/lib/graphql/static_validation/rules/argument_names_are_unique.rb @@ -2,7 +2,7 @@ module GraphQL module StaticValidation module ArgumentNamesAreUnique - include GraphQL::StaticValidation::Message::MessageHelper + include GraphQL::StaticValidation::Error::ErrorHelper def on_field(node, parent) validate_arguments(node) diff --git a/lib/graphql/static_validation/rules/argument_names_are_unique_error.rb b/lib/graphql/static_validation/rules/argument_names_are_unique_error.rb index 03f0c18d66..18162f67a2 100644 --- a/lib/graphql/static_validation/rules/argument_names_are_unique_error.rb +++ b/lib/graphql/static_validation/rules/argument_names_are_unique_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class ArgumentNamesAreUniqueError < Message + class ArgumentNamesAreUniqueError < StaticValidation::Error attr_reader :name def initialize(message, path: nil, nodes: [], name:) diff --git a/lib/graphql/static_validation/rules/arguments_are_defined_error.rb b/lib/graphql/static_validation/rules/arguments_are_defined_error.rb index 56aa21e5d9..d9c2a621eb 100644 --- a/lib/graphql/static_validation/rules/arguments_are_defined_error.rb +++ b/lib/graphql/static_validation/rules/arguments_are_defined_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class ArgumentsAreDefinedError < Message + class ArgumentsAreDefinedError < StaticValidation::Error attr_reader :name attr_reader :type_name attr_reader :argument_name diff --git a/lib/graphql/static_validation/rules/directives_are_defined_error.rb b/lib/graphql/static_validation/rules/directives_are_defined_error.rb index 7fefa819cb..ac9a5b7ca3 100644 --- a/lib/graphql/static_validation/rules/directives_are_defined_error.rb +++ b/lib/graphql/static_validation/rules/directives_are_defined_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class DirectivesAreDefinedError < Message + class DirectivesAreDefinedError < StaticValidation::Error attr_reader :directive_name def initialize(message, path: nil, nodes: [], directive:) diff --git a/lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb b/lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb index b0483738f6..2a5e1edf70 100644 --- a/lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb +++ b/lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class DirectivesAreInValidLocationsError < Message + class DirectivesAreInValidLocationsError < StaticValidation::Error attr_reader :target_name attr_reader :name diff --git a/lib/graphql/static_validation/rules/fields_are_defined_on_type_error.rb b/lib/graphql/static_validation/rules/fields_are_defined_on_type_error.rb index 26071a57c4..1532803333 100644 --- a/lib/graphql/static_validation/rules/fields_are_defined_on_type_error.rb +++ b/lib/graphql/static_validation/rules/fields_are_defined_on_type_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class FieldsAreDefinedOnTypeError < Message + class FieldsAreDefinedOnTypeError < StaticValidation::Error attr_reader :type_name attr_reader :field_name diff --git a/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb b/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb index c8aca7ab64..1736fdbf07 100644 --- a/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb +++ b/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb @@ -4,7 +4,7 @@ module StaticValidation # Scalars _can't_ have selections # Objects _must_ have selections module FieldsHaveAppropriateSelections - include GraphQL::StaticValidation::Message::MessageHelper + include GraphQL::StaticValidation::Error::ErrorHelper def on_field(node, parent) field_defn = field_definition diff --git a/lib/graphql/static_validation/rules/fields_have_appropriate_selections_error.rb b/lib/graphql/static_validation/rules/fields_have_appropriate_selections_error.rb index 7a5bdef07b..e1f85967e4 100644 --- a/lib/graphql/static_validation/rules/fields_have_appropriate_selections_error.rb +++ b/lib/graphql/static_validation/rules/fields_have_appropriate_selections_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class FieldsHaveAppropriateSelectionsError < Message + class FieldsHaveAppropriateSelectionsError < StaticValidation::Error attr_reader :type_name attr_reader :node_name diff --git a/lib/graphql/static_validation/rules/fields_will_merge_error.rb b/lib/graphql/static_validation/rules/fields_will_merge_error.rb index e2bd9ffb6d..993e50c631 100644 --- a/lib/graphql/static_validation/rules/fields_will_merge_error.rb +++ b/lib/graphql/static_validation/rules/fields_will_merge_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class FieldsWillMergeError < Message + class FieldsWillMergeError < StaticValidation::Error attr_reader :field_name attr_reader :conflicts diff --git a/lib/graphql/static_validation/rules/fragment_names_are_unique_error.rb b/lib/graphql/static_validation/rules/fragment_names_are_unique_error.rb index 5d77dc58bc..9e82c732fc 100644 --- a/lib/graphql/static_validation/rules/fragment_names_are_unique_error.rb +++ b/lib/graphql/static_validation/rules/fragment_names_are_unique_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class FragmentNamesAreUniqueError < Message + class FragmentNamesAreUniqueError < StaticValidation::Error attr_reader :fragment_name def initialize(message, path: nil, nodes: [], name:) diff --git a/lib/graphql/static_validation/rules/fragment_spreads_are_possible_error.rb b/lib/graphql/static_validation/rules/fragment_spreads_are_possible_error.rb index 8d3d420bf9..5b14ec9852 100644 --- a/lib/graphql/static_validation/rules/fragment_spreads_are_possible_error.rb +++ b/lib/graphql/static_validation/rules/fragment_spreads_are_possible_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class FragmentSpreadsArePossibleError < Message + class FragmentSpreadsArePossibleError < StaticValidation::Error attr_reader :type_name attr_reader :fragment_name attr_reader :parent_name diff --git a/lib/graphql/static_validation/rules/fragment_types_exist_error.rb b/lib/graphql/static_validation/rules/fragment_types_exist_error.rb index 38a77731c3..057ed08130 100644 --- a/lib/graphql/static_validation/rules/fragment_types_exist_error.rb +++ b/lib/graphql/static_validation/rules/fragment_types_exist_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class FragmentTypesExistError < Message + class FragmentTypesExistError < StaticValidation::Error attr_reader :type_name def initialize(message, path: nil, nodes: [], type:) diff --git a/lib/graphql/static_validation/rules/fragments_are_finite_error.rb b/lib/graphql/static_validation/rules/fragments_are_finite_error.rb index a4e7e5c6ab..093397ad44 100644 --- a/lib/graphql/static_validation/rules/fragments_are_finite_error.rb +++ b/lib/graphql/static_validation/rules/fragments_are_finite_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class FragmentsAreFiniteError < Message + class FragmentsAreFiniteError < StaticValidation::Error attr_reader :fragment_name def initialize(message, path: nil, nodes: [], name:) diff --git a/lib/graphql/static_validation/rules/fragments_are_named_error.rb b/lib/graphql/static_validation/rules/fragments_are_named_error.rb index fff391c7d0..0b0cfff641 100644 --- a/lib/graphql/static_validation/rules/fragments_are_named_error.rb +++ b/lib/graphql/static_validation/rules/fragments_are_named_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class FragmentsAreNamedError < Message + class FragmentsAreNamedError < StaticValidation::Error def initialize(message, path: nil, nodes: []) super(message, path: path, nodes: nodes) diff --git a/lib/graphql/static_validation/rules/fragments_are_on_composite_types_error.rb b/lib/graphql/static_validation/rules/fragments_are_on_composite_types_error.rb index 29767249ab..523a27b86f 100644 --- a/lib/graphql/static_validation/rules/fragments_are_on_composite_types_error.rb +++ b/lib/graphql/static_validation/rules/fragments_are_on_composite_types_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class FragmentsAreOnCompositeTypesError < Message + class FragmentsAreOnCompositeTypesError < StaticValidation::Error attr_reader :type_name attr_reader :argument_name diff --git a/lib/graphql/static_validation/rules/fragments_are_used_error.rb b/lib/graphql/static_validation/rules/fragments_are_used_error.rb index 38f861e18a..7c398372dc 100644 --- a/lib/graphql/static_validation/rules/fragments_are_used_error.rb +++ b/lib/graphql/static_validation/rules/fragments_are_used_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class FragmentsAreUsedError < Message + class FragmentsAreUsedError < StaticValidation::Error attr_reader :fragment_name def initialize(message, path: nil, nodes: [], fragment:) diff --git a/lib/graphql/static_validation/rules/mutation_root_exists_error.rb b/lib/graphql/static_validation/rules/mutation_root_exists_error.rb index e09ba067f2..cf73a31a24 100644 --- a/lib/graphql/static_validation/rules/mutation_root_exists_error.rb +++ b/lib/graphql/static_validation/rules/mutation_root_exists_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class MutationRootExistsError < Message + class MutationRootExistsError < StaticValidation::Error def initialize(message, path: nil, nodes: []) super(message, path: path, nodes: nodes) diff --git a/lib/graphql/static_validation/rules/no_definitions_are_present.rb b/lib/graphql/static_validation/rules/no_definitions_are_present.rb index c631c6ca2c..7debd19b55 100644 --- a/lib/graphql/static_validation/rules/no_definitions_are_present.rb +++ b/lib/graphql/static_validation/rules/no_definitions_are_present.rb @@ -2,7 +2,7 @@ module GraphQL module StaticValidation module NoDefinitionsArePresent - include GraphQL::StaticValidation::Message::MessageHelper + include GraphQL::StaticValidation::Error::ErrorHelper def initialize(*) super diff --git a/lib/graphql/static_validation/rules/no_definitions_are_present_error.rb b/lib/graphql/static_validation/rules/no_definitions_are_present_error.rb index 3dcd376954..76345b0b9c 100644 --- a/lib/graphql/static_validation/rules/no_definitions_are_present_error.rb +++ b/lib/graphql/static_validation/rules/no_definitions_are_present_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class NoDefinitionsArePresentError < Message + class NoDefinitionsArePresentError < StaticValidation::Error def initialize(message, path: nil, nodes: []) super(message, path: path, nodes: nodes) end diff --git a/lib/graphql/static_validation/rules/operation_names_are_valid_error.rb b/lib/graphql/static_validation/rules/operation_names_are_valid_error.rb index 5efa07b5bb..ec41a37c69 100644 --- a/lib/graphql/static_validation/rules/operation_names_are_valid_error.rb +++ b/lib/graphql/static_validation/rules/operation_names_are_valid_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class OperationNamesAreValidError < Message + class OperationNamesAreValidError < StaticValidation::Error attr_reader :operation_name def initialize(message, path: nil, nodes: [], name: nil) diff --git a/lib/graphql/static_validation/rules/required_arguments_are_present_error.rb b/lib/graphql/static_validation/rules/required_arguments_are_present_error.rb index edda186f99..7f7f79a924 100644 --- a/lib/graphql/static_validation/rules/required_arguments_are_present_error.rb +++ b/lib/graphql/static_validation/rules/required_arguments_are_present_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class RequiredArgumentsArePresentError < Message + class RequiredArgumentsArePresentError < StaticValidation::Error attr_reader :class_name attr_reader :name attr_reader :arguments diff --git a/lib/graphql/static_validation/rules/subscription_root_exists_error.rb b/lib/graphql/static_validation/rules/subscription_root_exists_error.rb index 1807993f20..3f41f4cb9b 100644 --- a/lib/graphql/static_validation/rules/subscription_root_exists_error.rb +++ b/lib/graphql/static_validation/rules/subscription_root_exists_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class SubscriptionRootExistsError < Message + class SubscriptionRootExistsError < StaticValidation::Error def initialize(message, path: nil, nodes: []) super(message, path: path, nodes: nodes) diff --git a/lib/graphql/static_validation/rules/unique_directives_per_location_error.rb b/lib/graphql/static_validation/rules/unique_directives_per_location_error.rb index b05226f645..7d162ea191 100644 --- a/lib/graphql/static_validation/rules/unique_directives_per_location_error.rb +++ b/lib/graphql/static_validation/rules/unique_directives_per_location_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class UniqueDirectivesPerLocationError < Message + class UniqueDirectivesPerLocationError < StaticValidation::Error attr_reader :directive_name def initialize(message, path: nil, nodes: [], directive:) diff --git a/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb b/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb index c852f0d186..e6426aa1e6 100644 --- a/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb +++ b/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class VariableDefaultValuesAreCorrectlyTypedError < Message + class VariableDefaultValuesAreCorrectlyTypedError < StaticValidation::Error attr_reader :variable_name attr_reader :type_name attr_reader :violation diff --git a/lib/graphql/static_validation/rules/variable_names_are_unique_error.rb b/lib/graphql/static_validation/rules/variable_names_are_unique_error.rb index e2be306e43..54cc3cda1e 100644 --- a/lib/graphql/static_validation/rules/variable_names_are_unique_error.rb +++ b/lib/graphql/static_validation/rules/variable_names_are_unique_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class VariableNamesAreUniqueError < Message + class VariableNamesAreUniqueError < StaticValidation::Error attr_reader :variable_name def initialize(message, path: nil, nodes: [], name:) diff --git a/lib/graphql/static_validation/rules/variable_usages_are_allowed_error.rb b/lib/graphql/static_validation/rules/variable_usages_are_allowed_error.rb index 5998858d2b..1e01f06ba0 100644 --- a/lib/graphql/static_validation/rules/variable_usages_are_allowed_error.rb +++ b/lib/graphql/static_validation/rules/variable_usages_are_allowed_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class VariableUsagesAreAllowedError < Message + class VariableUsagesAreAllowedError < StaticValidation::Error attr_reader :type_name attr_reader :variable_name attr_reader :argument_name diff --git a/lib/graphql/static_validation/rules/variables_are_input_types_error.rb b/lib/graphql/static_validation/rules/variables_are_input_types_error.rb index 0104899bd3..a0db52f1c2 100644 --- a/lib/graphql/static_validation/rules/variables_are_input_types_error.rb +++ b/lib/graphql/static_validation/rules/variables_are_input_types_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class VariablesAreInputTypesError < Message + class VariablesAreInputTypesError < StaticValidation::Error attr_reader :type_name attr_reader :variable_name diff --git a/lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb b/lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb index 99f3b39813..0d010c4c1d 100644 --- a/lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb +++ b/lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module GraphQL module StaticValidation - class VariablesAreUsedAndDefinedError < Message + class VariablesAreUsedAndDefinedError < StaticValidation::Error attr_reader :variable_name attr_reader :violation diff --git a/spec/graphql/static_validation/validator_spec.rb b/spec/graphql/static_validation/validator_spec.rb index c0f464e8cf..b74834bb37 100644 --- a/spec/graphql/static_validation/validator_spec.rb +++ b/spec/graphql/static_validation/validator_spec.rb @@ -182,10 +182,10 @@ describe "With a legacy-style rule" do # GraphQL-Pro's operation store uses this class ValidatorSpecLegacyRule - include GraphQL::StaticValidation::Message::MessageHelper + include GraphQL::StaticValidation::Error::ErrorHelper def validate(ctx) ctx.visitor[GraphQL::Language::Nodes::OperationDefinition] << ->(n, _p) { - ctx.errors << message("Busted!", n, context: ctx) + ctx.errors << error("Busted!", n, context: ctx) } end end