gqli 0.6.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/CHANGELOG.md +17 -0
- data/Gemfile.lock +103 -82
- data/README.md +0 -5
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +1774 -1205
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc_disabled.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_both.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc_disabled.png +0 -0
- data/coverage/assets/0.12.3/application.css +1 -0
- data/coverage/assets/0.12.3/application.js +7 -0
- data/coverage/assets/{0.10.2 → 0.12.3}/colorbox/border.png +0 -0
- data/coverage/assets/{0.10.2 → 0.12.3}/colorbox/controls.png +0 -0
- data/coverage/assets/{0.10.2 → 0.12.3}/colorbox/loading.gif +0 -0
- data/coverage/assets/{0.10.2 → 0.12.3}/colorbox/loading_background.png +0 -0
- data/coverage/assets/{0.10.2 → 0.12.3}/favicon_green.png +0 -0
- data/coverage/assets/{0.10.2 → 0.12.3}/favicon_red.png +0 -0
- data/coverage/assets/{0.10.2 → 0.12.3}/favicon_yellow.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coverage/assets/{0.10.2 → 0.12.3}/loading.gif +0 -0
- data/coverage/assets/{0.10.2 → 0.12.3}/magnify.png +0 -0
- data/coverage/index.html +19376 -7403
- data/doc/GQLi/Base.html +11 -11
- data/doc/GQLi/Client.html +175 -41
- data/doc/GQLi/Contentful.html +13 -11
- data/doc/GQLi/DSL.html +298 -30
- data/doc/GQLi/EnumValue.html +8 -8
- data/doc/GQLi/Fragment.html +8 -8
- data/doc/GQLi/Github.html +6 -6
- data/doc/GQLi/Introspection.html +46 -48
- data/doc/GQLi/Mutation.html +390 -0
- data/doc/GQLi/Node.html +8 -8
- data/doc/GQLi/Query.html +6 -6
- data/doc/GQLi/Response.html +87 -13
- data/doc/GQLi/Subscription.html +390 -0
- data/doc/GQLi/Validation.html +20 -20
- data/doc/GQLi.html +9 -9
- data/doc/_index.html +37 -7
- data/doc/class_list.html +3 -3
- data/doc/css/style.css +3 -2
- data/doc/file.CHANGELOG.html +43 -13
- data/doc/file.LICENSE.html +6 -6
- data/doc/file.README.html +31 -84
- data/doc/file_list.html +2 -2
- data/doc/frames.html +2 -2
- data/doc/index.html +31 -84
- data/doc/js/app.js +25 -3
- data/doc/method_list.html +147 -43
- data/doc/top-level-namespace.html +6 -6
- data/gqli.gemspec +5 -6
- data/lib/gqli/client.rb +25 -5
- data/lib/gqli/clients/contentful.rb +3 -2
- data/lib/gqli/dsl.rb +16 -1
- data/lib/gqli/introspection.rb +1 -3
- data/lib/gqli/mutation.rb +27 -0
- data/lib/gqli/response.rb +15 -2
- data/lib/gqli/subscription.rb +1 -1
- data/lib/gqli/validation.rb +15 -12
- data/lib/gqli/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/client.yml +98 -27
- data/spec/fixtures/vcr_cassettes/mutation_client.yml +4364 -0
- data/spec/lib/gqli/client_spec.rb +53 -0
- data/spec/lib/gqli/dsl_spec.rb +72 -2
- data/spec/lib/gqli/introspection_spec.rb +54 -0
- data/spec/lib/gqli/response_spec.rb +51 -0
- metadata +64 -73
- data/coverage/assets/0.10.2/application.css +0 -799
- data/coverage/assets/0.10.2/application.js +0 -1707
data/lib/gqli/subscription.rb
CHANGED
data/lib/gqli/validation.rb
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
module GQLi
|
4
4
|
# Validations
|
5
5
|
class Validation
|
6
|
-
attr_reader :schema, :
|
6
|
+
attr_reader :schema, :root, :errors
|
7
7
|
|
8
|
-
def initialize(schema,
|
8
|
+
def initialize(schema, root)
|
9
9
|
@schema = schema
|
10
|
-
@
|
10
|
+
@root = root
|
11
11
|
@errors = []
|
12
12
|
|
13
13
|
validate
|
@@ -21,24 +21,27 @@ module GQLi
|
|
21
21
|
protected
|
22
22
|
|
23
23
|
def validate
|
24
|
-
|
24
|
+
@errors = []
|
25
|
+
|
26
|
+
type_name = root.class.name.split('::').last
|
27
|
+
validate_type(type_name)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
25
31
|
|
26
|
-
|
27
|
-
|
32
|
+
def validate_type(type)
|
33
|
+
root_type = types.find { |t| t.name.casecmp(type).zero? }
|
34
|
+
root.__nodes.each do |node|
|
28
35
|
begin
|
29
|
-
validate_node(
|
36
|
+
validate_node(root_type, node)
|
30
37
|
rescue StandardError => e
|
31
38
|
errors << e
|
32
39
|
end
|
33
40
|
end
|
34
41
|
|
35
|
-
|
36
|
-
rescue StandardError => e
|
37
|
-
errors << e
|
42
|
+
valid?
|
38
43
|
end
|
39
44
|
|
40
|
-
private
|
41
|
-
|
42
45
|
def remove_alias(name)
|
43
46
|
return name unless name.include?(':')
|
44
47
|
|
data/lib/gqli/version.rb
CHANGED