jsonapi.rb 1.5.3 → 1.6.0
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 +5 -5
- data/.github/ISSUE_TEMPLATE.md +16 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +17 -0
- data/.github/workflows/ci.yml +36 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +10 -1
- data/Gemfile +0 -2
- data/README.md +10 -4
- data/Rakefile +5 -9
- data/jsonapi.rb.gemspec +2 -1
- data/lib/jsonapi/deserialization.rb +21 -4
- data/lib/jsonapi/error_serializer.rb +2 -2
- data/lib/jsonapi/errors.rb +20 -11
- data/lib/jsonapi/fetching.rb +10 -5
- data/lib/jsonapi/filtering.rb +0 -1
- data/lib/jsonapi/pagination.rb +22 -8
- data/lib/jsonapi/patches.rb +0 -2
- data/lib/jsonapi/rails.rb +24 -7
- data/lib/jsonapi/version.rb +1 -1
- metadata +23 -9
- data/.github/main.workflow +0 -58
- data/Gemfile.lock +0 -206
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dc1e0239230a7a14a008b6344be8857fccd4db574af564a9b49342842fcc316d
|
4
|
+
data.tar.gz: 16615a0a1e0bd8b6f0a84ae9f2adcc16005a16b6413577b3ee945fddb6ce90c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c65ee96100a9179205b0f8e220f4f42dc5cd0f03fb8c7c645cb1c70933f848e2e0fe11d600259f2001fe1a9d8760b821c4748009ee3451156e2b07a660df783
|
7
|
+
data.tar.gz: 26c49d61c04f3bc03eaee260137905886a421c31d6bb669c063eb4cca9bea15a77327a07e90eb63ede9bb4b0d5e4b153aa38eb6dd6167c2eeabf10a1d7fb8fd6
|
@@ -0,0 +1,17 @@
|
|
1
|
+
## What is the current behavior?
|
2
|
+
|
3
|
+
<!-- Please describe the current behavior that you are modifying, or link to a
|
4
|
+
relevant issue. -->
|
5
|
+
|
6
|
+
## What is the new behavior?
|
7
|
+
|
8
|
+
<!-- Please describe the behavior or changes that are being added here. -->
|
9
|
+
|
10
|
+
## Checklist
|
11
|
+
|
12
|
+
Please make sure the following requirements are complete:
|
13
|
+
|
14
|
+
- [ ] Tests for the changes have been added (for bug fixes / features)
|
15
|
+
- [ ] Docs have been reviewed and added / updated if needed (for bug fixes /
|
16
|
+
features)
|
17
|
+
- [ ] All automated checks pass (CI/CD)
|
@@ -0,0 +1,36 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
ruby_rails_test_matrix:
|
7
|
+
runs-on: ubuntu-18.04
|
8
|
+
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
ruby: [2.4, 2.6]
|
12
|
+
rails: [4, 5, 6]
|
13
|
+
exclude:
|
14
|
+
- ruby: 2.4
|
15
|
+
rails: 6
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@master
|
19
|
+
|
20
|
+
- name: Sets up the environment
|
21
|
+
uses: actions/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby }}
|
24
|
+
|
25
|
+
- name: Runs code QA and tests
|
26
|
+
env:
|
27
|
+
RAILS_VERSION: ~> ${{ matrix.rails }}
|
28
|
+
run: |
|
29
|
+
rm -rf Gemfile.lock
|
30
|
+
sudo apt-get update
|
31
|
+
sudo apt-get install libsqlite3-dev
|
32
|
+
gem uninstall bundler -a --force
|
33
|
+
gem install bundler -v '~> 1'
|
34
|
+
echo $RAILS_VERSION | grep -q '4' && export SQLITE3_VERSION='~> 1.3.6'
|
35
|
+
bundle
|
36
|
+
rake
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -17,7 +17,7 @@ Style/StringLiterals:
|
|
17
17
|
Style/FrozenStringLiteralComment:
|
18
18
|
Enabled: false
|
19
19
|
|
20
|
-
|
20
|
+
Layout/LineLength:
|
21
21
|
Max: 80
|
22
22
|
|
23
23
|
Layout/IndentationConsistency:
|
@@ -25,3 +25,12 @@ Layout/IndentationConsistency:
|
|
25
25
|
|
26
26
|
Style/BlockDelimiters:
|
27
27
|
Enabled: true
|
28
|
+
|
29
|
+
Rails/ApplicationRecord:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
Rails/BelongsTo:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
Rails/ApplicationController:
|
36
|
+
Enabled: false
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -31,7 +31,7 @@ Main goals:
|
|
31
31
|
|
32
32
|
The available features include:
|
33
33
|
|
34
|
-
* object serialization (powered by
|
34
|
+
* object serialization (powered by JSON:API Serializer, was `fast_jsonapi`)
|
35
35
|
* [error handling](https://jsonapi.org/format/#errors) (parameters,
|
36
36
|
validation, generic errors)
|
37
37
|
* fetching of the data (support for
|
@@ -44,7 +44,7 @@ The available features include:
|
|
44
44
|
|
45
45
|
## But how?
|
46
46
|
|
47
|
-
Mainly by leveraging [
|
47
|
+
Mainly by leveraging [JSON:API Serializer](https://github.com/jsonapi-serializer/jsonapi-serializer)
|
48
48
|
and [Ransack](https://github.com/activerecord-hackery/ransack).
|
49
49
|
|
50
50
|
Thanks to everyone who worked on these amazing projects!
|
@@ -100,7 +100,7 @@ The naming scheme follows the `ModuleName::ClassNameSerializer` for an instance
|
|
100
100
|
of the `ModuleName::ClassName`.
|
101
101
|
|
102
102
|
Please follow the
|
103
|
-
[
|
103
|
+
[JSON:API Serializer guide](https://github.com/jsonapi-serializer/jsonapi-serializer#serializer-definition)
|
104
104
|
on how to define a serializer.
|
105
105
|
|
106
106
|
To provide a different naming scheme implement the `jsonapi_serializer_class`
|
@@ -320,7 +320,7 @@ class MyController < ActionController::Base
|
|
320
320
|
def update
|
321
321
|
model = MyModel.find(params[:id])
|
322
322
|
|
323
|
-
if model.update(jsonapi_deserialize(only: [:attr1, :rel_one]))
|
323
|
+
if model.update(jsonapi_deserialize(params, only: [:attr1, :rel_one]))
|
324
324
|
render jsonapi: model
|
325
325
|
else
|
326
326
|
render jsonapi_errors: model.errors, status: :unprocessable_entity
|
@@ -336,6 +336,12 @@ The `jsonapi_deserialize` helper accepts the following options:
|
|
336
336
|
* `polymorphic`: will add and detect the `_type` attribute and class to the
|
337
337
|
defined list of polymorphic relationships
|
338
338
|
|
339
|
+
This functionality requires support for _inflections_. If your project uses
|
340
|
+
`active_support` or `rails` you don't need to do anything. Alternatively, we will
|
341
|
+
try to load a lightweight alternative to `active_support/inflector` provided
|
342
|
+
by the `dry/inflector` gem, please make sure it's added if you want to benefit
|
343
|
+
from this feature.
|
344
|
+
|
339
345
|
## Development
|
340
346
|
|
341
347
|
After checking out the repo, run `bundle` to install dependencies.
|
data/Rakefile
CHANGED
@@ -4,14 +4,6 @@ require 'rubocop/rake_task'
|
|
4
4
|
require 'yaml'
|
5
5
|
require 'yardstick'
|
6
6
|
|
7
|
-
# TODO: Remove once merged...
|
8
|
-
# https://github.com/toshimaru/rubocop-rails_config/pull/43
|
9
|
-
require 'rubocop'
|
10
|
-
module RuboCop
|
11
|
-
Config::OBSOLETE_COPS = Config::OBSOLETE_COPS.dup
|
12
|
-
Config::OBSOLETE_COPS.delete('Layout/FirstParameterIndentation')
|
13
|
-
end
|
14
|
-
|
15
7
|
desc('Documentation stats and measurements')
|
16
8
|
task('qa:docs') do
|
17
9
|
yaml = YAML.load_file(File.expand_path('../.yardstick.yml', __FILE__))
|
@@ -32,7 +24,11 @@ RuboCop::RakeTask.new('qa:code') do |task|
|
|
32
24
|
end
|
33
25
|
|
34
26
|
desc('Run CI QA tasks')
|
35
|
-
|
27
|
+
if ENV['RAILS_VERSION'].to_s.include?('4')
|
28
|
+
task(qa: ['qa:docs'])
|
29
|
+
else
|
30
|
+
task(qa: ['qa:docs', 'qa:code'])
|
31
|
+
end
|
36
32
|
|
37
33
|
RSpec::Core::RakeTask.new(spec: :qa)
|
38
34
|
task(default: :spec)
|
data/jsonapi.rb.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
end
|
22
22
|
spec.require_paths = ['lib']
|
23
23
|
|
24
|
-
spec.add_dependency '
|
24
|
+
spec.add_dependency 'jsonapi-serializer', '~> 2.0'
|
25
25
|
spec.add_dependency 'ransack'
|
26
26
|
spec.add_dependency 'rack'
|
27
27
|
|
@@ -34,6 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_development_dependency 'jsonapi-rspec'
|
35
35
|
spec.add_development_dependency 'yardstick'
|
36
36
|
spec.add_development_dependency 'rubocop-rails_config'
|
37
|
+
spec.add_development_dependency 'rubocop'
|
37
38
|
spec.add_development_dependency 'simplecov'
|
38
39
|
spec.add_development_dependency 'rubocop-performance'
|
39
40
|
end
|
@@ -1,4 +1,12 @@
|
|
1
|
-
|
1
|
+
begin
|
2
|
+
require 'active_support/inflector'
|
3
|
+
rescue LoadError
|
4
|
+
warn(
|
5
|
+
'Trying to load `dry-inflector` as an ' \
|
6
|
+
'alternative to `active_support/inflector`...'
|
7
|
+
)
|
8
|
+
require 'dry/inflector'
|
9
|
+
end
|
2
10
|
|
3
11
|
module JSONAPI
|
4
12
|
# Helpers to transform a JSON API document, containing a single data object,
|
@@ -7,6 +15,14 @@ module JSONAPI
|
|
7
15
|
# Initial version from the `active_model_serializers` support for JSONAPI.
|
8
16
|
module Deserialization
|
9
17
|
private
|
18
|
+
# Helper method to pick an available inflector implementation
|
19
|
+
#
|
20
|
+
# @return [Object]
|
21
|
+
def jsonapi_inflector
|
22
|
+
ActiveSupport::Inflector
|
23
|
+
rescue
|
24
|
+
Dry::Inflector.new
|
25
|
+
end
|
10
26
|
|
11
27
|
# Returns a transformed dictionary following [ActiveRecord::Base] specs
|
12
28
|
#
|
@@ -17,7 +33,8 @@ module JSONAPI
|
|
17
33
|
# polymorphic: Array of symbols of polymorphic fields.
|
18
34
|
# @return [Hash]
|
19
35
|
def jsonapi_deserialize(document, options = {})
|
20
|
-
if document.
|
36
|
+
if document.respond_to?(:permit!)
|
37
|
+
# Handle Rails params...
|
21
38
|
primary_data = document.dup.require(:data).permit!.as_json
|
22
39
|
elsif document.is_a?(Hash)
|
23
40
|
primary_data = (document.as_json['data'] || {}).deep_dup
|
@@ -45,7 +62,7 @@ module JSONAPI
|
|
45
62
|
|
46
63
|
relationships.map do |assoc_name, assoc_data|
|
47
64
|
assoc_data = (assoc_data || {})['data'] || {}
|
48
|
-
rel_name =
|
65
|
+
rel_name = jsonapi_inflector.singularize(assoc_name)
|
49
66
|
|
50
67
|
if assoc_data.is_a?(Array)
|
51
68
|
parsed["#{rel_name}_ids"] = assoc_data.map { |ri| ri['id'] }.compact
|
@@ -55,7 +72,7 @@ module JSONAPI
|
|
55
72
|
parsed["#{rel_name}_id"] = assoc_data['id']
|
56
73
|
|
57
74
|
if (options['polymorphic'] || []).include?(assoc_name)
|
58
|
-
rel_type =
|
75
|
+
rel_type = jsonapi_inflector.classify(assoc_data['type'].to_s)
|
59
76
|
parsed["#{rel_name}_type"] = rel_type
|
60
77
|
end
|
61
78
|
end
|
data/lib/jsonapi/errors.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'rack/utils'
|
2
|
-
require 'active_support/concern'
|
3
2
|
|
4
3
|
module JSONAPI
|
5
4
|
# Helpers to handle some error responses
|
@@ -7,19 +6,29 @@ module JSONAPI
|
|
7
6
|
# Most of the exceptions are handled in Rails by [ActionDispatch] middleware
|
8
7
|
# See: https://api.rubyonrails.org/classes/ActionDispatch/ExceptionWrapper.html
|
9
8
|
module Errors
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
9
|
+
# Callback will register the error handlers
|
10
|
+
#
|
11
|
+
# @return [Module]
|
12
|
+
def self.included(base)
|
13
|
+
base.class_eval do
|
14
|
+
rescue_from(
|
15
|
+
StandardError,
|
16
|
+
with: :render_jsonapi_internal_server_error
|
17
|
+
) unless defined?(::Rails) && ::Rails.env.test?
|
18
|
+
|
19
|
+
rescue_from(
|
20
|
+
ActiveRecord::RecordNotFound,
|
21
|
+
with: :render_jsonapi_not_found
|
22
|
+
) if defined?(ActiveRecord::RecordNotFound)
|
23
|
+
|
24
|
+
rescue_from(
|
25
|
+
ActionController::ParameterMissing,
|
26
|
+
with: :render_jsonapi_unprocessable_entity
|
27
|
+
) if defined?(ActionController::ParameterMissing)
|
28
|
+
end
|
19
29
|
end
|
20
30
|
|
21
31
|
private
|
22
|
-
|
23
32
|
# Generic error handler callback
|
24
33
|
#
|
25
34
|
# @param exception [Exception] instance to handle
|
data/lib/jsonapi/fetching.rb
CHANGED
@@ -2,7 +2,6 @@ module JSONAPI
|
|
2
2
|
# Inclusion and sparse fields support
|
3
3
|
module Fetching
|
4
4
|
private
|
5
|
-
|
6
5
|
# Extracts and formats sparse fieldsets
|
7
6
|
#
|
8
7
|
# Ex.: `GET /resource?fields[relationship]=id,created_at`
|
@@ -11,11 +10,17 @@ module JSONAPI
|
|
11
10
|
def jsonapi_fields
|
12
11
|
return {} unless params[:fields].respond_to?(:each_pair)
|
13
12
|
|
14
|
-
ActiveSupport::HashWithIndifferentAccess
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
if defined?(ActiveSupport::HashWithIndifferentAccess)
|
14
|
+
extracted = ActiveSupport::HashWithIndifferentAccess.new
|
15
|
+
else
|
16
|
+
extracted = Hash.new
|
17
|
+
end
|
18
|
+
|
19
|
+
params[:fields].each do |k, v|
|
20
|
+
extracted[k] = v.to_s.split(',').map(&:strip).compact
|
18
21
|
end
|
22
|
+
|
23
|
+
extracted
|
19
24
|
end
|
20
25
|
|
21
26
|
# Extracts and whitelists allowed includes
|
data/lib/jsonapi/filtering.rb
CHANGED
data/lib/jsonapi/pagination.rb
CHANGED
@@ -2,7 +2,6 @@ module JSONAPI
|
|
2
2
|
# Pagination support
|
3
3
|
module Pagination
|
4
4
|
private
|
5
|
-
|
6
5
|
# Default number of items per page.
|
7
6
|
JSONAPI_PAGE_SIZE = 30
|
8
7
|
|
@@ -17,7 +16,11 @@ module JSONAPI
|
|
17
16
|
if resources.respond_to?(:offset)
|
18
17
|
resources = resources.offset(offset).limit(limit)
|
19
18
|
else
|
20
|
-
|
19
|
+
original_size = resources.size
|
20
|
+
resources = resources[(offset)..(offset + limit - 1)] || []
|
21
|
+
|
22
|
+
# Cache the original resources size to be used for pagination meta
|
23
|
+
resources.instance_variable_set(:@original_size, original_size)
|
21
24
|
end
|
22
25
|
|
23
26
|
block_given? ? yield(resources) : resources
|
@@ -27,16 +30,16 @@ module JSONAPI
|
|
27
30
|
#
|
28
31
|
# @return [Array]
|
29
32
|
def jsonapi_pagination(resources)
|
30
|
-
links = { self: request.base_url + request.
|
33
|
+
links = { self: request.base_url + request.fullpath }
|
31
34
|
pagination = jsonapi_pagination_meta(resources)
|
32
35
|
|
33
36
|
return links if pagination.blank?
|
34
37
|
|
35
38
|
original_params = params.except(
|
36
|
-
*
|
37
|
-
).
|
39
|
+
*jsonapi_path_parameters.keys.map(&:to_s)
|
40
|
+
).as_json.with_indifferent_access
|
38
41
|
|
39
|
-
original_params[:page]
|
42
|
+
original_params[:page] = original_params[:page].dup || {}
|
40
43
|
original_url = request.base_url + request.path + '?'
|
41
44
|
|
42
45
|
pagination.each do |page_name, number|
|
@@ -60,9 +63,11 @@ module JSONAPI
|
|
60
63
|
numbers = { current: page }
|
61
64
|
|
62
65
|
if resources.respond_to?(:unscope)
|
63
|
-
total = resources.unscope(:limit, :offset).count()
|
66
|
+
total = resources.unscope(:limit, :offset, :order).count()
|
64
67
|
else
|
65
|
-
|
68
|
+
# Try to fetch the cached size first
|
69
|
+
total = resources.instance_variable_get(:@original_size)
|
70
|
+
total ||= resources.size
|
66
71
|
end
|
67
72
|
|
68
73
|
last_page = [1, (total.to_f / limit).ceil].max
|
@@ -93,5 +98,14 @@ module JSONAPI
|
|
93
98
|
|
94
99
|
[(num - 1) * per_page, per_page, num]
|
95
100
|
end
|
101
|
+
|
102
|
+
# Fallback to Rack's parsed query string when Rails is not available
|
103
|
+
#
|
104
|
+
# @return [Hash]
|
105
|
+
def jsonapi_path_parameters
|
106
|
+
return request.path_parameters if request.respond_to?(:path_parameters)
|
107
|
+
|
108
|
+
request.send(:parse_query, request.query_string, '&;')
|
109
|
+
end
|
96
110
|
end
|
97
111
|
end
|
data/lib/jsonapi/patches.rb
CHANGED
@@ -37,7 +37,6 @@ Ransack::Visitor.class_eval do
|
|
37
37
|
alias_method :original_visit_Ransack_Nodes_Sort, :visit_Ransack_Nodes_Sort
|
38
38
|
|
39
39
|
private
|
40
|
-
|
41
40
|
# Original method assumes sorting is done only by attributes
|
42
41
|
def visit_Ransack_Nodes_Sort(node)
|
43
42
|
# Try the default sorting visitor method...
|
@@ -61,7 +60,6 @@ Ransack::Nodes::Condition.class_eval do
|
|
61
60
|
alias_method :original_format_predicate, :format_predicate
|
62
61
|
|
63
62
|
private
|
64
|
-
|
65
63
|
# Original method doesn't respect the arity of expressions
|
66
64
|
# See: lib/ransack/adapters/active_record/ransack/nodes/condition.rb#L30-L42
|
67
65
|
def format_predicate(attribute)
|
data/lib/jsonapi/rails.rb
CHANGED
@@ -42,8 +42,9 @@ module JSONAPI
|
|
42
42
|
many = JSONAPI::Rails.is_collection?(resource, options[:is_collection])
|
43
43
|
resource = [resource] unless many
|
44
44
|
|
45
|
-
return JSONAPI::
|
46
|
-
.
|
45
|
+
return JSONAPI::Rails.serializer_to_json(
|
46
|
+
JSONAPI::ErrorSerializer.new(resource, options)
|
47
|
+
) unless resource.is_a?(ActiveModel::Errors)
|
47
48
|
|
48
49
|
errors = []
|
49
50
|
model = resource.instance_variable_get('@base')
|
@@ -66,9 +67,11 @@ module JSONAPI
|
|
66
67
|
end
|
67
68
|
end
|
68
69
|
|
69
|
-
JSONAPI::
|
70
|
-
|
71
|
-
|
70
|
+
JSONAPI::Rails.serializer_to_json(
|
71
|
+
JSONAPI::ActiveModelErrorSerializer.new(
|
72
|
+
errors, params: { model: model, model_serializer: model_serializer }
|
73
|
+
)
|
74
|
+
)
|
72
75
|
end
|
73
76
|
end
|
74
77
|
|
@@ -100,13 +103,15 @@ module JSONAPI
|
|
100
103
|
serializer_class = JSONAPI::Rails.serializer_class(resource, many)
|
101
104
|
end
|
102
105
|
|
103
|
-
|
106
|
+
JSONAPI::Rails.serializer_to_json(
|
107
|
+
serializer_class.new(resource, options)
|
108
|
+
)
|
104
109
|
end
|
105
110
|
end
|
106
111
|
|
107
112
|
# Checks if an object is a collection
|
108
113
|
#
|
109
|
-
#
|
114
|
+
# Stolen from [JSONAPI::Serializer], instance method.
|
110
115
|
#
|
111
116
|
# @param resource [Object] to check
|
112
117
|
# @param force_is_collection [NilClass] flag to overwrite
|
@@ -126,5 +131,17 @@ module JSONAPI
|
|
126
131
|
|
127
132
|
"#{klass.name}Serializer".constantize
|
128
133
|
end
|
134
|
+
|
135
|
+
# Lazily returns the serializer JSON
|
136
|
+
#
|
137
|
+
# @param serializer [Object] to evaluate
|
138
|
+
# @return [String]
|
139
|
+
def self.serializer_to_json(serializer)
|
140
|
+
if serializer.respond_to?(:serialized_json)
|
141
|
+
serializer.serialized_json
|
142
|
+
else
|
143
|
+
serializer.serializable_hash.to_json
|
144
|
+
end
|
145
|
+
end
|
129
146
|
end
|
130
147
|
end
|
data/lib/jsonapi/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonapi.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stas Suscov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: jsonapi-serializer
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
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: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ransack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,6 +178,20 @@ dependencies:
|
|
178
178
|
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: rubocop
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
181
195
|
- !ruby/object:Gem::Dependency
|
182
196
|
name: simplecov
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -213,13 +227,14 @@ executables: []
|
|
213
227
|
extensions: []
|
214
228
|
extra_rdoc_files: []
|
215
229
|
files:
|
216
|
-
- ".github/
|
230
|
+
- ".github/ISSUE_TEMPLATE.md"
|
231
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
232
|
+
- ".github/workflows/ci.yml"
|
217
233
|
- ".gitignore"
|
218
234
|
- ".rspec"
|
219
235
|
- ".rubocop.yml"
|
220
236
|
- ".yardstick.yml"
|
221
237
|
- Gemfile
|
222
|
-
- Gemfile.lock
|
223
238
|
- LICENSE.txt
|
224
239
|
- README.md
|
225
240
|
- Rakefile
|
@@ -254,8 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
254
269
|
- !ruby/object:Gem::Version
|
255
270
|
version: '0'
|
256
271
|
requirements: []
|
257
|
-
|
258
|
-
rubygems_version: 2.5.2.2
|
272
|
+
rubygems_version: 3.1.2
|
259
273
|
signing_key:
|
260
274
|
specification_version: 4
|
261
275
|
summary: So you say you need JSON:API support in your API...
|
data/.github/main.workflow
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
workflow "Tests" {
|
2
|
-
on = "push"
|
3
|
-
resolves = [
|
4
|
-
"rspec-ruby2.3_rails4",
|
5
|
-
"rspec-ruby2.6_rails4",
|
6
|
-
"rspec-ruby2.6_rails5",
|
7
|
-
"rspec-ruby2.6_rails6"
|
8
|
-
]
|
9
|
-
}
|
10
|
-
|
11
|
-
action "rspec-ruby2.3_rails4" {
|
12
|
-
uses = "docker://ruby:2.3-alpine"
|
13
|
-
env = {
|
14
|
-
RAILS_VERSION = "~> 4"
|
15
|
-
SQLITE3_VERSION = "~> 1.3.6"
|
16
|
-
}
|
17
|
-
args = [
|
18
|
-
"sh", "-c",
|
19
|
-
"apk add -U git build-base sqlite-dev && rm Gemfile.lock && bundle install && rake"
|
20
|
-
]
|
21
|
-
}
|
22
|
-
|
23
|
-
action "rspec-ruby2.6_rails4" {
|
24
|
-
uses = "docker://ruby:2.6-alpine"
|
25
|
-
needs = ["rspec-ruby2.3_rails4"]
|
26
|
-
env = {
|
27
|
-
RAILS_VERSION = "~> 4"
|
28
|
-
SQLITE3_VERSION = "~> 1.3.6"
|
29
|
-
}
|
30
|
-
args = [
|
31
|
-
"sh", "-c",
|
32
|
-
"apk add -U git build-base sqlite-dev && rm Gemfile.lock && bundle install && rake"
|
33
|
-
]
|
34
|
-
}
|
35
|
-
|
36
|
-
action "rspec-ruby2.6_rails5" {
|
37
|
-
uses = "docker://ruby:2.6-alpine"
|
38
|
-
needs = ["rspec-ruby2.6_rails4"]
|
39
|
-
env = {
|
40
|
-
RAILS_VERSION = "~> 5"
|
41
|
-
}
|
42
|
-
args = [
|
43
|
-
"sh", "-c",
|
44
|
-
"apk add -U git build-base sqlite-dev && rm Gemfile.lock && bundle install && rake"
|
45
|
-
]
|
46
|
-
}
|
47
|
-
|
48
|
-
action "rspec-ruby2.6_rails6" {
|
49
|
-
uses = "docker://ruby:2.6-alpine"
|
50
|
-
needs = ["rspec-ruby2.6_rails5"]
|
51
|
-
env = {
|
52
|
-
RAILS_VERSION = "~> 6.0.0.rc1"
|
53
|
-
}
|
54
|
-
args = [
|
55
|
-
"sh", "-c",
|
56
|
-
"apk add -U git build-base sqlite-dev && rm Gemfile.lock && bundle install && rake"
|
57
|
-
]
|
58
|
-
}
|
data/Gemfile.lock
DELETED
@@ -1,206 +0,0 @@
|
|
1
|
-
GIT
|
2
|
-
remote: https://github.com/stas/jsonapi-rspec.git
|
3
|
-
revision: f223a3d5531cf2c0ce2f90aa8dac2bae46b2d499
|
4
|
-
specs:
|
5
|
-
jsonapi-rspec (0.0.2)
|
6
|
-
rspec-expectations
|
7
|
-
|
8
|
-
PATH
|
9
|
-
remote: .
|
10
|
-
specs:
|
11
|
-
jsonapi.rb (1.5.2)
|
12
|
-
fast_jsonapi (~> 1.5)
|
13
|
-
rack
|
14
|
-
ransack
|
15
|
-
|
16
|
-
GEM
|
17
|
-
remote: https://rubygems.org/
|
18
|
-
specs:
|
19
|
-
actioncable (5.2.3)
|
20
|
-
actionpack (= 5.2.3)
|
21
|
-
nio4r (~> 2.0)
|
22
|
-
websocket-driver (>= 0.6.1)
|
23
|
-
actionmailer (5.2.3)
|
24
|
-
actionpack (= 5.2.3)
|
25
|
-
actionview (= 5.2.3)
|
26
|
-
activejob (= 5.2.3)
|
27
|
-
mail (~> 2.5, >= 2.5.4)
|
28
|
-
rails-dom-testing (~> 2.0)
|
29
|
-
actionpack (5.2.3)
|
30
|
-
actionview (= 5.2.3)
|
31
|
-
activesupport (= 5.2.3)
|
32
|
-
rack (~> 2.0)
|
33
|
-
rack-test (>= 0.6.3)
|
34
|
-
rails-dom-testing (~> 2.0)
|
35
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
36
|
-
actionview (5.2.3)
|
37
|
-
activesupport (= 5.2.3)
|
38
|
-
builder (~> 3.1)
|
39
|
-
erubi (~> 1.4)
|
40
|
-
rails-dom-testing (~> 2.0)
|
41
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
42
|
-
activejob (5.2.3)
|
43
|
-
activesupport (= 5.2.3)
|
44
|
-
globalid (>= 0.3.6)
|
45
|
-
activemodel (5.2.3)
|
46
|
-
activesupport (= 5.2.3)
|
47
|
-
activerecord (5.2.3)
|
48
|
-
activemodel (= 5.2.3)
|
49
|
-
activesupport (= 5.2.3)
|
50
|
-
arel (>= 9.0)
|
51
|
-
activestorage (5.2.3)
|
52
|
-
actionpack (= 5.2.3)
|
53
|
-
activerecord (= 5.2.3)
|
54
|
-
marcel (~> 0.3.1)
|
55
|
-
activesupport (5.2.3)
|
56
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
57
|
-
i18n (>= 0.7, < 2)
|
58
|
-
minitest (~> 5.1)
|
59
|
-
tzinfo (~> 1.1)
|
60
|
-
arel (9.0.0)
|
61
|
-
ast (2.4.0)
|
62
|
-
builder (3.2.3)
|
63
|
-
concurrent-ruby (1.1.5)
|
64
|
-
crass (1.0.4)
|
65
|
-
diff-lcs (1.3)
|
66
|
-
docile (1.3.1)
|
67
|
-
erubi (1.8.0)
|
68
|
-
fast_jsonapi (1.5)
|
69
|
-
activesupport (>= 4.2)
|
70
|
-
ffaker (2.11.0)
|
71
|
-
globalid (0.4.2)
|
72
|
-
activesupport (>= 4.2.0)
|
73
|
-
i18n (1.6.0)
|
74
|
-
concurrent-ruby (~> 1.0)
|
75
|
-
jaro_winkler (1.5.2)
|
76
|
-
json (2.2.0)
|
77
|
-
loofah (2.2.3)
|
78
|
-
crass (~> 1.0.2)
|
79
|
-
nokogiri (>= 1.5.9)
|
80
|
-
mail (2.7.1)
|
81
|
-
mini_mime (>= 0.1.1)
|
82
|
-
marcel (0.3.3)
|
83
|
-
mimemagic (~> 0.3.2)
|
84
|
-
method_source (0.9.2)
|
85
|
-
mimemagic (0.3.3)
|
86
|
-
mini_mime (1.0.1)
|
87
|
-
mini_portile2 (2.4.0)
|
88
|
-
minitest (5.11.3)
|
89
|
-
nio4r (2.3.1)
|
90
|
-
nokogiri (1.10.3)
|
91
|
-
mini_portile2 (~> 2.4.0)
|
92
|
-
parallel (1.17.0)
|
93
|
-
parser (2.6.3.0)
|
94
|
-
ast (~> 2.4.0)
|
95
|
-
rack (2.0.7)
|
96
|
-
rack-test (1.1.0)
|
97
|
-
rack (>= 1.0, < 3)
|
98
|
-
rails (5.2.3)
|
99
|
-
actioncable (= 5.2.3)
|
100
|
-
actionmailer (= 5.2.3)
|
101
|
-
actionpack (= 5.2.3)
|
102
|
-
actionview (= 5.2.3)
|
103
|
-
activejob (= 5.2.3)
|
104
|
-
activemodel (= 5.2.3)
|
105
|
-
activerecord (= 5.2.3)
|
106
|
-
activestorage (= 5.2.3)
|
107
|
-
activesupport (= 5.2.3)
|
108
|
-
bundler (>= 1.3.0)
|
109
|
-
railties (= 5.2.3)
|
110
|
-
sprockets-rails (>= 2.0.0)
|
111
|
-
rails-dom-testing (2.0.3)
|
112
|
-
activesupport (>= 4.2.0)
|
113
|
-
nokogiri (>= 1.6)
|
114
|
-
rails-html-sanitizer (1.0.4)
|
115
|
-
loofah (~> 2.2, >= 2.2.2)
|
116
|
-
railties (5.2.3)
|
117
|
-
actionpack (= 5.2.3)
|
118
|
-
activesupport (= 5.2.3)
|
119
|
-
method_source
|
120
|
-
rake (>= 0.8.7)
|
121
|
-
thor (>= 0.19.0, < 2.0)
|
122
|
-
rainbow (3.0.0)
|
123
|
-
rake (12.3.2)
|
124
|
-
ransack (2.1.1)
|
125
|
-
actionpack (>= 5.0)
|
126
|
-
activerecord (>= 5.0)
|
127
|
-
activesupport (>= 5.0)
|
128
|
-
i18n
|
129
|
-
rspec (3.8.0)
|
130
|
-
rspec-core (~> 3.8.0)
|
131
|
-
rspec-expectations (~> 3.8.0)
|
132
|
-
rspec-mocks (~> 3.8.0)
|
133
|
-
rspec-core (3.8.0)
|
134
|
-
rspec-support (~> 3.8.0)
|
135
|
-
rspec-expectations (3.8.3)
|
136
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
137
|
-
rspec-support (~> 3.8.0)
|
138
|
-
rspec-mocks (3.8.0)
|
139
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
140
|
-
rspec-support (~> 3.8.0)
|
141
|
-
rspec-rails (3.8.2)
|
142
|
-
actionpack (>= 3.0)
|
143
|
-
activesupport (>= 3.0)
|
144
|
-
railties (>= 3.0)
|
145
|
-
rspec-core (~> 3.8.0)
|
146
|
-
rspec-expectations (~> 3.8.0)
|
147
|
-
rspec-mocks (~> 3.8.0)
|
148
|
-
rspec-support (~> 3.8.0)
|
149
|
-
rspec-support (3.8.0)
|
150
|
-
rubocop (0.68.1)
|
151
|
-
jaro_winkler (~> 1.5.1)
|
152
|
-
parallel (~> 1.10)
|
153
|
-
parser (>= 2.5, != 2.5.1.1)
|
154
|
-
rainbow (>= 2.2.2, < 4.0)
|
155
|
-
ruby-progressbar (~> 1.7)
|
156
|
-
unicode-display_width (>= 1.4.0, < 1.6)
|
157
|
-
rubocop-performance (1.2.0)
|
158
|
-
rubocop (>= 0.68.0)
|
159
|
-
rubocop-rails_config (0.5.1)
|
160
|
-
railties (>= 3.0)
|
161
|
-
rubocop (~> 0.60)
|
162
|
-
ruby-progressbar (1.10.0)
|
163
|
-
simplecov (0.16.1)
|
164
|
-
docile (~> 1.1)
|
165
|
-
json (>= 1.8, < 3)
|
166
|
-
simplecov-html (~> 0.10.0)
|
167
|
-
simplecov-html (0.10.2)
|
168
|
-
sprockets (3.7.2)
|
169
|
-
concurrent-ruby (~> 1.0)
|
170
|
-
rack (> 1, < 3)
|
171
|
-
sprockets-rails (3.2.1)
|
172
|
-
actionpack (>= 4.0)
|
173
|
-
activesupport (>= 4.0)
|
174
|
-
sprockets (>= 3.0.0)
|
175
|
-
sqlite3 (1.4.1)
|
176
|
-
thor (0.20.3)
|
177
|
-
thread_safe (0.3.6)
|
178
|
-
tzinfo (1.2.5)
|
179
|
-
thread_safe (~> 0.1)
|
180
|
-
unicode-display_width (1.5.0)
|
181
|
-
websocket-driver (0.7.0)
|
182
|
-
websocket-extensions (>= 0.1.0)
|
183
|
-
websocket-extensions (0.1.3)
|
184
|
-
yard (0.9.19)
|
185
|
-
yardstick (0.9.9)
|
186
|
-
yard (~> 0.8, >= 0.8.7.2)
|
187
|
-
|
188
|
-
PLATFORMS
|
189
|
-
ruby
|
190
|
-
|
191
|
-
DEPENDENCIES
|
192
|
-
bundler
|
193
|
-
ffaker
|
194
|
-
jsonapi-rspec!
|
195
|
-
jsonapi.rb!
|
196
|
-
rails
|
197
|
-
rspec (~> 3.0)
|
198
|
-
rspec-rails
|
199
|
-
rubocop-performance
|
200
|
-
rubocop-rails_config
|
201
|
-
simplecov
|
202
|
-
sqlite3
|
203
|
-
yardstick
|
204
|
-
|
205
|
-
BUNDLED WITH
|
206
|
-
1.17.3
|