nulogy_graphql_api 0.5.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +117 -0
- data/.ruby-version +1 -1
- data/Appraisals +4 -4
- data/CHANGELOG.md +42 -12
- data/README.md +79 -24
- data/gemfiles/rails_6.gemfile +2 -2
- data/gemfiles/{rails_5.gemfile → rails_6_1.gemfile} +2 -2
- data/lib/nulogy_graphql_api.rb +1 -0
- data/lib/nulogy_graphql_api/rspec.rb +2 -2
- data/lib/nulogy_graphql_api/rspec/graphql_helpers.rb +2 -2
- data/lib/nulogy_graphql_api/schema/base_mutation.rb +12 -0
- data/lib/nulogy_graphql_api/tasks/schema_changes_checker.rb +1 -1
- data/lib/nulogy_graphql_api/tasks/schema_generator.rb +6 -9
- data/lib/nulogy_graphql_api/version.rb +1 -1
- data/nulogy_graphql_api.gemspec +10 -10
- metadata +29 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c240d25281317e146a219c8263331efb38b36a8aa0f84c3e17978016c89be9f0
|
4
|
+
data.tar.gz: c681d64df5e481069074e4477f6801ec867147f9e1eb07253bcea773196ec8bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4074241b6a5603acf9547ca33db22f2a3aff59bbd0cca207a9023d9b1f560924b2d76240ef3bed71240c49142caff72c5f8b587c880404dc57dc2ea23f1a22ec
|
7
|
+
data.tar.gz: 979f68739de9a911d5e69b233013876b4a6038a04ceee5784ee5002dba32b756709c7c1e5f780d439f5cd69e5f58eda9562fc8cb86518d37d79adcea9f37707c
|
data/.rubocop.yml
CHANGED
@@ -6,6 +6,9 @@ inherit_from:
|
|
6
6
|
AllCops:
|
7
7
|
TargetRubyVersion: 2.6
|
8
8
|
|
9
|
+
Gemspec/DateAssignment:
|
10
|
+
Enabled: true
|
11
|
+
|
9
12
|
Layout/EmptyLinesAroundAttributeAccessor:
|
10
13
|
Enabled: true
|
11
14
|
|
@@ -38,18 +41,72 @@ Layout/MultilineOperationIndentation:
|
|
38
41
|
Layout/SpaceAroundMethodCallOperator:
|
39
42
|
Enabled: false
|
40
43
|
|
44
|
+
Layout/SpaceBeforeBrackets:
|
45
|
+
Enabled: true
|
46
|
+
|
47
|
+
Lint/AmbiguousAssignment:
|
48
|
+
Enabled: true
|
49
|
+
|
50
|
+
Lint/DeprecatedConstants:
|
51
|
+
Enabled: true
|
52
|
+
|
41
53
|
Lint/DeprecatedOpenSSLConstant:
|
42
54
|
Enabled: true
|
43
55
|
|
56
|
+
Lint/DuplicateBranch:
|
57
|
+
Enabled: true
|
58
|
+
|
59
|
+
Lint/DuplicateElsifCondition:
|
60
|
+
Enabled: true
|
61
|
+
|
62
|
+
Lint/DuplicateRegexpCharacterClassElement:
|
63
|
+
Enabled: true
|
64
|
+
|
65
|
+
Lint/EmptyBlock:
|
66
|
+
Enabled: true
|
67
|
+
|
68
|
+
Lint/EmptyClass:
|
69
|
+
Enabled: true
|
70
|
+
|
71
|
+
Lint/LambdaWithoutLiteralBlock:
|
72
|
+
Enabled: true
|
73
|
+
|
44
74
|
Lint/MixedRegexpCaptureTypes:
|
45
75
|
Enabled: true
|
46
76
|
|
77
|
+
Lint/NoReturnInBeginEndBlocks:
|
78
|
+
Enabled: true
|
79
|
+
|
80
|
+
Lint/NumberedParameterAssignment:
|
81
|
+
Enabled: true
|
82
|
+
|
83
|
+
Lint/OrAssignmentToConstant:
|
84
|
+
Enabled: true
|
85
|
+
|
47
86
|
Lint/RaiseException:
|
48
87
|
Enabled: false
|
49
88
|
|
89
|
+
Lint/RedundantDirGlobSort:
|
90
|
+
Enabled: true
|
91
|
+
|
50
92
|
Lint/StructNewOverride:
|
51
93
|
Enabled: false
|
52
94
|
|
95
|
+
Lint/SymbolConversion:
|
96
|
+
Enabled: true
|
97
|
+
|
98
|
+
Lint/ToEnumArguments:
|
99
|
+
Enabled: true
|
100
|
+
|
101
|
+
Lint/TripleQuotes:
|
102
|
+
Enabled: true
|
103
|
+
|
104
|
+
Lint/UnexpectedBlockArity:
|
105
|
+
Enabled: true
|
106
|
+
|
107
|
+
Lint/UnmodifiedReduceAccumulator:
|
108
|
+
Enabled: true
|
109
|
+
|
53
110
|
Metrics:
|
54
111
|
Enabled: false
|
55
112
|
|
@@ -74,18 +131,57 @@ RSpec/MessageSpies:
|
|
74
131
|
RSpec/NotToNot:
|
75
132
|
EnforcedStyle: to_not
|
76
133
|
|
134
|
+
Style/AccessorGrouping:
|
135
|
+
Enabled: true
|
136
|
+
|
137
|
+
Style/ArgumentsForwarding:
|
138
|
+
Enabled: true
|
139
|
+
|
140
|
+
Style/ArrayCoercion:
|
141
|
+
Enabled: true
|
142
|
+
|
143
|
+
Style/BisectedAttrAccessor:
|
144
|
+
Enabled: true
|
145
|
+
|
146
|
+
Style/CaseLikeIf:
|
147
|
+
Enabled: true
|
148
|
+
|
149
|
+
Style/CollectionCompact:
|
150
|
+
Enabled: true
|
151
|
+
|
152
|
+
Style/DocumentDynamicEvalDefinition:
|
153
|
+
Enabled: true
|
154
|
+
|
155
|
+
Style/EndlessMethod:
|
156
|
+
Enabled: true
|
157
|
+
|
77
158
|
Style/ExponentialNotation:
|
78
159
|
Enabled: false
|
79
160
|
|
161
|
+
Style/HashAsLastArrayItem:
|
162
|
+
Enabled: true
|
163
|
+
|
164
|
+
Style/HashConversion:
|
165
|
+
Enabled: true
|
166
|
+
|
80
167
|
Style/HashEachMethods:
|
81
168
|
Enabled: false
|
82
169
|
|
170
|
+
Style/HashExcept:
|
171
|
+
Enabled: true
|
172
|
+
|
173
|
+
Style/HashLikeCase:
|
174
|
+
Enabled: true
|
175
|
+
|
83
176
|
Style/HashTransformKeys:
|
84
177
|
Enabled: false
|
85
178
|
|
86
179
|
Style/HashTransformValues:
|
87
180
|
Enabled: false
|
88
181
|
|
182
|
+
Style/IfWithBooleanLiteralBranches:
|
183
|
+
Enabled: true
|
184
|
+
|
89
185
|
Style/BlockDelimiters:
|
90
186
|
Enabled: false
|
91
187
|
|
@@ -110,9 +206,24 @@ Style/GuardClause:
|
|
110
206
|
Style/MutableConstant:
|
111
207
|
Enabled: false
|
112
208
|
|
209
|
+
Style/NegatedIfElseCondition:
|
210
|
+
Enabled: true
|
211
|
+
|
113
212
|
Style/RaiseArgs:
|
114
213
|
Enabled: false
|
115
214
|
|
215
|
+
Style/RedundantArgument:
|
216
|
+
Enabled: true
|
217
|
+
|
218
|
+
Style/RedundantAssignment:
|
219
|
+
Enabled: true
|
220
|
+
|
221
|
+
Style/RedundantFetchBlock:
|
222
|
+
Enabled: true
|
223
|
+
|
224
|
+
Style/RedundantFileExtensionInRequire:
|
225
|
+
Enabled: true
|
226
|
+
|
116
227
|
Style/RedundantRegexpCharacterClass:
|
117
228
|
Enabled: true
|
118
229
|
|
@@ -131,6 +242,12 @@ Style/SlicingWithRange:
|
|
131
242
|
Style/StringLiterals:
|
132
243
|
EnforcedStyle: double_quotes
|
133
244
|
|
245
|
+
Style/SwapValues:
|
246
|
+
Enabled: true
|
247
|
+
|
248
|
+
Style/NilLambda:
|
249
|
+
Enabled: true
|
250
|
+
|
134
251
|
Style/SymbolArray:
|
135
252
|
Enabled: false
|
136
253
|
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.3
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,19 +2,49 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
-
##
|
5
|
+
## 1.1.0 (2021-07-12)
|
6
6
|
|
7
|
-
**
|
7
|
+
**Changes**
|
8
8
|
|
9
|
-
*
|
9
|
+
* Support Rails 6.1
|
10
|
+
* **(Breaking)** Drop support for Rails 5
|
11
|
+
|
12
|
+
## 1.0.0 (2021-05-17)
|
13
|
+
|
14
|
+
**Changes**
|
15
|
+
|
16
|
+
* **(Breaking)** Change argument to `SchemaGenerator`
|
17
|
+
|
18
|
+
The `SchemaGenerator` now takes the path to the `schema.graphql` and the schema class as required arguments.
|
19
|
+
See [the update in the README](README.md#Schema-Generation).
|
20
|
+
|
21
|
+
## 0.6.0 (2021-02-24)
|
22
|
+
|
23
|
+
**Changes**
|
24
|
+
|
25
|
+
* **(Potentially Breaking)** Bump graphql gem version to 1.12.5
|
26
|
+
|
27
|
+
## 0.5.3 (2020-08-11)
|
28
|
+
|
29
|
+
* Add `BaseMutation`.
|
30
|
+
|
31
|
+
## 0.5.1 (2020-08-11)
|
32
|
+
|
33
|
+
* Add the `schema_generation_context?` attribute to the GraphQL `context` when generating the schema.
|
34
|
+
|
35
|
+
## 0.5.0 (2020-08-05)
|
36
|
+
|
37
|
+
**Changes**
|
38
|
+
|
39
|
+
* **(Breaking)** Add `context` to the Rake task that generates the schema file.
|
10
40
|
This changes the way the schema is parsed. Please refer to the README file to see an example of how to use `context`.
|
11
41
|
|
12
42
|
## 0.4.0 (2020-07-06)
|
13
43
|
|
14
|
-
**
|
44
|
+
**Changes**
|
15
45
|
|
16
|
-
* Remove the GraphqlApiController
|
17
|
-
* Add the ErrorHandling controller concern
|
46
|
+
* **(Breaking)** Remove the GraphqlApiController
|
47
|
+
* **(Breaking)** Add the ErrorHandling controller concern
|
18
48
|
|
19
49
|
## 0.3.1 (2020-07-03)
|
20
50
|
|
@@ -22,20 +52,20 @@ This changes the way the schema is parsed. Please refer to the README file to se
|
|
22
52
|
|
23
53
|
## 0.3.0 (2020-06-25)
|
24
54
|
|
25
|
-
**
|
55
|
+
**Changes**
|
26
56
|
|
27
|
-
* Remove spec helpers related to subscriptions
|
57
|
+
* **(Breaking)** Remove spec helpers related to subscriptions
|
28
58
|
|
29
59
|
## 0.2.0 (2020-06-24)
|
30
60
|
|
31
|
-
**
|
61
|
+
**Changes**
|
32
62
|
|
33
|
-
* Rename `GraphqlExecutor.call` to `execute`
|
34
|
-
* Change `schema` parameter on `execute_graphql` test helper to positional
|
63
|
+
* **(Breaking)** Rename `GraphqlExecutor.call` to `execute`
|
64
|
+
* **(Breaking)** Change `schema` parameter on `execute_graphql` test helper to positional
|
35
65
|
|
36
66
|
## 0.1.1 (2020-06-24)
|
37
67
|
|
38
|
-
**
|
68
|
+
**Changes**
|
39
69
|
|
40
70
|
* RSpec custom matchers
|
41
71
|
* RSpec helpers
|
data/README.md
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
# NulogyGraphqlApi
|
2
2
|
|
3
|
+
## Intent
|
4
|
+
|
5
|
+
Help Nulogy applications be compliant with the [Standard on Error-handling in GraphQL](https://trello.com/c/N5cHt4Gp/7-error-handling-in-graphql-apis).
|
6
|
+
|
3
7
|
## Installation
|
4
8
|
|
5
9
|
Add this line to your application's Gemfile:
|
6
10
|
|
7
11
|
```ruby
|
8
|
-
gem "nulogy_graphql_api", "
|
12
|
+
gem "nulogy_graphql_api", "1.1.0"
|
9
13
|
```
|
10
14
|
|
11
15
|
And then execute:
|
@@ -25,7 +29,8 @@ Or install it yourself as:
|
|
25
29
|
- [Types](#types)
|
26
30
|
- [UserErrorType](#usererrortype)
|
27
31
|
- [UUID](#uuid)
|
28
|
-
- [
|
32
|
+
- [Schema Generation](#schema-generation)
|
33
|
+
- [Node Visibility](#node-visibility)
|
29
34
|
|
30
35
|
#### Testing
|
31
36
|
|
@@ -36,9 +41,9 @@ Or install it yourself as:
|
|
36
41
|
|
37
42
|
#### Receiving Requests
|
38
43
|
|
39
|
-
Given that you have already defined your GraphQL `Schema` you can receive requests by defining a controller action and execute the params by calling the `NulogyGraphqlApi::GraphqlExecutor`.
|
44
|
+
Given that you have already defined your GraphQL `Schema` you can receive requests by defining a controller action and execute the params by calling the `NulogyGraphqlApi::GraphqlExecutor`.
|
40
45
|
|
41
|
-
- Remember to configure your routes to include the controller action.
|
46
|
+
- Remember to configure your routes to include the controller action.
|
42
47
|
- We called the action `execute` in the example below, but you can call it whatever makes more sense for your app.
|
43
48
|
|
44
49
|
```ruby
|
@@ -48,9 +53,9 @@ module MyApp
|
|
48
53
|
|
49
54
|
def execute
|
50
55
|
NulogyGraphqlApi::GraphqlExecutor.execute(
|
51
|
-
params,
|
52
|
-
context,
|
53
|
-
Schema,
|
56
|
+
params,
|
57
|
+
context,
|
58
|
+
Schema,
|
54
59
|
NulogyGraphqlApi::TransactionService.new
|
55
60
|
)
|
56
61
|
end
|
@@ -69,7 +74,7 @@ module MyApp
|
|
69
74
|
|
70
75
|
def render_error(exception)
|
71
76
|
MyApp::ExceptionNotifier.notify(exception)
|
72
|
-
|
77
|
+
|
73
78
|
super
|
74
79
|
end
|
75
80
|
end
|
@@ -87,10 +92,10 @@ module MyApp
|
|
87
92
|
class CreateEntity < GraphQL::Schema::Mutation
|
88
93
|
field :entity, MyApp::EntityType, null: false
|
89
94
|
field :errors, [NulogyGraphqlApi::Types::UserErrorType], null: false
|
90
|
-
|
95
|
+
|
91
96
|
def resolve(args)
|
92
97
|
entity = create_entity(args)
|
93
|
-
|
98
|
+
|
94
99
|
{
|
95
100
|
entity: entity,
|
96
101
|
errors: extract_errors(entity)
|
@@ -98,7 +103,7 @@ module MyApp
|
|
98
103
|
end
|
99
104
|
|
100
105
|
def extract_errors(entity)
|
101
|
-
entity.errors.map do |attribute, message|
|
106
|
+
entity.errors.map do |attribute, message|
|
102
107
|
{
|
103
108
|
path: path_for(attribute),
|
104
109
|
message: entity.errors.full_message(attribute, message)
|
@@ -121,9 +126,11 @@ module MyApp
|
|
121
126
|
end
|
122
127
|
```
|
123
128
|
|
124
|
-
###
|
129
|
+
### Schema Generation
|
125
130
|
|
126
|
-
There is a Rake task to generate the `schema.graphql` file.
|
131
|
+
There is a Rake task to generate the `schema.graphql` file. You need to provide the `schema_file_path` and the schema class so that the task can detect breaking changes and generate the file. If you don't have a schema file because it's your first time generating it then the rake task will just create one for you in the path provided.
|
132
|
+
|
133
|
+
There is also a third argument `context`. You'll have to configure it to be able to generate the SDL of fields or types that are only visible for more privileged users.
|
127
134
|
|
128
135
|
```ruby
|
129
136
|
namespace :graphql_api do
|
@@ -131,22 +138,55 @@ namespace :graphql_api do
|
|
131
138
|
|
132
139
|
task :generate_schema => :environment do
|
133
140
|
schema_file_path = MyApp::Engine.root.join("schema.graphql")
|
134
|
-
|
135
|
-
|
136
|
-
# Context is an optional parameter, but may be required if you change the visibility of nodes in your graph
|
137
|
-
# i.e.
|
138
|
-
# def visible?(context)
|
139
|
-
# context[:current_user].superuser?
|
140
|
-
# end
|
141
|
-
context = {}
|
141
|
+
schema = MyApp::Namespace::To::Schema
|
142
142
|
|
143
143
|
NulogyGraphqlApi::Tasks::SchemaGenerator
|
144
|
-
.new(schema_file_path,
|
144
|
+
.new(schema_file_path, schema)
|
145
145
|
.generate_schema
|
146
146
|
end
|
147
147
|
end
|
148
148
|
```
|
149
149
|
|
150
|
+
### Node visibility
|
151
|
+
|
152
|
+
When you customize the visibility of parts of your graph you have to make sure that all nodes are visible when the schema is being generated by the rake task. You can do so by using the `schema_generation_context?` attribute that is added to the context by the `SchemaGenerator` mentioned in the previous section.
|
153
|
+
|
154
|
+
Here is how to use it:
|
155
|
+
|
156
|
+
##### On fields
|
157
|
+
```ruby
|
158
|
+
field :entity, MyApp::EntityType, null: false do
|
159
|
+
description "Find an entity by ID"
|
160
|
+
argument :id, ID, required: true
|
161
|
+
|
162
|
+
def visible?(context)
|
163
|
+
context[:schema_generation_context?] || context[:current_user].superuser?
|
164
|
+
end
|
165
|
+
end
|
166
|
+
```
|
167
|
+
|
168
|
+
|
169
|
+
##### On mutations
|
170
|
+
|
171
|
+
In this case the `schema_generation_context?` attribute is checked by the `BaseMutation` class. All you have to do is inheriting from it and override `visible?` passing a block to the base method.
|
172
|
+
|
173
|
+
```ruby
|
174
|
+
module MyApp
|
175
|
+
class CreateEntity < NulogyGraphqlApi::Schema::BaseMutation
|
176
|
+
field :entity, MyApp::EntityType, null: false
|
177
|
+
field :errors, [NulogyGraphqlApi::Types::UserErrorType], null: false
|
178
|
+
|
179
|
+
def self.visible?(context)
|
180
|
+
super { context[:current_user].super_user? }
|
181
|
+
end
|
182
|
+
|
183
|
+
def resolve(args)
|
184
|
+
# ...
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
```
|
189
|
+
|
150
190
|
### RSpec helpers
|
151
191
|
|
152
192
|
Add this to your `spec_helpers.rb` file:
|
@@ -162,7 +202,7 @@ RSpec.configure do |config|
|
|
162
202
|
config.include NulogyGraphqlApi::GraphqlMatchers, graphql: true
|
163
203
|
config.include NulogyGraphqlApi::GraphqlHelpers, graphql: true
|
164
204
|
end
|
165
|
-
```
|
205
|
+
```
|
166
206
|
|
167
207
|
#### Test helpers
|
168
208
|
|
@@ -239,7 +279,22 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
239
279
|
|
240
280
|
## Contributing
|
241
281
|
|
242
|
-
|
282
|
+
We treat this project as an internal "open source" project. Everyone at Nulogy is welcome to submit Pull Requests.
|
283
|
+
|
284
|
+
### Submitting Pull Requests
|
285
|
+
|
286
|
+
The Directly Responsible Individual (DRI) for this project is Daniel Silva.
|
287
|
+
|
288
|
+
When you are happy with your changes:
|
289
|
+
|
290
|
+
1. Add description of changes to the top of the [CHANGELOG](./CHANGELOG.md) file, under the `## master (unreleased)` section subdivided into the following categories:
|
291
|
+
- New Features
|
292
|
+
- Bug Fixes
|
293
|
+
- Changes
|
294
|
+
- *prepend these with* **(Breaking)***,* **(Potentially Breaking)** *or just leave it blank in case neither applies*
|
295
|
+
|
296
|
+
1. Create a Pull Request.
|
297
|
+
1. Notify #nulogy-graphql-api Slack channel to get the DRI review and merge your changes.
|
243
298
|
|
244
299
|
## License
|
245
300
|
|
data/gemfiles/rails_6.gemfile
CHANGED
data/lib/nulogy_graphql_api.rb
CHANGED
@@ -3,6 +3,7 @@ require "graphql"
|
|
3
3
|
require "nulogy_graphql_api/error_handling"
|
4
4
|
require "nulogy_graphql_api/graphql_executor"
|
5
5
|
require "nulogy_graphql_api/graphql_response"
|
6
|
+
require "nulogy_graphql_api/schema/base_mutation"
|
6
7
|
require "nulogy_graphql_api/transaction_service"
|
7
8
|
require "nulogy_graphql_api/tasks/schema_changes_checker"
|
8
9
|
require "nulogy_graphql_api/tasks/schema_generator"
|
@@ -1,4 +1,4 @@
|
|
1
1
|
# relative-require all rspec files
|
2
|
-
Dir[File.dirname(__FILE__)
|
3
|
-
require "nulogy_graphql_api/rspec
|
2
|
+
Dir["#{File.dirname(__FILE__)}/rspec/*.rb"].each do |file|
|
3
|
+
require "nulogy_graphql_api/rspec/#{File.basename(file, File.extname(file))}"
|
4
4
|
end
|
@@ -16,8 +16,8 @@ module NulogyGraphqlApi
|
|
16
16
|
def request_graphql(url, query, variables: {}, headers: {})
|
17
17
|
params = { query: query, variables: variables }.to_json
|
18
18
|
default_headers = {
|
19
|
-
|
20
|
-
|
19
|
+
CONTENT_TYPE: "application/json",
|
20
|
+
HTTP_AUTHORIZATION: basic_auth_token(default_user.login)
|
21
21
|
}
|
22
22
|
|
23
23
|
post url, params: params, headers: default_headers.merge(headers)
|
@@ -1,10 +1,12 @@
|
|
1
1
|
module NulogyGraphqlApi
|
2
2
|
module Tasks
|
3
3
|
class SchemaGenerator
|
4
|
-
def initialize(schema_output_path,
|
4
|
+
def initialize(schema_output_path, schema_definition, context: {})
|
5
5
|
@schema_output_path = schema_output_path
|
6
|
-
@
|
7
|
-
@context = context
|
6
|
+
@schema_definition = schema_definition
|
7
|
+
@context = context.merge(
|
8
|
+
schema_generation_context?: true
|
9
|
+
)
|
8
10
|
end
|
9
11
|
|
10
12
|
def generate_schema
|
@@ -17,7 +19,7 @@ module NulogyGraphqlApi
|
|
17
19
|
def check_changes
|
18
20
|
return if old_schema.blank?
|
19
21
|
|
20
|
-
SchemaChangesChecker.new.check_changes(old_schema, schema_definition)
|
22
|
+
SchemaChangesChecker.new.check_changes(old_schema, @schema_definition)
|
21
23
|
end
|
22
24
|
|
23
25
|
def old_schema
|
@@ -26,11 +28,6 @@ module NulogyGraphqlApi
|
|
26
28
|
File.read(@schema_output_path)
|
27
29
|
end
|
28
30
|
|
29
|
-
def schema_definition
|
30
|
-
require @schema_definition_path
|
31
|
-
@schema_definition ||= GraphQL::Schema.descendants.first.to_definition(context: @context)
|
32
|
-
end
|
33
|
-
|
34
31
|
def write_schema_to_file
|
35
32
|
File.write(@schema_output_path, schema_definition)
|
36
33
|
puts Rainbow("\nSuccessfully updated #{@schema_output_path}").green
|
data/nulogy_graphql_api.gemspec
CHANGED
@@ -28,15 +28,15 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
|
31
|
-
spec.add_dependency "graphql", "~> 1.
|
32
|
-
spec.add_dependency "graphql-schema_comparator", "~> 0.
|
33
|
-
spec.add_dependency "rails", ">= 5.2.4", "<
|
34
|
-
spec.add_dependency "rainbow", "~> 3.0
|
31
|
+
spec.add_dependency "graphql", "~> 1.12.5"
|
32
|
+
spec.add_dependency "graphql-schema_comparator", "~> 1.0.0"
|
33
|
+
spec.add_dependency "rails", ">= 5.2.4", "< 7.0"
|
34
|
+
spec.add_dependency "rainbow", "~> 3.0"
|
35
35
|
|
36
|
-
spec.add_development_dependency "appraisal", "~> 2.
|
37
|
-
spec.add_development_dependency "rspec-rails", "~>
|
38
|
-
spec.add_development_dependency "rubocop", "~>
|
39
|
-
spec.add_development_dependency "rubocop-performance", "~> 1.
|
40
|
-
spec.add_development_dependency "rubocop-rspec", "~>
|
41
|
-
spec.add_development_dependency "sqlite3", "~> 1.4
|
36
|
+
spec.add_development_dependency "appraisal", "~> 2.4"
|
37
|
+
spec.add_development_dependency "rspec-rails", "~> 5.0"
|
38
|
+
spec.add_development_dependency "rubocop", "~> 1.18"
|
39
|
+
spec.add_development_dependency "rubocop-performance", "~> 1.11"
|
40
|
+
spec.add_development_dependency "rubocop-rspec", "~> 2.4"
|
41
|
+
spec.add_development_dependency "sqlite3", "~> 1.4"
|
42
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nulogy_graphql_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Silva
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.12.5
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.12.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: graphql-schema_comparator
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 1.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 1.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -47,7 +47,7 @@ dependencies:
|
|
47
47
|
version: 5.2.4
|
48
48
|
- - "<"
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version:
|
50
|
+
version: '7.0'
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -57,106 +57,106 @@ dependencies:
|
|
57
57
|
version: 5.2.4
|
58
58
|
- - "<"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
60
|
+
version: '7.0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rainbow
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 3.0
|
67
|
+
version: '3.0'
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 3.0
|
74
|
+
version: '3.0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: appraisal
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 2.
|
81
|
+
version: '2.4'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 2.
|
88
|
+
version: '2.4'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: rspec-rails
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
95
|
+
version: '5.0'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: '5.0'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: rubocop
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
109
|
+
version: '1.18'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: '
|
116
|
+
version: '1.18'
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
118
|
name: rubocop-performance
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
121
|
- - "~>"
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version: '1.
|
123
|
+
version: '1.11'
|
124
124
|
type: :development
|
125
125
|
prerelease: false
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
128
|
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version: '1.
|
130
|
+
version: '1.11'
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
132
|
name: rubocop-rspec
|
133
133
|
requirement: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
135
|
- - "~>"
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version: '
|
137
|
+
version: '2.4'
|
138
138
|
type: :development
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: '
|
144
|
+
version: '2.4'
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
146
|
name: sqlite3
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
148
148
|
requirements:
|
149
149
|
- - "~>"
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version: 1.4
|
151
|
+
version: '1.4'
|
152
152
|
type: :development
|
153
153
|
prerelease: false
|
154
154
|
version_requirements: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
156
|
- - "~>"
|
157
157
|
- !ruby/object:Gem::Version
|
158
|
-
version: 1.4
|
159
|
-
description:
|
158
|
+
version: '1.4'
|
159
|
+
description:
|
160
160
|
email:
|
161
161
|
- danielsi@nulogy.com
|
162
162
|
executables: []
|
@@ -178,8 +178,8 @@ files:
|
|
178
178
|
- Rakefile
|
179
179
|
- bin/console
|
180
180
|
- bin/setup
|
181
|
-
- gemfiles/rails_5.gemfile
|
182
181
|
- gemfiles/rails_6.gemfile
|
182
|
+
- gemfiles/rails_6_1.gemfile
|
183
183
|
- lib/nulogy_graphql_api.rb
|
184
184
|
- lib/nulogy_graphql_api/error_handling.rb
|
185
185
|
- lib/nulogy_graphql_api/graphql_error.rb
|
@@ -189,6 +189,7 @@ files:
|
|
189
189
|
- lib/nulogy_graphql_api/rspec.rb
|
190
190
|
- lib/nulogy_graphql_api/rspec/graphql_helpers.rb
|
191
191
|
- lib/nulogy_graphql_api/rspec/graphql_matchers.rb
|
192
|
+
- lib/nulogy_graphql_api/schema/base_mutation.rb
|
192
193
|
- lib/nulogy_graphql_api/tasks/schema_changes_checker.rb
|
193
194
|
- lib/nulogy_graphql_api/tasks/schema_generator.rb
|
194
195
|
- lib/nulogy_graphql_api/transaction_service.rb
|
@@ -205,7 +206,7 @@ metadata:
|
|
205
206
|
changelog_uri: https://github.com/nulogy/nulogy_graphql_api/blob/master/CHANGELOG.md
|
206
207
|
source_code_uri: https://github.com/nulogy/nulogy_graphql_api
|
207
208
|
bug_tracker_uri: https://github.com/nulogy/nulogy_graphql_api/issues
|
208
|
-
post_install_message:
|
209
|
+
post_install_message:
|
209
210
|
rdoc_options: []
|
210
211
|
require_paths:
|
211
212
|
- lib
|
@@ -220,8 +221,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
220
221
|
- !ruby/object:Gem::Version
|
221
222
|
version: '0'
|
222
223
|
requirements: []
|
223
|
-
rubygems_version: 3.
|
224
|
-
signing_key:
|
224
|
+
rubygems_version: 3.1.6
|
225
|
+
signing_key:
|
225
226
|
specification_version: 4
|
226
227
|
summary: Standard tooling for building GraphQL apis
|
227
228
|
test_files: []
|