graphql-docs 0.6.2 → 1.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -37
- data/Rakefile +15 -3
- data/graphql-docs.gemspec +0 -1
- data/lib/graphql-docs.rb +24 -10
- data/lib/graphql-docs/configuration.rb +5 -7
- data/lib/graphql-docs/generator.rb +31 -34
- data/lib/graphql-docs/helpers.rb +12 -63
- data/lib/graphql-docs/layouts/assets/_sass/_content.scss +22 -0
- data/lib/graphql-docs/layouts/assets/_sass/_deprecations.scss +9 -0
- data/lib/graphql-docs/layouts/assets/css/screen.scss +1 -0
- data/lib/graphql-docs/layouts/graphql_enums.html +4 -4
- data/lib/graphql-docs/layouts/graphql_input_objects.html +5 -5
- data/lib/graphql-docs/layouts/graphql_interfaces.html +17 -5
- data/lib/graphql-docs/layouts/graphql_mutations.html +14 -6
- data/lib/graphql-docs/layouts/graphql_objects.html +12 -12
- data/lib/graphql-docs/layouts/graphql_operation.html +19 -0
- data/lib/graphql-docs/layouts/graphql_scalars.html +2 -2
- data/lib/graphql-docs/layouts/graphql_unions.html +4 -4
- data/lib/graphql-docs/layouts/includes/arguments.html +3 -6
- data/lib/graphql-docs/layouts/includes/connections.html +4 -4
- data/lib/graphql-docs/layouts/includes/fields.html +16 -20
- data/lib/graphql-docs/layouts/includes/input_fields.html +5 -9
- data/lib/graphql-docs/layouts/includes/possible_types.html +1 -1
- data/lib/graphql-docs/layouts/includes/sidebar.html +10 -26
- data/lib/graphql-docs/layouts/includes/values.html +9 -2
- data/lib/graphql-docs/parser.rb +174 -29
- data/lib/graphql-docs/version.rb +1 -1
- metadata +6 -20
- data/lib/graphql-docs/client.rb +0 -55
- data/lib/graphql-docs/layouts/assets/_sass/screen.scss +0 -647
@@ -137,6 +137,13 @@
|
|
137
137
|
}
|
138
138
|
table {
|
139
139
|
margin-top: 10px;
|
140
|
+
th {
|
141
|
+
text-align: left;
|
142
|
+
padding: 0 25px 0 25px;
|
143
|
+
}
|
144
|
+
thead th:first-child {
|
145
|
+
padding: 0;
|
146
|
+
}
|
140
147
|
td p {
|
141
148
|
padding: 0 25px 0 25px;
|
142
149
|
}
|
@@ -456,6 +463,7 @@
|
|
456
463
|
padding: 12px 13px;
|
457
464
|
border: 1px solid #eee;
|
458
465
|
vertical-align: middle;
|
466
|
+
text-align: left;
|
459
467
|
}
|
460
468
|
td {
|
461
469
|
border: 1px solid #eee;
|
@@ -494,4 +502,18 @@
|
|
494
502
|
}
|
495
503
|
}
|
496
504
|
}
|
505
|
+
|
506
|
+
.field-name {
|
507
|
+
font-weight: bold;
|
508
|
+
}
|
509
|
+
|
510
|
+
.field-entry {
|
511
|
+
margin-bottom: 4rem;
|
512
|
+
}
|
513
|
+
.description-wrapper {
|
514
|
+
>p {
|
515
|
+
padding-left: 1rem;
|
516
|
+
margin-bottom: 1rem;
|
517
|
+
}
|
518
|
+
}
|
497
519
|
}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
# <%= type[
|
1
|
+
# <%= type[:name] %>
|
2
2
|
|
3
|
-
<%= type[
|
3
|
+
<%= type[:description] %>
|
4
4
|
|
5
|
-
<% unless type[
|
5
|
+
<% unless type[:values].empty? %>
|
6
6
|
|
7
|
-
<%= include.('values.html', values: type[
|
7
|
+
<%= include.('values.html', values: type[:values]) %>
|
8
8
|
|
9
9
|
<% end %>
|
@@ -1,11 +1,11 @@
|
|
1
|
-
|
1
|
+
<h1><%= type[:name] %></h1>
|
2
2
|
|
3
|
-
<%= type[
|
3
|
+
<%= type[:description] %>
|
4
4
|
|
5
|
-
<% unless type[
|
5
|
+
<% unless type[:inputFields].nil? %>
|
6
6
|
|
7
|
-
|
7
|
+
<h2>Input Fields</h2>
|
8
8
|
|
9
|
-
<%= include.('input_fields.html', input_fields: type[
|
9
|
+
<%= include.('input_fields.html', input_fields: type[:input_fields]) %>
|
10
10
|
|
11
11
|
<% end %>
|
@@ -1,11 +1,23 @@
|
|
1
|
-
|
1
|
+
<h1><%= type[:name] %></h1>
|
2
2
|
|
3
|
-
<%= type[
|
3
|
+
<%= type[:description] %>
|
4
4
|
|
5
|
-
<% unless type[
|
5
|
+
<% unless type[:implemented_by].empty? %>
|
6
6
|
|
7
|
-
|
7
|
+
<h2>Implemented by</h2>
|
8
8
|
|
9
|
-
|
9
|
+
<ul>
|
10
|
+
<% type[:implemented_by].each do |implementor| %>
|
11
|
+
<li><code><a href="<%= base_url %>/object/<%= slugify.(implementor) %>"><%= implementor %></a></code></li>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<% unless type[:fields].empty? %>
|
18
|
+
|
19
|
+
<h2>Fields</h2>
|
20
|
+
|
21
|
+
<%= include.('fields.html', fields: type[:fields]) %>
|
10
22
|
|
11
23
|
<% end %>
|
@@ -1,11 +1,19 @@
|
|
1
|
-
|
1
|
+
<h1><%= type[:name] %></h1>
|
2
2
|
|
3
|
-
<%= type[
|
3
|
+
<%= type[:description] %>
|
4
4
|
|
5
|
-
|
5
|
+
<h2>Input fields</h2>
|
6
6
|
|
7
|
-
|
7
|
+
<% if !type[:input_fields].empty? %>
|
8
|
+
<%= include.('/fields.html', fields: type[:input_fields]) %>
|
9
|
+
<% else %>
|
10
|
+
<p>None</p>
|
11
|
+
<% end %>
|
8
12
|
|
9
|
-
|
13
|
+
<h2>Return fields</h2>
|
10
14
|
|
11
|
-
|
15
|
+
<% if !type[:return_fields].empty? %>
|
16
|
+
<%= include.('/fields.html', fields: type[:return_fields]) %>
|
17
|
+
<% else %>
|
18
|
+
<p>None</p>
|
19
|
+
<% end %>
|
@@ -1,31 +1,31 @@
|
|
1
|
-
|
1
|
+
<h1><%= type[:name] %></h1>
|
2
2
|
|
3
|
-
<%= type[
|
3
|
+
<%= type[:description] %>
|
4
4
|
|
5
|
-
<% unless type[
|
5
|
+
<% unless type[:interfaces].empty? %>
|
6
6
|
|
7
|
-
|
7
|
+
<h2>Implements</h2>
|
8
8
|
|
9
9
|
<ul>
|
10
|
-
<% type[
|
11
|
-
<li><code><a href="<%= base_url %>/interface/<%= slugify.(interface
|
10
|
+
<% type[:interfaces].each do |interface| %>
|
11
|
+
<li><code><a href="<%= base_url %>/interface/<%= slugify.(interface) %>"><%= interface %></a></code></li>
|
12
12
|
<% end %>
|
13
13
|
</ul>
|
14
14
|
|
15
15
|
<% end %>
|
16
16
|
|
17
|
-
<% unless type[
|
17
|
+
<% unless type[:connections].empty? %>
|
18
18
|
|
19
|
-
|
19
|
+
<h2>Connections</h2>
|
20
20
|
|
21
|
-
<%= include.('connections.html', connections: type[
|
21
|
+
<%= include.('connections.html', connections: type[:connections]) %>
|
22
22
|
|
23
23
|
<% end %>
|
24
24
|
|
25
|
-
<% unless type[
|
25
|
+
<% unless type[:fields].empty? %>
|
26
26
|
|
27
|
-
|
27
|
+
<h2>Fields</h2>
|
28
28
|
|
29
|
-
<%= include.('fields.html', fields: type[
|
29
|
+
<%= include.('fields.html', fields: type[:fields]) %>
|
30
30
|
|
31
31
|
<% end %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<h1><%= type[:name] %></h1>
|
2
|
+
|
3
|
+
<%= type[:description] %>
|
4
|
+
|
5
|
+
<% unless type[:connections].empty? %>
|
6
|
+
|
7
|
+
<h2>Connections</h2>
|
8
|
+
|
9
|
+
<%= include.('connections.html', connections: type[:connections]) %>
|
10
|
+
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<% unless type[:fields].empty? %>
|
14
|
+
|
15
|
+
<h2>Fields</h2>
|
16
|
+
|
17
|
+
<%= include.('fields.html', fields: type[:fields]) %>
|
18
|
+
|
19
|
+
<% end %>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
# <%= type[
|
1
|
+
# <%= type[:name] %>
|
2
2
|
|
3
|
-
<%= type[
|
3
|
+
<%= type[:description] %>
|
@@ -1,9 +1,9 @@
|
|
1
|
-
# <%= type[
|
1
|
+
# <%= type[:name] %>
|
2
2
|
|
3
|
-
<%= type[
|
3
|
+
<%= type[:description] %>
|
4
4
|
|
5
|
-
<% unless type[
|
5
|
+
<% unless type[:possible_types].empty? %>
|
6
6
|
|
7
|
-
<%= include.('possible_types.html', possible_types: type[
|
7
|
+
<%= include.('possible_types.html', possible_types: type[:possible_types]) %>
|
8
8
|
|
9
9
|
<% end %>
|
@@ -9,15 +9,12 @@
|
|
9
9
|
<tbody>
|
10
10
|
<% args.each do |argument| %>
|
11
11
|
<tr>
|
12
|
-
<td><code><%= argument[
|
12
|
+
<td><code><%= argument[:name] %></code></td>
|
13
13
|
<td>
|
14
|
-
|
15
|
-
<% @type_path, @type_name, @name_slug = format_type.(argument) %>
|
16
|
-
|
17
|
-
<code><a href="<%= base_url %>/<%= @type_path %>/<%= @name_slug %>"><%= @type_name %></a></code>
|
14
|
+
<code><a href="<%= base_url %>/<%= argument[:type][:path]%>"><%= argument[:type][:info] %></a></code>
|
18
15
|
</td>
|
19
16
|
<td>
|
20
|
-
<p><%= markdown.(argument[
|
17
|
+
<p><%= markdown.(argument[:description]) %></p>
|
21
18
|
</td>
|
22
19
|
</tr>
|
23
20
|
<% end %>
|
@@ -1,14 +1,14 @@
|
|
1
1
|
<% connections.each do |connection| %>
|
2
2
|
|
3
3
|
<div class="field-entry <%= classes[:field_entry] %>">
|
4
|
-
<span class="field-name connection-name"><%= connection[
|
4
|
+
<span class="field-name connection-name"><%= connection[:name] %> (<a href="<%= base_url %>/<%= connection[:type][:path] %>" class="js-connection-name"><code><%= connection[:type][:info] %></code></a>)</span>
|
5
5
|
|
6
6
|
<div class="description-wrapper">
|
7
|
-
|
7
|
+
<p><%= connection[:description] %></p>
|
8
8
|
|
9
|
-
<% unless connection[
|
9
|
+
<% unless connection[:arguments].empty? %>
|
10
10
|
|
11
|
-
<%= include.('arguments.html', args: connection[
|
11
|
+
<%= include.('arguments.html', args: connection[:arguments]) %>
|
12
12
|
|
13
13
|
<% end %>
|
14
14
|
</div>
|
@@ -1,29 +1,25 @@
|
|
1
1
|
<% fields.each do |field| %>
|
2
2
|
|
3
|
-
<% next if field['type']['ofType'] && field['type']['ofType']['name'] && field['type']['ofType']['name'].end_with?('Connection') %>
|
4
|
-
|
5
3
|
<div class="field-entry <%= classes[:field_entry] %>">
|
6
|
-
<% next if field[
|
7
|
-
|
8
|
-
<% @type_path, @type_name, @name_slug = format_type.(field) %>
|
4
|
+
<% next if field[:name] == "id" || field[:name].blank? %>
|
9
5
|
|
10
|
-
<span class="field-name"><%= field[
|
6
|
+
<span class="field-name"><%= field[:name] %> (<code><a href="<%= base_url %>/<%= field[:type][:path] %>"><%= field[:type][:info] %></a></code>)</span>
|
11
7
|
|
12
8
|
<div class="description-wrapper">
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
9
|
+
<% if field[:is_deprecated] %>
|
10
|
+
<div class="deprecation-notice <%= classes[:deprecation_notice] %>">
|
11
|
+
<span class="deprecation-title">Deprecation notice</span>
|
12
|
+
<%= markdown.(field[:deprecation_reason]) %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<% if field[:description].present? %>
|
17
|
+
<%= markdown.(field[:description].strip) %>
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<% unless field[:arguments].blank? %>
|
21
|
+
<%= include.('arguments.html', args: field[:arguments]) %>
|
22
|
+
<% end %>
|
27
23
|
</div>
|
28
24
|
</div>
|
29
25
|
|
@@ -1,20 +1,16 @@
|
|
1
1
|
<% input_fields.each do |field| %>
|
2
2
|
|
3
|
-
<% next if field['type']['ofType'] && field['type']['ofType']['name'] && field['type']['ofType']['name'].end_with?('Connection') %>
|
4
|
-
|
5
3
|
<div class="field-entry <%= classes[:field_entry] %>">
|
6
|
-
<% next if field[
|
7
|
-
|
8
|
-
<% @type_path, @type_name, @name_slug = format_type.(field) %>
|
4
|
+
<% next if field[:name] == "id" || field[:name].blank? %>
|
9
5
|
|
10
|
-
<span class="field-name"><%= field[
|
6
|
+
<span class="field-name"><%= field[:name] %> (<a href="<%= base_url %>/<%= field[:type][:path] %>"><code><%= field[:type][:info] %></code></a>)</span>
|
11
7
|
|
12
8
|
<div class="description-wrapper">
|
13
|
-
|
9
|
+
<p><%= field[:description] %></p>
|
14
10
|
|
15
|
-
<% unless field[
|
11
|
+
<% unless field[:args].nil? %>
|
16
12
|
|
17
|
-
<%= include.('arguments.html', args: field[
|
13
|
+
<%= include.('arguments.html', args: field[:args]) %>
|
18
14
|
|
19
15
|
<% end %>
|
20
16
|
</div>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<ul>
|
4
4
|
|
5
5
|
<% possible_types.each do |possible_type| %>
|
6
|
-
<li><a href="<%= base_url %>/object/<%= slugify.(possible_type
|
6
|
+
<li><a href="<%= base_url %>/object/<%= slugify.(possible_type) %>"><%= possible_type %></a></li>
|
7
7
|
<% end %>
|
8
8
|
|
9
9
|
</ul>
|
@@ -10,12 +10,12 @@
|
|
10
10
|
<p>Queries</p>
|
11
11
|
<ul class="menu-root">
|
12
12
|
<li>
|
13
|
-
<a href="<%= base_url %>/query/" class="sidebar-link<% if title == "Query" %> current<% end %>">
|
13
|
+
<a href="<%= base_url %>/operation/query/" class="sidebar-link<% if title == "Query" %> current<% end %>">
|
14
14
|
Query
|
15
15
|
</a>
|
16
16
|
</li>
|
17
17
|
<li>
|
18
|
-
<a href="<%= base_url %>/mutation" class="sidebar-link<% if title == "Mutation" %> current<% end %>">
|
18
|
+
<a href="<%= base_url %>/operation/mutation/" class="sidebar-link<% if title == "Mutation" %> current<% end %>">
|
19
19
|
Mutation
|
20
20
|
</a>
|
21
21
|
</li>
|
@@ -26,19 +26,7 @@
|
|
26
26
|
<p><a href="<%= base_url %>/object">Objects</a></p>
|
27
27
|
<ul class="menu-root">
|
28
28
|
<% graphql_object_types.().each do |type| %>
|
29
|
-
<% @name = type[
|
30
|
-
<!-- skip connection stuff -->
|
31
|
-
<% next if @name.end_with?("Connection") || @name.end_with?("Edge") %>
|
32
|
-
|
33
|
-
<!-- skip mutation stuff -->
|
34
|
-
<% next if @name == "Mutation" || @name.end_with?("Payload") %>
|
35
|
-
|
36
|
-
<!-- skip metadata stuff -->
|
37
|
-
<% next if @name.start_with?("__") %>
|
38
|
-
|
39
|
-
<!-- skip root query stuff -->
|
40
|
-
<% next if @name == "Query" %>
|
41
|
-
|
29
|
+
<% @name = type[:name] %>
|
42
30
|
<li>
|
43
31
|
<a href="<%= base_url %>/object/<%= @name.downcase %>/" class="sidebar-link<% if title == @name %> current<% end %>">
|
44
32
|
<%= @name %>
|
@@ -49,12 +37,10 @@
|
|
49
37
|
</li>
|
50
38
|
|
51
39
|
<li>
|
52
|
-
<p><a href="<%= base_url %>/mutation">Mutations</a></p>
|
40
|
+
<p><a href="<%= base_url %>/operation/mutation">Mutations</a></p>
|
53
41
|
<ul class="menu-root">
|
54
42
|
<% graphql_mutation_types.().each do |type| %>
|
55
|
-
<% @name = type[
|
56
|
-
<!-- skip metadata stuff -->
|
57
|
-
<% next if @name.start_with?("__") %>
|
43
|
+
<% @name = type[:name] %>
|
58
44
|
<li>
|
59
45
|
<a href="<%= base_url %>/mutation/<%= @name.downcase %>/" class="sidebar-link<% if title == @name %> current<% end %>">
|
60
46
|
<%= @name %>
|
@@ -68,7 +54,7 @@
|
|
68
54
|
<p><a href="<%= base_url %>/interface">Interfaces</a></p>
|
69
55
|
<ul class="menu-root">
|
70
56
|
<% graphql_interface_types.().each do |type| %>
|
71
|
-
<% @name = type[
|
57
|
+
<% @name = type[:name] %>
|
72
58
|
<li>
|
73
59
|
<a href="<%= base_url %>/interface/<%= @name.downcase %>/" class="sidebar-link<% if title == @name %> current<% end %>">
|
74
60
|
<%= @name %>
|
@@ -82,9 +68,7 @@
|
|
82
68
|
<p><a href="<%= base_url %>/enum">Enums</a></p>
|
83
69
|
<ul class="menu-root">
|
84
70
|
<% graphql_enum_types.().each do |type| %>
|
85
|
-
<% @name = type[
|
86
|
-
<!-- skip metadata stuff -->
|
87
|
-
<% next if @name.start_with?("__") %>
|
71
|
+
<% @name = type[:name] %>
|
88
72
|
<li>
|
89
73
|
<a href="<%= base_url %>/enum/<%= @name.downcase %>/" class="sidebar-link<% if title == @name %> current<% end %>">
|
90
74
|
<%= @name %>
|
@@ -98,7 +82,7 @@
|
|
98
82
|
<p><a href="<%= base_url %>/union">Unions</a></p>
|
99
83
|
<ul class="menu-root">
|
100
84
|
<% graphql_union_types.().each do |type| %>
|
101
|
-
<% @name = type[
|
85
|
+
<% @name = type[:name] %>
|
102
86
|
<li>
|
103
87
|
<a href="<%= base_url %>/union/<%= @name.downcase %>/" class="sidebar-link<% if title == @name %> current<% end %>">
|
104
88
|
<%= @name %>
|
@@ -112,7 +96,7 @@
|
|
112
96
|
<p><a href="<%= base_url %>/input_object">Input Objects</a></p>
|
113
97
|
<ul class="menu-root">
|
114
98
|
<% graphql_input_object_types.().each do |type| %>
|
115
|
-
<% @name = type[
|
99
|
+
<% @name = type[:name] %>
|
116
100
|
<li>
|
117
101
|
<a href="<%= base_url %>/input_object/<%= @name.downcase %>/" class="sidebar-link<% if title == @name %> current<% end %>">
|
118
102
|
<%= @name %>
|
@@ -126,7 +110,7 @@
|
|
126
110
|
<p><a href="<%= base_url %>/scalar">Scalars</a></p>
|
127
111
|
<ul class="menu-root">
|
128
112
|
<% graphql_scalar_types.().each do |type| %>
|
129
|
-
<% @name = type[
|
113
|
+
<% @name = type[:name] %>
|
130
114
|
<li>
|
131
115
|
<a href="<%= base_url %>/scalar/<%= @name.downcase %>/" class="sidebar-link<% if title == @name %> current<% end %>">
|
132
116
|
<%= @name %>
|