jpie 0.4.5 → 1.0.1
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/.cursor/rules/release.mdc +62 -0
- data/.gitignore +26 -0
- data/.rspec +3 -0
- data/.rubocop.yml +76 -107
- data/.travis.yml +7 -0
- data/Gemfile +23 -0
- data/Gemfile.lock +321 -0
- data/README.md +1508 -136
- data/Rakefile +3 -14
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/jpie.gemspec +21 -38
- data/kiln/app/resources/user_message_resource.rb +4 -0
- data/lib/jpie.rb +3 -25
- data/lib/json_api/active_storage/deserialization.rb +116 -0
- data/lib/json_api/active_storage/detection.rb +69 -0
- data/lib/json_api/active_storage/serialization.rb +34 -0
- data/lib/json_api/configuration.rb +57 -0
- data/lib/json_api/controllers/base_controller.rb +26 -0
- data/lib/json_api/controllers/concerns/controller_helpers/authorization.rb +30 -0
- data/lib/json_api/controllers/concerns/controller_helpers/document_meta.rb +20 -0
- data/lib/json_api/controllers/concerns/controller_helpers/error_rendering.rb +64 -0
- data/lib/json_api/controllers/concerns/controller_helpers/parsing.rb +127 -0
- data/lib/json_api/controllers/concerns/controller_helpers/resource_setup.rb +38 -0
- data/lib/json_api/controllers/concerns/controller_helpers.rb +19 -0
- data/lib/json_api/controllers/concerns/relationships/active_storage_removal.rb +65 -0
- data/lib/json_api/controllers/concerns/relationships/events.rb +44 -0
- data/lib/json_api/controllers/concerns/relationships/removal.rb +92 -0
- data/lib/json_api/controllers/concerns/relationships/response_helpers.rb +55 -0
- data/lib/json_api/controllers/concerns/relationships/serialization.rb +72 -0
- data/lib/json_api/controllers/concerns/relationships/sorting.rb +114 -0
- data/lib/json_api/controllers/concerns/relationships/updating.rb +73 -0
- data/lib/json_api/controllers/concerns/relationships_controller/active_storage_removal.rb +67 -0
- data/lib/json_api/controllers/concerns/relationships_controller/events.rb +44 -0
- data/lib/json_api/controllers/concerns/relationships_controller/removal.rb +92 -0
- data/lib/json_api/controllers/concerns/relationships_controller/response_helpers.rb +55 -0
- data/lib/json_api/controllers/concerns/relationships_controller/serialization.rb +72 -0
- data/lib/json_api/controllers/concerns/relationships_controller/sorting.rb +114 -0
- data/lib/json_api/controllers/concerns/relationships_controller/updating.rb +73 -0
- data/lib/json_api/controllers/concerns/resource_actions/crud_helpers.rb +93 -0
- data/lib/json_api/controllers/concerns/resource_actions/field_validation.rb +114 -0
- data/lib/json_api/controllers/concerns/resource_actions/filter_validation.rb +91 -0
- data/lib/json_api/controllers/concerns/resource_actions/pagination.rb +51 -0
- data/lib/json_api/controllers/concerns/resource_actions/preloading.rb +64 -0
- data/lib/json_api/controllers/concerns/resource_actions/resource_loading.rb +71 -0
- data/lib/json_api/controllers/concerns/resource_actions/serialization.rb +63 -0
- data/lib/json_api/controllers/concerns/resource_actions/type_validation.rb +75 -0
- data/lib/json_api/controllers/concerns/resource_actions.rb +106 -0
- data/lib/json_api/controllers/relationships_controller.rb +108 -0
- data/lib/json_api/controllers/resources_controller.rb +6 -0
- data/lib/json_api/errors/parameter_not_allowed.rb +19 -0
- data/lib/json_api/railtie.rb +112 -0
- data/lib/json_api/resources/active_storage_blob_resource.rb +19 -0
- data/lib/json_api/resources/concerns/attributes_dsl.rb +69 -0
- data/lib/json_api/resources/concerns/filters_dsl.rb +32 -0
- data/lib/json_api/resources/concerns/meta_dsl.rb +23 -0
- data/lib/json_api/resources/concerns/model_class_helpers.rb +37 -0
- data/lib/json_api/resources/concerns/relationships_dsl.rb +71 -0
- data/lib/json_api/resources/concerns/sortable_fields_dsl.rb +36 -0
- data/lib/json_api/resources/resource.rb +32 -0
- data/lib/json_api/resources/resource_loader.rb +35 -0
- data/lib/json_api/routing.rb +81 -0
- data/lib/json_api/serialization/concerns/attributes_deserialization.rb +27 -0
- data/lib/json_api/serialization/concerns/attributes_serialization.rb +50 -0
- data/lib/json_api/serialization/concerns/deserialization_helpers.rb +115 -0
- data/lib/json_api/serialization/concerns/includes_serialization.rb +82 -0
- data/lib/json_api/serialization/concerns/links_serialization.rb +33 -0
- data/lib/json_api/serialization/concerns/meta_serialization.rb +60 -0
- data/lib/json_api/serialization/concerns/model_attributes_transformation.rb +69 -0
- data/lib/json_api/serialization/concerns/relationship_processing.rb +119 -0
- data/lib/json_api/serialization/concerns/relationships_deserialization.rb +47 -0
- data/lib/json_api/serialization/concerns/relationships_serialization.rb +81 -0
- data/lib/json_api/serialization/deserializer.rb +26 -0
- data/lib/json_api/serialization/serializer.rb +77 -0
- data/lib/json_api/support/active_storage_support.rb +82 -0
- data/lib/json_api/support/collection_query.rb +50 -0
- data/lib/json_api/support/concerns/condition_building.rb +57 -0
- data/lib/json_api/support/concerns/nested_filters.rb +130 -0
- data/lib/json_api/support/concerns/pagination.rb +30 -0
- data/lib/json_api/support/concerns/polymorphic_filters.rb +75 -0
- data/lib/json_api/support/concerns/regular_filters.rb +81 -0
- data/lib/json_api/support/concerns/sorting.rb +88 -0
- data/lib/json_api/support/instrumentation.rb +43 -0
- data/lib/json_api/support/param_helpers.rb +54 -0
- data/lib/json_api/support/relationship_guard.rb +16 -0
- data/lib/json_api/support/relationship_helpers.rb +76 -0
- data/lib/json_api/support/resource_identifier.rb +87 -0
- data/lib/json_api/support/responders.rb +100 -0
- data/lib/json_api/support/response_helpers.rb +10 -0
- data/lib/json_api/support/sort_parsing.rb +21 -0
- data/lib/json_api/support/type_conversion.rb +21 -0
- data/lib/json_api/testing/test_helper.rb +76 -0
- data/lib/json_api/testing.rb +3 -0
- data/lib/{jpie → json_api}/version.rb +2 -2
- data/lib/json_api.rb +50 -0
- data/lib/rubocop/cop/custom/hash_value_omission.rb +53 -0
- metadata +100 -169
- data/.cursor/rules/dependencies.mdc +0 -19
- data/.cursor/rules/examples.mdc +0 -16
- data/.cursor/rules/git.mdc +0 -14
- data/.cursor/rules/project_structure.mdc +0 -30
- data/.cursor/rules/publish_gem.mdc +0 -73
- data/.cursor/rules/security.mdc +0 -14
- data/.cursor/rules/style.mdc +0 -15
- data/.cursor/rules/testing.mdc +0 -16
- data/.overcommit.yml +0 -35
- data/CHANGELOG.md +0 -164
- data/LICENSE.txt +0 -21
- data/PUBLISHING.md +0 -111
- data/examples/basic_example.md +0 -146
- data/examples/including_related_resources.md +0 -491
- data/examples/pagination.md +0 -303
- data/examples/relationships.md +0 -114
- data/examples/resource_attribute_configuration.md +0 -147
- data/examples/resource_meta_configuration.md +0 -244
- data/examples/rspec_testing.md +0 -130
- data/examples/single_table_inheritance.md +0 -160
- data/lib/jpie/configuration.rb +0 -12
- data/lib/jpie/controller/crud_actions.rb +0 -141
- data/lib/jpie/controller/error_handling/handler_setup.rb +0 -124
- data/lib/jpie/controller/error_handling/handlers.rb +0 -109
- data/lib/jpie/controller/error_handling.rb +0 -23
- data/lib/jpie/controller/json_api_validation.rb +0 -193
- data/lib/jpie/controller/parameter_parsing.rb +0 -78
- data/lib/jpie/controller/related_actions.rb +0 -45
- data/lib/jpie/controller/relationship_actions.rb +0 -291
- data/lib/jpie/controller/relationship_validation.rb +0 -117
- data/lib/jpie/controller/rendering.rb +0 -154
- data/lib/jpie/controller.rb +0 -45
- data/lib/jpie/deserializer.rb +0 -110
- data/lib/jpie/errors.rb +0 -117
- data/lib/jpie/generators/resource_generator.rb +0 -116
- data/lib/jpie/generators/templates/resource.rb.erb +0 -31
- data/lib/jpie/railtie.rb +0 -42
- data/lib/jpie/resource/attributable.rb +0 -112
- data/lib/jpie/resource/inferrable.rb +0 -43
- data/lib/jpie/resource/sortable.rb +0 -93
- data/lib/jpie/resource.rb +0 -147
- data/lib/jpie/routing.rb +0 -59
- data/lib/jpie/serializer.rb +0 -205
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RuboCop
|
|
4
|
+
module Cop
|
|
5
|
+
module Custom
|
|
6
|
+
# Enforces hash value omission syntax introduced in Ruby 3.1
|
|
7
|
+
# When a hash key and value have the same name, use the shorthand syntax.
|
|
8
|
+
#
|
|
9
|
+
# @example
|
|
10
|
+
# # bad
|
|
11
|
+
# { controller: controller }
|
|
12
|
+
# { foo: foo, bar: bar }
|
|
13
|
+
#
|
|
14
|
+
# # good
|
|
15
|
+
# { controller: }
|
|
16
|
+
# { foo:, bar: }
|
|
17
|
+
class HashValueOmission < Base
|
|
18
|
+
extend AutoCorrector
|
|
19
|
+
|
|
20
|
+
MSG = "Use hash value omission (`%<key>s:`) when the value is the same-named local variable."
|
|
21
|
+
|
|
22
|
+
def on_pair(node)
|
|
23
|
+
return unless valid_pair_for_omission?(node)
|
|
24
|
+
|
|
25
|
+
key_name = node.key.value.to_s
|
|
26
|
+
return if already_omitted?(node, key_name)
|
|
27
|
+
return unless same_name?(node, key_name)
|
|
28
|
+
|
|
29
|
+
add_offense(node, message: format(MSG, key: key_name)) do |corrector|
|
|
30
|
+
corrector.replace(node.source_range, "#{key_name}:")
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def valid_pair_for_omission?(node)
|
|
35
|
+
key = node.key
|
|
36
|
+
value = node.value
|
|
37
|
+
|
|
38
|
+
key.sym_type? && value&.lvar_type?
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def already_omitted?(node, key_name)
|
|
42
|
+
source = node.source.strip
|
|
43
|
+
source == "#{key_name}:"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def same_name?(node, key_name)
|
|
47
|
+
value_name = node.value.source
|
|
48
|
+
key_name == value_name
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
metadata
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jpie
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Emil Kampp
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
|
-
name:
|
|
13
|
+
name: actionpack
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
@@ -49,183 +49,114 @@ dependencies:
|
|
|
49
49
|
- - ">="
|
|
50
50
|
- !ruby/object:Gem::Version
|
|
51
51
|
version: 8.0.0
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
requirement: !ruby/object:Gem::Requirement
|
|
55
|
-
requirements:
|
|
56
|
-
- - "~>"
|
|
57
|
-
- !ruby/object:Gem::Version
|
|
58
|
-
version: '6.0'
|
|
59
|
-
type: :development
|
|
60
|
-
prerelease: false
|
|
61
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
62
|
-
requirements:
|
|
63
|
-
- - "~>"
|
|
64
|
-
- !ruby/object:Gem::Version
|
|
65
|
-
version: '6.0'
|
|
66
|
-
- !ruby/object:Gem::Dependency
|
|
67
|
-
name: rake
|
|
68
|
-
requirement: !ruby/object:Gem::Requirement
|
|
69
|
-
requirements:
|
|
70
|
-
- - "~>"
|
|
71
|
-
- !ruby/object:Gem::Version
|
|
72
|
-
version: '13.0'
|
|
73
|
-
type: :development
|
|
74
|
-
prerelease: false
|
|
75
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
76
|
-
requirements:
|
|
77
|
-
- - "~>"
|
|
78
|
-
- !ruby/object:Gem::Version
|
|
79
|
-
version: '13.0'
|
|
80
|
-
- !ruby/object:Gem::Dependency
|
|
81
|
-
name: rspec
|
|
82
|
-
requirement: !ruby/object:Gem::Requirement
|
|
83
|
-
requirements:
|
|
84
|
-
- - "~>"
|
|
85
|
-
- !ruby/object:Gem::Version
|
|
86
|
-
version: '3.12'
|
|
87
|
-
type: :development
|
|
88
|
-
prerelease: false
|
|
89
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
90
|
-
requirements:
|
|
91
|
-
- - "~>"
|
|
92
|
-
- !ruby/object:Gem::Version
|
|
93
|
-
version: '3.12'
|
|
94
|
-
- !ruby/object:Gem::Dependency
|
|
95
|
-
name: rspec-rails
|
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
|
97
|
-
requirements:
|
|
98
|
-
- - "~>"
|
|
99
|
-
- !ruby/object:Gem::Version
|
|
100
|
-
version: '7.0'
|
|
101
|
-
type: :development
|
|
102
|
-
prerelease: false
|
|
103
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
104
|
-
requirements:
|
|
105
|
-
- - "~>"
|
|
106
|
-
- !ruby/object:Gem::Version
|
|
107
|
-
version: '7.0'
|
|
108
|
-
- !ruby/object:Gem::Dependency
|
|
109
|
-
name: rubocop
|
|
110
|
-
requirement: !ruby/object:Gem::Requirement
|
|
111
|
-
requirements:
|
|
112
|
-
- - "~>"
|
|
113
|
-
- !ruby/object:Gem::Version
|
|
114
|
-
version: '1.50'
|
|
115
|
-
type: :development
|
|
116
|
-
prerelease: false
|
|
117
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
118
|
-
requirements:
|
|
119
|
-
- - "~>"
|
|
120
|
-
- !ruby/object:Gem::Version
|
|
121
|
-
version: '1.50'
|
|
122
|
-
- !ruby/object:Gem::Dependency
|
|
123
|
-
name: rubocop-performance
|
|
124
|
-
requirement: !ruby/object:Gem::Requirement
|
|
125
|
-
requirements:
|
|
126
|
-
- - "~>"
|
|
127
|
-
- !ruby/object:Gem::Version
|
|
128
|
-
version: '1.16'
|
|
129
|
-
type: :development
|
|
130
|
-
prerelease: false
|
|
131
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
132
|
-
requirements:
|
|
133
|
-
- - "~>"
|
|
134
|
-
- !ruby/object:Gem::Version
|
|
135
|
-
version: '1.16'
|
|
136
|
-
- !ruby/object:Gem::Dependency
|
|
137
|
-
name: rubocop-rails
|
|
138
|
-
requirement: !ruby/object:Gem::Requirement
|
|
139
|
-
requirements:
|
|
140
|
-
- - "~>"
|
|
141
|
-
- !ruby/object:Gem::Version
|
|
142
|
-
version: '2.18'
|
|
143
|
-
type: :development
|
|
144
|
-
prerelease: false
|
|
145
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
146
|
-
requirements:
|
|
147
|
-
- - "~>"
|
|
148
|
-
- !ruby/object:Gem::Version
|
|
149
|
-
version: '2.18'
|
|
150
|
-
- !ruby/object:Gem::Dependency
|
|
151
|
-
name: rubocop-rspec
|
|
152
|
-
requirement: !ruby/object:Gem::Requirement
|
|
153
|
-
requirements:
|
|
154
|
-
- - "~>"
|
|
155
|
-
- !ruby/object:Gem::Version
|
|
156
|
-
version: '2.20'
|
|
157
|
-
type: :development
|
|
158
|
-
prerelease: false
|
|
159
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
160
|
-
requirements:
|
|
161
|
-
- - "~>"
|
|
162
|
-
- !ruby/object:Gem::Version
|
|
163
|
-
version: '2.20'
|
|
164
|
-
description: JPie provides a framework for developing JSON:API compliant servers with
|
|
165
|
-
Rails 8+. It focuses on clean architecture with strong separation of concerns.
|
|
52
|
+
description: A Rails 8+ gem that provides jsonapi_resources routing DSL and generic
|
|
53
|
+
JSON:API controllers
|
|
166
54
|
email:
|
|
167
|
-
- emil@
|
|
55
|
+
- emil@kampp.me
|
|
168
56
|
executables: []
|
|
169
57
|
extensions: []
|
|
170
58
|
extra_rdoc_files: []
|
|
171
59
|
files:
|
|
172
|
-
- ".cursor/rules/
|
|
173
|
-
- ".
|
|
174
|
-
- ".
|
|
175
|
-
- ".cursor/rules/project_structure.mdc"
|
|
176
|
-
- ".cursor/rules/publish_gem.mdc"
|
|
177
|
-
- ".cursor/rules/security.mdc"
|
|
178
|
-
- ".cursor/rules/style.mdc"
|
|
179
|
-
- ".cursor/rules/testing.mdc"
|
|
180
|
-
- ".overcommit.yml"
|
|
60
|
+
- ".cursor/rules/release.mdc"
|
|
61
|
+
- ".gitignore"
|
|
62
|
+
- ".rspec"
|
|
181
63
|
- ".rubocop.yml"
|
|
182
|
-
-
|
|
183
|
-
-
|
|
184
|
-
-
|
|
64
|
+
- ".travis.yml"
|
|
65
|
+
- Gemfile
|
|
66
|
+
- Gemfile.lock
|
|
185
67
|
- README.md
|
|
186
68
|
- Rakefile
|
|
187
|
-
-
|
|
188
|
-
-
|
|
189
|
-
- examples/pagination.md
|
|
190
|
-
- examples/relationships.md
|
|
191
|
-
- examples/resource_attribute_configuration.md
|
|
192
|
-
- examples/resource_meta_configuration.md
|
|
193
|
-
- examples/rspec_testing.md
|
|
194
|
-
- examples/single_table_inheritance.md
|
|
69
|
+
- bin/console
|
|
70
|
+
- bin/setup
|
|
195
71
|
- jpie.gemspec
|
|
72
|
+
- kiln/app/resources/user_message_resource.rb
|
|
196
73
|
- lib/jpie.rb
|
|
197
|
-
- lib/
|
|
198
|
-
- lib/
|
|
199
|
-
- lib/
|
|
200
|
-
- lib/
|
|
201
|
-
- lib/
|
|
202
|
-
- lib/
|
|
203
|
-
- lib/
|
|
204
|
-
- lib/
|
|
205
|
-
- lib/
|
|
206
|
-
- lib/
|
|
207
|
-
- lib/
|
|
208
|
-
- lib/
|
|
209
|
-
- lib/
|
|
210
|
-
- lib/
|
|
211
|
-
- lib/
|
|
212
|
-
- lib/
|
|
213
|
-
- lib/
|
|
214
|
-
- lib/
|
|
215
|
-
- lib/
|
|
216
|
-
- lib/
|
|
217
|
-
- lib/
|
|
218
|
-
- lib/
|
|
219
|
-
- lib/
|
|
220
|
-
- lib/
|
|
221
|
-
|
|
74
|
+
- lib/json_api.rb
|
|
75
|
+
- lib/json_api/active_storage/deserialization.rb
|
|
76
|
+
- lib/json_api/active_storage/detection.rb
|
|
77
|
+
- lib/json_api/active_storage/serialization.rb
|
|
78
|
+
- lib/json_api/configuration.rb
|
|
79
|
+
- lib/json_api/controllers/base_controller.rb
|
|
80
|
+
- lib/json_api/controllers/concerns/controller_helpers.rb
|
|
81
|
+
- lib/json_api/controllers/concerns/controller_helpers/authorization.rb
|
|
82
|
+
- lib/json_api/controllers/concerns/controller_helpers/document_meta.rb
|
|
83
|
+
- lib/json_api/controllers/concerns/controller_helpers/error_rendering.rb
|
|
84
|
+
- lib/json_api/controllers/concerns/controller_helpers/parsing.rb
|
|
85
|
+
- lib/json_api/controllers/concerns/controller_helpers/resource_setup.rb
|
|
86
|
+
- lib/json_api/controllers/concerns/relationships/active_storage_removal.rb
|
|
87
|
+
- lib/json_api/controllers/concerns/relationships/events.rb
|
|
88
|
+
- lib/json_api/controllers/concerns/relationships/removal.rb
|
|
89
|
+
- lib/json_api/controllers/concerns/relationships/response_helpers.rb
|
|
90
|
+
- lib/json_api/controllers/concerns/relationships/serialization.rb
|
|
91
|
+
- lib/json_api/controllers/concerns/relationships/sorting.rb
|
|
92
|
+
- lib/json_api/controllers/concerns/relationships/updating.rb
|
|
93
|
+
- lib/json_api/controllers/concerns/relationships_controller/active_storage_removal.rb
|
|
94
|
+
- lib/json_api/controllers/concerns/relationships_controller/events.rb
|
|
95
|
+
- lib/json_api/controllers/concerns/relationships_controller/removal.rb
|
|
96
|
+
- lib/json_api/controllers/concerns/relationships_controller/response_helpers.rb
|
|
97
|
+
- lib/json_api/controllers/concerns/relationships_controller/serialization.rb
|
|
98
|
+
- lib/json_api/controllers/concerns/relationships_controller/sorting.rb
|
|
99
|
+
- lib/json_api/controllers/concerns/relationships_controller/updating.rb
|
|
100
|
+
- lib/json_api/controllers/concerns/resource_actions.rb
|
|
101
|
+
- lib/json_api/controllers/concerns/resource_actions/crud_helpers.rb
|
|
102
|
+
- lib/json_api/controllers/concerns/resource_actions/field_validation.rb
|
|
103
|
+
- lib/json_api/controllers/concerns/resource_actions/filter_validation.rb
|
|
104
|
+
- lib/json_api/controllers/concerns/resource_actions/pagination.rb
|
|
105
|
+
- lib/json_api/controllers/concerns/resource_actions/preloading.rb
|
|
106
|
+
- lib/json_api/controllers/concerns/resource_actions/resource_loading.rb
|
|
107
|
+
- lib/json_api/controllers/concerns/resource_actions/serialization.rb
|
|
108
|
+
- lib/json_api/controllers/concerns/resource_actions/type_validation.rb
|
|
109
|
+
- lib/json_api/controllers/relationships_controller.rb
|
|
110
|
+
- lib/json_api/controllers/resources_controller.rb
|
|
111
|
+
- lib/json_api/errors/parameter_not_allowed.rb
|
|
112
|
+
- lib/json_api/railtie.rb
|
|
113
|
+
- lib/json_api/resources/active_storage_blob_resource.rb
|
|
114
|
+
- lib/json_api/resources/concerns/attributes_dsl.rb
|
|
115
|
+
- lib/json_api/resources/concerns/filters_dsl.rb
|
|
116
|
+
- lib/json_api/resources/concerns/meta_dsl.rb
|
|
117
|
+
- lib/json_api/resources/concerns/model_class_helpers.rb
|
|
118
|
+
- lib/json_api/resources/concerns/relationships_dsl.rb
|
|
119
|
+
- lib/json_api/resources/concerns/sortable_fields_dsl.rb
|
|
120
|
+
- lib/json_api/resources/resource.rb
|
|
121
|
+
- lib/json_api/resources/resource_loader.rb
|
|
122
|
+
- lib/json_api/routing.rb
|
|
123
|
+
- lib/json_api/serialization/concerns/attributes_deserialization.rb
|
|
124
|
+
- lib/json_api/serialization/concerns/attributes_serialization.rb
|
|
125
|
+
- lib/json_api/serialization/concerns/deserialization_helpers.rb
|
|
126
|
+
- lib/json_api/serialization/concerns/includes_serialization.rb
|
|
127
|
+
- lib/json_api/serialization/concerns/links_serialization.rb
|
|
128
|
+
- lib/json_api/serialization/concerns/meta_serialization.rb
|
|
129
|
+
- lib/json_api/serialization/concerns/model_attributes_transformation.rb
|
|
130
|
+
- lib/json_api/serialization/concerns/relationship_processing.rb
|
|
131
|
+
- lib/json_api/serialization/concerns/relationships_deserialization.rb
|
|
132
|
+
- lib/json_api/serialization/concerns/relationships_serialization.rb
|
|
133
|
+
- lib/json_api/serialization/deserializer.rb
|
|
134
|
+
- lib/json_api/serialization/serializer.rb
|
|
135
|
+
- lib/json_api/support/active_storage_support.rb
|
|
136
|
+
- lib/json_api/support/collection_query.rb
|
|
137
|
+
- lib/json_api/support/concerns/condition_building.rb
|
|
138
|
+
- lib/json_api/support/concerns/nested_filters.rb
|
|
139
|
+
- lib/json_api/support/concerns/pagination.rb
|
|
140
|
+
- lib/json_api/support/concerns/polymorphic_filters.rb
|
|
141
|
+
- lib/json_api/support/concerns/regular_filters.rb
|
|
142
|
+
- lib/json_api/support/concerns/sorting.rb
|
|
143
|
+
- lib/json_api/support/instrumentation.rb
|
|
144
|
+
- lib/json_api/support/param_helpers.rb
|
|
145
|
+
- lib/json_api/support/relationship_guard.rb
|
|
146
|
+
- lib/json_api/support/relationship_helpers.rb
|
|
147
|
+
- lib/json_api/support/resource_identifier.rb
|
|
148
|
+
- lib/json_api/support/responders.rb
|
|
149
|
+
- lib/json_api/support/response_helpers.rb
|
|
150
|
+
- lib/json_api/support/sort_parsing.rb
|
|
151
|
+
- lib/json_api/support/type_conversion.rb
|
|
152
|
+
- lib/json_api/testing.rb
|
|
153
|
+
- lib/json_api/testing/test_helper.rb
|
|
154
|
+
- lib/json_api/version.rb
|
|
155
|
+
- lib/rubocop/cop/custom/hash_value_omission.rb
|
|
156
|
+
homepage: https://github.com/klaay/json_api
|
|
222
157
|
licenses:
|
|
223
158
|
- MIT
|
|
224
159
|
metadata:
|
|
225
|
-
allowed_push_host: https://rubygems.org
|
|
226
|
-
homepage_uri: https://github.com/emk-klaay/jpie
|
|
227
|
-
source_code_uri: https://github.com/emk-klaay/jpie.git
|
|
228
|
-
changelog_uri: https://github.com/emk-klaay/jpie/blob/main/CHANGELOG.md
|
|
229
160
|
rubygems_mfa_required: 'true'
|
|
230
161
|
rdoc_options: []
|
|
231
162
|
require_paths:
|
|
@@ -241,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
241
172
|
- !ruby/object:Gem::Version
|
|
242
173
|
version: '0'
|
|
243
174
|
requirements: []
|
|
244
|
-
rubygems_version: 3.
|
|
175
|
+
rubygems_version: 3.7.2
|
|
245
176
|
specification_version: 4
|
|
246
|
-
summary:
|
|
177
|
+
summary: JSON:API compliant Rails gem for producing and consuming JSON:API resources
|
|
247
178
|
test_files: []
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description:
|
|
3
|
-
globs:
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
---
|
|
6
|
-
# Dependency Management
|
|
7
|
-
|
|
8
|
-
## Requirements
|
|
9
|
-
- Keep dependencies minimal and justified
|
|
10
|
-
- Document new dependencies in README.md
|
|
11
|
-
- Keep development dependencies in Gemfile
|
|
12
|
-
- Ensure compatibility with Ruby 3.4+
|
|
13
|
-
- Only support Rails 8+ features
|
|
14
|
-
- Use modern gem versions
|
|
15
|
-
|
|
16
|
-
## Compatibility Requirements
|
|
17
|
-
- Maintain Ruby 3.4+ compatibility
|
|
18
|
-
- Support Rails 8+ integration
|
|
19
|
-
- Follow JSON:API specification strictly
|
data/.cursor/rules/examples.mdc
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description:
|
|
3
|
-
globs:
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
---
|
|
6
|
-
# Example Guidelines
|
|
7
|
-
|
|
8
|
-
- Examples must only include required code
|
|
9
|
-
- Examples must not include any unrelated or superfluous code
|
|
10
|
-
- Examples must be a single markdown file
|
|
11
|
-
- Examples must use the `http` code blocks for examples
|
|
12
|
-
- Examples must only include the minimum number of examples
|
|
13
|
-
- Examples must never include migrations
|
|
14
|
-
- Examples must not include a features section or similar
|
|
15
|
-
- Examples must include an introduction to the example
|
|
16
|
-
- Examples live in /examples/*.md
|
data/.cursor/rules/git.mdc
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description:
|
|
3
|
-
globs:
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
---
|
|
6
|
-
# Git Commit Guidelines
|
|
7
|
-
|
|
8
|
-
- Write clear, descriptive commit messages
|
|
9
|
-
- Keep commits focused and atomic
|
|
10
|
-
- Run and pass tests before committing
|
|
11
|
-
- Update documentation in the same commit as code changes
|
|
12
|
-
- Ignore spec/examples.txt and other files listed in .gitignore
|
|
13
|
-
- Include Ruby/Rails version requirements in relevant commits
|
|
14
|
-
- Update tests in the same commit as code changes
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description:
|
|
3
|
-
globs:
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
---
|
|
6
|
-
# Project Information
|
|
7
|
-
- Project Name: jpie
|
|
8
|
-
- Description: Ruby gem for JSON:API implementation
|
|
9
|
-
|
|
10
|
-
# Project Structure
|
|
11
|
-
|
|
12
|
-
## Core Structure
|
|
13
|
-
- Keep core functionality in lib/jpie/
|
|
14
|
-
- Place tests in spec/jpie/
|
|
15
|
-
- Use proper namespacing (JPie module)
|
|
16
|
-
- Follow Ruby gem best practices
|
|
17
|
-
|
|
18
|
-
## Protected Files
|
|
19
|
-
- Do not update spec/jpie/database.rb unless absolutely necessary
|
|
20
|
-
- Do not update spec/jpie/resources.rb unless absolutely necessary
|
|
21
|
-
|
|
22
|
-
## Documentation
|
|
23
|
-
- Keep README.md up to date with installation and usage instructions
|
|
24
|
-
- Include example usage in documentation
|
|
25
|
-
|
|
26
|
-
## Development Process
|
|
27
|
-
- Always read the .aiconfig file
|
|
28
|
-
- Always implement code slowly and methodically
|
|
29
|
-
- Always test as you go
|
|
30
|
-
- Always make sure rubocop passes
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# Publish JPie Gem
|
|
2
|
-
|
|
3
|
-
This rule helps publish a new version of the JPie gem.
|
|
4
|
-
|
|
5
|
-
## Requirements
|
|
6
|
-
# Publish JPie Gem
|
|
7
|
-
|
|
8
|
-
This rule helps publish a new version of the JPie gem.
|
|
9
|
-
|
|
10
|
-
## Requirements
|
|
11
|
-
|
|
12
|
-
1. You must have publishing rights on RubyGems.org
|
|
13
|
-
2. You must have 2FA enabled on RubyGems.org
|
|
14
|
-
3. The version must be updated in `lib/jpie/version.rb`
|
|
15
|
-
4. The changelog must be updated in `CHANGELOG.md`
|
|
16
|
-
|
|
17
|
-
## Steps
|
|
18
|
-
|
|
19
|
-
1. First, ensure the version and changelog are updated and committed
|
|
20
|
-
2. Build the gem
|
|
21
|
-
3. Get OTP code from user
|
|
22
|
-
4. Push to RubyGems with OTP
|
|
23
|
-
5. Update bundle
|
|
24
|
-
6. Tag the release
|
|
25
|
-
7. Push tags
|
|
26
|
-
|
|
27
|
-
## Example Chat
|
|
28
|
-
|
|
29
|
-
Human: Publish new version of JPie gem
|
|
30
|
-
|
|
31
|
-
Assistant: I will help you publish the gem. First, let me check if the version and changelog are updated.
|
|
32
|
-
[Checks version and changelog]
|
|
33
|
-
|
|
34
|
-
Now I will build the gem:
|
|
35
|
-
> gem build jpie.gemspec
|
|
36
|
-
|
|
37
|
-
The gem has been built. To publish it, I will need your OTP code from RubyGems.org.
|
|
38
|
-
What is your OTP code?
|
|
39
|
-
|
|
40
|
-
Human: 123456
|
|
41
|
-
|
|
42
|
-
Assistant: Thanks! I will now push the gem with your OTP:
|
|
43
|
-
> gem push jpie-x.y.z.gem --otp 123456
|
|
44
|
-
|
|
45
|
-
Great! The gem has been published. Now I will:
|
|
46
|
-
1. Update the bundle
|
|
47
|
-
> bundle update jpie
|
|
48
|
-
|
|
49
|
-
2. Tag the release
|
|
50
|
-
> git tag -a vx.y.z -m "Version x.y.z"
|
|
51
|
-
|
|
52
|
-
3. Push the tags
|
|
53
|
-
> git push origin --tags
|
|
54
|
-
|
|
55
|
-
The gem has been successfully published and all post-publish steps are complete!
|
|
56
|
-
|
|
57
|
-
## Automation
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
# Build the gem
|
|
61
|
-
gem build jpie.gemspec
|
|
62
|
-
|
|
63
|
-
# Push to RubyGems (OTP will be requested via chat)
|
|
64
|
-
gem push jpie-*.gem --otp ${OTP_CODE}
|
|
65
|
-
|
|
66
|
-
# Update bundle
|
|
67
|
-
bundle update jpie
|
|
68
|
-
|
|
69
|
-
# Tag and push
|
|
70
|
-
VERSION=$(ruby -r ./lib/jpie/version.rb -e "puts JPie::VERSION")
|
|
71
|
-
git tag -a v${VERSION} -m "Version ${VERSION}"
|
|
72
|
-
git push origin --tags
|
|
73
|
-
```
|
data/.cursor/rules/security.mdc
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description:
|
|
3
|
-
globs:
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
---
|
|
6
|
-
# Security Guidelines
|
|
7
|
-
|
|
8
|
-
- Never commit sensitive data or credentials
|
|
9
|
-
- Use environment variables for configuration
|
|
10
|
-
- Follow secure coding practices
|
|
11
|
-
- Keep dependencies up to date
|
|
12
|
-
- Follow Rails 8+ security best practices
|
|
13
|
-
- Use Ruby 3.4+ security features
|
|
14
|
-
- Implement proper input validation
|
data/.cursor/rules/style.mdc
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description:
|
|
3
|
-
globs:
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
---
|
|
6
|
-
# Style Guidelines
|
|
7
|
-
|
|
8
|
-
## Ruby Style
|
|
9
|
-
- Follow Ruby style guide and RuboCop rules defined in .rubocop.yml
|
|
10
|
-
- Prefer rubocop autocorrect
|
|
11
|
-
- Always pass rubocop before committing to git
|
|
12
|
-
- Use `{data:}` rather than `{data: data}`
|
|
13
|
-
- Only use code comments when absolutely necessary
|
|
14
|
-
- Keep any code comments short and concise
|
|
15
|
-
- Don't update .rubocop.yml unless absolutely necessary
|
data/.cursor/rules/testing.mdc
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description:
|
|
3
|
-
globs:
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
---
|
|
6
|
-
# Testing Guidelines
|
|
7
|
-
|
|
8
|
-
- Write RSpec tests for all new features
|
|
9
|
-
- Maintain test coverage for all public methods
|
|
10
|
-
- Use meaningful test descriptions
|
|
11
|
-
- Follow the existing test structure in spec/
|
|
12
|
-
- Test both success and error cases
|
|
13
|
-
- Use modern RSpec features and syntax
|
|
14
|
-
- Don't reduce test coverage (line, file, branch, or other)
|
|
15
|
-
- Only care about coverage reduction when running all specs
|
|
16
|
-
- Do not add any functionality for new features to existing tests unless absolutely necessary
|
data/.overcommit.yml
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# Use this file to configure the Overcommit hooks you wish to use. This will
|
|
2
|
-
# extend the default configuration defined in:
|
|
3
|
-
# https://github.com/sds/overcommit/blob/master/config/default.yml
|
|
4
|
-
|
|
5
|
-
# Global settings
|
|
6
|
-
verify_signatures: false
|
|
7
|
-
|
|
8
|
-
PreCommit:
|
|
9
|
-
ALL:
|
|
10
|
-
problem_on_unmodified_line: ignore
|
|
11
|
-
requires_files: true
|
|
12
|
-
quiet: false
|
|
13
|
-
|
|
14
|
-
# Run RuboCop on Ruby files before commit
|
|
15
|
-
RuboCop:
|
|
16
|
-
enabled: true
|
|
17
|
-
command: ['bundle', 'exec', 'rubocop']
|
|
18
|
-
flags: ['--force-exclusion']
|
|
19
|
-
on_warn: fail
|
|
20
|
-
|
|
21
|
-
# Check for trailing whitespace
|
|
22
|
-
TrailingWhitespace:
|
|
23
|
-
enabled: true
|
|
24
|
-
exclude:
|
|
25
|
-
- '**/*.md'
|
|
26
|
-
|
|
27
|
-
# Check for merge conflicts
|
|
28
|
-
MergeConflicts:
|
|
29
|
-
enabled: true
|
|
30
|
-
|
|
31
|
-
PrePush:
|
|
32
|
-
# Run RSpec tests before push
|
|
33
|
-
RSpec:
|
|
34
|
-
enabled: true
|
|
35
|
-
command: ['bundle', 'exec', 'rspec']
|