graphiti-rails 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/README.md +9 -2
- data/lib/generators/graphiti/install_generator.rb +4 -2
- data/lib/generators/graphiti/resource_generator.rb +33 -1
- data/lib/graphiti/rails/railtie.rb +6 -3
- data/lib/graphiti/rails/version.rb +1 -1
- metadata +10 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3cb2af7e1da395f7c8951308c9dbff54d2e063f9b4f8c967d740a308522729dd
|
|
4
|
+
data.tar.gz: f5bb3b634103ac8e1b2b8228aa5c1e65c5871fb685da0763c396f059132a9fa2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bfdf37ae83725b01a7d60be6b51c92c4040d16e5c07ca9da4baf71e19d422b41af11a7f532abf9c4f3f1b48796fc95a6fbf4bfa2a5d5ef45de31b60043a30b1d
|
|
7
|
+
data.tar.gz: 2d68fd189ad25d681bdfd901a01a058beb047353e537ec4f362f4bfd6ac67ab55d7420fa066eeddd04db7ccbbb647a8d17588ebb7d2a289caab48ce2166dc8e2
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
graphiti-rails changelog
|
|
2
|
+
|
|
3
|
+
## [0.4.2](https://github.com/graphiti-api/graphiti-rails/compare/v0.4.1...v0.4.2) (2026-08-07)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* mark the gem deprecated and cap graphiti explicitly, and update readme ([686f332](https://github.com/graphiti-api/graphiti-rails/commit/686f332041b250e5ca281a577a1ce1c983d07fce))
|
|
9
|
+
|
|
10
|
+
## [0.4.1](https://github.com/graphiti-api/graphiti-rails/compare/v0.4.0...v0.4.1) (2025-03-21)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* `register_parameter_parser` overiding custom config ([#109](https://github.com/graphiti-api/graphiti-rails/issues/109)) ([a135bfa](https://github.com/graphiti-api/graphiti-rails/commit/a135bfa7729b921cf57563916567e272237b6b1f))
|
|
16
|
+
* Add basic column type conversion. ([#83](https://github.com/graphiti-api/graphiti-rails/issues/83)) ([e5bbc92](https://github.com/graphiti-api/graphiti-rails/commit/e5bbc92335376311f02af71d0db3ddc13bdd1ad9))
|
|
17
|
+
* Add condition to check RSpec availability in install generator ([#63](https://github.com/graphiti-api/graphiti-rails/issues/63)) ([13895d9](https://github.com/graphiti-api/graphiti-rails/commit/13895d98f8784f5552256840fd44caaa80c4717b))
|
|
18
|
+
* rspec double was leaking across tests ([#105](https://github.com/graphiti-api/graphiti-rails/issues/105)) ([b38faf2](https://github.com/graphiti-api/graphiti-rails/commit/b38faf2a02bd9e5e91e9014ca060092d7398b47d))
|
|
19
|
+
* Stringify path if Rails version > 7 ([#107](https://github.com/graphiti-api/graphiti-rails/issues/107)) ([47d356c](https://github.com/graphiti-api/graphiti-rails/commit/47d356c23c3d800e83236227a6684fc40af360af))
|
|
20
|
+
|
|
1
21
|
# Changelog
|
|
2
22
|
|
|
3
23
|
All notable changes to this project will be documented in this file.
|
|
@@ -7,6 +27,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
27
|
|
|
8
28
|
---
|
|
9
29
|
|
|
30
|
+
## [0.4.0] - 2022-02-03
|
|
31
|
+
- `rescue_registry` has been updated to 0.4.0 for Ruby 3.1 support.
|
|
32
|
+
|
|
10
33
|
## [0.3.0] - 2021-05-11
|
|
11
34
|
### Changed
|
|
12
35
|
- `rescue_registry` has been updated to 0.3.0. This causes some changes to error payloads.
|
data/README.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Graphiti::Rails
|
|
2
2
|
|
|
3
|
+
> ### This gem is retired
|
|
4
|
+
>
|
|
5
|
+
> `graphiti-rails` is part of [graphiti](https://github.com/graphiti-api/graphiti) itself as of graphiti 2.0, and is no longer developed here. Issues and pull requests live in the [graphiti repo](https://github.com/graphiti-api/graphiti/issues).
|
|
6
|
+
>
|
|
7
|
+
> To upgrade from Graphiti 1.x to 2.x, follow the [upgrade guide](https://graphiti.dev/upgrading).
|
|
8
|
+
|
|
9
|
+
|
|
3
10
|
Graphiti::Rails provides robust Rails integration for Graphiti, following standard Rails conventions.
|
|
4
11
|
|
|
5
12
|
## Usage
|
|
@@ -58,7 +65,7 @@ For more information about Graphiti context, see the [Graphiti docs][context].
|
|
|
58
65
|
We also provide hooks for Graphiti's built-in debugger. For more information see the [Graphiti docs][debugger].
|
|
59
66
|
|
|
60
67
|
## Contributing
|
|
61
|
-
We'd love to have your help improving graphiti-rails. To chat with the team and other users, join the `#
|
|
68
|
+
We'd love to have your help improving graphiti-rails. To chat with the team and other users, join the `#development` channel on [Discord][discord].
|
|
62
69
|
|
|
63
70
|
## License
|
|
64
71
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
@@ -69,4 +76,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
69
76
|
[debugger]: https://www.graphiti.dev/guides/concepts/debugging#debugger
|
|
70
77
|
[rescue-from]: https://api.rubyonrails.org/classes/ActiveSupport/Rescuable/ClassMethods.html#method-i-rescue_from
|
|
71
78
|
[show-exceptions]: https://api.rubyonrails.org/classes/ActionDispatch/ShowExceptions.html
|
|
72
|
-
[
|
|
79
|
+
[discord]: https://discord.gg/wgqkMBsSRV
|
|
@@ -41,8 +41,10 @@ module Graphiti
|
|
|
41
41
|
RUBY
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
"
|
|
44
|
+
if defined?(RSpec)
|
|
45
|
+
inject_into_file "spec/rails_helper.rb", after: /RSpec.configure.+^end$/m do
|
|
46
|
+
"\n\nGraphitiSpecHelpers::RSpec.schema!"
|
|
47
|
+
end
|
|
46
48
|
end
|
|
47
49
|
|
|
48
50
|
insert_into_file "config/routes.rb", after: "Rails.application.routes.draw do\n" do
|
|
@@ -100,7 +100,10 @@ module Graphiti
|
|
|
100
100
|
end
|
|
101
101
|
if attributes_class.table_exists?
|
|
102
102
|
return attributes_class.columns.map do |c|
|
|
103
|
-
OpenStruct.new({
|
|
103
|
+
OpenStruct.new({
|
|
104
|
+
name: c.name.to_sym,
|
|
105
|
+
type: convert_column_type_to_graphiti_resource_type(c.type)
|
|
106
|
+
})
|
|
104
107
|
end
|
|
105
108
|
else
|
|
106
109
|
raise "#{attributes_class} table must exist. Please run migrations."
|
|
@@ -181,5 +184,34 @@ module Graphiti
|
|
|
181
184
|
def type
|
|
182
185
|
model_klass.name.underscore.pluralize
|
|
183
186
|
end
|
|
187
|
+
|
|
188
|
+
def convert_column_type_to_graphiti_resource_type(type)
|
|
189
|
+
# TODO: Support database specific types.
|
|
190
|
+
case type
|
|
191
|
+
when :string, :text
|
|
192
|
+
:string
|
|
193
|
+
when :float, :decimal
|
|
194
|
+
:integer
|
|
195
|
+
when :integer, :bigint
|
|
196
|
+
:integer
|
|
197
|
+
when :datetime, :time
|
|
198
|
+
:datetime
|
|
199
|
+
when :date
|
|
200
|
+
:date
|
|
201
|
+
when :boolean
|
|
202
|
+
:boolean
|
|
203
|
+
when :numeric
|
|
204
|
+
# TODO: Return type.
|
|
205
|
+
type
|
|
206
|
+
when :primary_key
|
|
207
|
+
# TODO: Return type.
|
|
208
|
+
type
|
|
209
|
+
when :binary
|
|
210
|
+
# TODO: Return type.
|
|
211
|
+
type
|
|
212
|
+
else
|
|
213
|
+
type
|
|
214
|
+
end
|
|
215
|
+
end
|
|
184
216
|
end
|
|
185
217
|
end
|
|
@@ -72,9 +72,9 @@ module Graphiti
|
|
|
72
72
|
|
|
73
73
|
def register_parameter_parser
|
|
74
74
|
if ::Rails::VERSION::MAJOR >= 5
|
|
75
|
-
ActionDispatch::Request.parameter_parsers[:jsonapi]
|
|
75
|
+
ActionDispatch::Request.parameter_parsers[:jsonapi] ||= PARSER
|
|
76
76
|
else
|
|
77
|
-
ActionDispatch::ParamsParser::DEFAULT_PARSERS[Mime[:jsonapi]]
|
|
77
|
+
ActionDispatch::ParamsParser::DEFAULT_PARSERS[Mime[:jsonapi]] ||= PARSER
|
|
78
78
|
end
|
|
79
79
|
end
|
|
80
80
|
|
|
@@ -131,8 +131,11 @@ module Graphiti
|
|
|
131
131
|
end
|
|
132
132
|
|
|
133
133
|
route = begin
|
|
134
|
+
if Gem::Version.new(::Rails::VERSION::STRING) >= Gem::Version.new("7.0.0")
|
|
135
|
+
path = path.to_s
|
|
136
|
+
end
|
|
134
137
|
::Rails.application.routes.recognize_path(path, method: method)
|
|
135
|
-
rescue
|
|
138
|
+
rescue => e
|
|
136
139
|
nil
|
|
137
140
|
end
|
|
138
141
|
"#{route[:controller]}_controller".classify.safe_constantize if route
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: graphiti-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter Wagenet
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-08-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: graphiti
|
|
@@ -17,6 +17,9 @@ dependencies:
|
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: '1.2'
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: 2.a
|
|
20
23
|
type: :runtime
|
|
21
24
|
prerelease: false
|
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -24,6 +27,9 @@ dependencies:
|
|
|
24
27
|
- - "~>"
|
|
25
28
|
- !ruby/object:Gem::Version
|
|
26
29
|
version: '1.2'
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: 2.a
|
|
27
33
|
- !ruby/object:Gem::Dependency
|
|
28
34
|
name: rescue_registry
|
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -251,8 +257,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
251
257
|
- !ruby/object:Gem::Version
|
|
252
258
|
version: '0'
|
|
253
259
|
requirements: []
|
|
254
|
-
rubygems_version: 3.3.
|
|
260
|
+
rubygems_version: 3.3.27
|
|
255
261
|
signing_key:
|
|
256
262
|
specification_version: 4
|
|
257
|
-
summary:
|
|
263
|
+
summary: Deprecated - part of graphiti itself as of graphiti 2.0
|
|
258
264
|
test_files: []
|