request_handler 2.2.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +8 -2
- data/.rubocop.yml +13 -14
- data/.rubocop_todo.yml +105 -0
- data/CHANGELOG.md +10 -1
- data/Gemfile +1 -10
- data/Guardfile +4 -4
- data/Rakefile +7 -6
- data/bin/console +3 -3
- data/lib/request_handler/base.rb +42 -38
- data/lib/request_handler/body_parser.rb +5 -4
- data/lib/request_handler/builder/base.rb +1 -1
- data/lib/request_handler/builder/body_builder.rb +1 -1
- data/lib/request_handler/builder/fieldsets_builder.rb +2 -2
- data/lib/request_handler/builder/fieldsets_resource_builder.rb +1 -1
- data/lib/request_handler/builder/filter_builder.rb +1 -1
- data/lib/request_handler/builder/headers_builder.rb +1 -1
- data/lib/request_handler/builder/include_options_builder.rb +1 -1
- data/lib/request_handler/builder/multipart_builder.rb +2 -2
- data/lib/request_handler/builder/multipart_resource_builder.rb +1 -1
- data/lib/request_handler/builder/options_builder.rb +12 -10
- data/lib/request_handler/builder/page_builder.rb +2 -2
- data/lib/request_handler/builder/page_resource_builder.rb +1 -1
- data/lib/request_handler/builder/query_builder.rb +1 -1
- data/lib/request_handler/builder/sort_options_builder.rb +1 -1
- data/lib/request_handler/concerns/config_helper.rb +2 -2
- data/lib/request_handler/config.rb +3 -3
- data/lib/request_handler/document_parser.rb +6 -6
- data/lib/request_handler/error.rb +17 -1
- data/lib/request_handler/fieldsets_parser.rb +28 -24
- data/lib/request_handler/filter_parser.rb +15 -13
- data/lib/request_handler/header_parser.rb +10 -9
- data/lib/request_handler/include_option_parser.rb +18 -17
- data/lib/request_handler/json_api_document_parser.rb +31 -15
- data/lib/request_handler/json_parser.rb +4 -3
- data/lib/request_handler/multipart_parser.rb +20 -15
- data/lib/request_handler/option_parser.rb +3 -3
- data/lib/request_handler/page_parser.rb +33 -25
- data/lib/request_handler/query_parser.rb +6 -6
- data/lib/request_handler/schema_parser.rb +20 -17
- data/lib/request_handler/sort_option_parser.rb +19 -15
- data/lib/request_handler/validation/definition_engine.rb +8 -6
- data/lib/request_handler/validation/dry_engine.rb +9 -7
- data/lib/request_handler/validation/engine.rb +4 -3
- data/lib/request_handler/validation/errors.rb +2 -0
- data/lib/request_handler/validation/result.rb +1 -0
- data/lib/request_handler/version.rb +1 -1
- data/lib/request_handler.rb +8 -8
- data/request_handler.gemspec +42 -36
- metadata +179 -52
- data/lib/request_handler/base_parser.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cd60a65f2b6671656e48956fe626d577227bca6c2c6ce2b2466253c37280ec8
|
4
|
+
data.tar.gz: f9f1dd6bf0640d85d3b4a8cf866c9858efdaa81a1402dec33e0255f0e66e5d55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a964f7b554f9e6f93bf35194c8218f5676e44d28478eff33406d1756ca4375da8728908fcd5d7db4d183e0d14d4a2999e57f0124ef0fc082f23b9a8204d84ab8
|
7
|
+
data.tar.gz: 8b7ff0664d168c0a69fd0fec0cf70dca96ca8848e5442b998e97226ba44f066336685ba405c2bfffd4d737ef96b0fffd1ecc9293c18b5f0777bb9a89010529d2
|
data/.circleci/config.yml
CHANGED
@@ -19,7 +19,7 @@ common_steps: &common_steps
|
|
19
19
|
- vendor/bundle
|
20
20
|
|
21
21
|
- run: ruby -v
|
22
|
-
- run:
|
22
|
+
- run:
|
23
23
|
name: run tests
|
24
24
|
command: |
|
25
25
|
mkdir /tmp/test-results
|
@@ -51,6 +51,11 @@ jobs:
|
|
51
51
|
- image: circleci/ruby:2.7
|
52
52
|
steps:
|
53
53
|
*common_steps
|
54
|
+
ruby-3.0:
|
55
|
+
docker:
|
56
|
+
- image: circleci/ruby:3.0.3
|
57
|
+
steps:
|
58
|
+
*common_steps
|
54
59
|
jruby-9.3:
|
55
60
|
docker:
|
56
61
|
- image: circleci/jruby:9.3
|
@@ -70,5 +75,6 @@ workflows:
|
|
70
75
|
jobs:
|
71
76
|
- ruby-2.6
|
72
77
|
- ruby-2.7
|
78
|
+
- ruby-3.0
|
73
79
|
- jruby-9.3
|
74
|
-
- jruby-9.3-indy
|
80
|
+
- jruby-9.3-indy
|
data/.rubocop.yml
CHANGED
@@ -1,21 +1,20 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
1
3
|
# minitest specifics
|
4
|
+
require:
|
5
|
+
- rubocop-rake
|
6
|
+
- rubocop-rspec
|
7
|
+
- rt_rubocop_defaults
|
8
|
+
|
2
9
|
AllCops:
|
3
|
-
TargetRubyVersion: 2.
|
10
|
+
TargetRubyVersion: 2.6
|
4
11
|
Exclude:
|
5
12
|
- Dangerfile
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
13
|
+
|
14
|
+
Gemspec/DevelopmentDependencies:
|
15
|
+
EnforcedStyle: gemspec
|
16
|
+
|
17
|
+
|
11
18
|
Metrics/ClassLength:
|
12
19
|
Exclude:
|
13
20
|
- lib/request_handler/base.rb
|
14
|
-
Style/ClassAndModuleChildren:
|
15
|
-
Exclude:
|
16
|
-
- test/**/*
|
17
|
-
|
18
|
-
Metrics/BlockLength:
|
19
|
-
Enabled: false
|
20
|
-
Style/Documentation:
|
21
|
-
Enabled: false
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2023-02-03 11:33:42 UTC using RuboCop version 1.44.1.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# Configuration parameters: AllowedMethods.
|
11
|
+
# AllowedMethods: enums
|
12
|
+
Lint/ConstantDefinitionInBlock:
|
13
|
+
Exclude:
|
14
|
+
- 'spec/request_handler/schema_parser_spec.rb'
|
15
|
+
|
16
|
+
# Offense count: 18
|
17
|
+
# Configuration parameters: AllowComments, AllowEmptyLambdas.
|
18
|
+
Lint/EmptyBlock:
|
19
|
+
Exclude:
|
20
|
+
- 'spec/integration/page_parser_spec.rb'
|
21
|
+
- 'spec/request_handler/base_spec.rb'
|
22
|
+
- 'spec/request_handler/body_parser_spec.rb'
|
23
|
+
- 'spec/request_handler/filter_parser_spec.rb'
|
24
|
+
- 'spec/request_handler/json_api_document_parser_spec.rb'
|
25
|
+
- 'spec/request_handler/multipart_parser_spec.rb'
|
26
|
+
- 'spec/request_handler/query_parser_spec.rb'
|
27
|
+
- 'spec/request_handler/sidecar_parser_spec.rb'
|
28
|
+
- 'spec/request_handler_spec.rb'
|
29
|
+
|
30
|
+
# Offense count: 2
|
31
|
+
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
32
|
+
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
|
33
|
+
Naming/MethodParameterName:
|
34
|
+
Exclude:
|
35
|
+
- 'lib/request_handler/schema_parser.rb'
|
36
|
+
|
37
|
+
# Offense count: 118
|
38
|
+
# Configuration parameters: Prefixes, AllowedPatterns.
|
39
|
+
# Prefixes: when, with, without
|
40
|
+
RSpec/ContextWording:
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
# Offense count: 3
|
44
|
+
# This cop supports safe autocorrection (--autocorrect).
|
45
|
+
# Configuration parameters: CustomTransform, IgnoredWords, DisallowedExamples.
|
46
|
+
# IgnoredWords: only
|
47
|
+
# DisallowedExamples: works
|
48
|
+
RSpec/ExampleWording:
|
49
|
+
Exclude:
|
50
|
+
- 'spec/request_handler_spec.rb'
|
51
|
+
|
52
|
+
# Offense count: 3
|
53
|
+
RSpec/LeakyConstantDeclaration:
|
54
|
+
Exclude:
|
55
|
+
- 'spec/request_handler/schema_parser_spec.rb'
|
56
|
+
|
57
|
+
# Offense count: 13
|
58
|
+
# Configuration parameters: .
|
59
|
+
# SupportedStyles: have_received, receive
|
60
|
+
RSpec/MessageSpies:
|
61
|
+
EnforcedStyle: receive
|
62
|
+
|
63
|
+
# Offense count: 4
|
64
|
+
RSpec/OverwritingSetup:
|
65
|
+
Exclude:
|
66
|
+
- 'spec/request_handler/include_option_parser_spec.rb'
|
67
|
+
- 'spec/request_handler/sort_option_parser_spec.rb'
|
68
|
+
|
69
|
+
# Offense count: 2
|
70
|
+
RSpec/RepeatedExampleGroupDescription:
|
71
|
+
Exclude:
|
72
|
+
- 'spec/request_handler/sort_option_parser_spec.rb'
|
73
|
+
|
74
|
+
# Offense count: 6
|
75
|
+
RSpec/StubbedMock:
|
76
|
+
Exclude:
|
77
|
+
- 'spec/request_handler/base_spec.rb'
|
78
|
+
- 'spec/request_handler/body_parser_spec.rb'
|
79
|
+
|
80
|
+
# Offense count: 3
|
81
|
+
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
82
|
+
RSpec/VerifiedDoubles:
|
83
|
+
Exclude:
|
84
|
+
- 'spec/request_handler/base_spec.rb'
|
85
|
+
|
86
|
+
# Offense count: 1
|
87
|
+
Style/MixinUsage:
|
88
|
+
Exclude:
|
89
|
+
- 'spec/support/helper.rb'
|
90
|
+
|
91
|
+
# Offense count: 41
|
92
|
+
Style/OpenStructUse:
|
93
|
+
Exclude:
|
94
|
+
- 'lib/request_handler/builder/fieldsets_resource_builder.rb'
|
95
|
+
- 'lib/request_handler/builder/multipart_builder.rb'
|
96
|
+
- 'lib/request_handler/builder/page_builder.rb'
|
97
|
+
- 'lib/request_handler/concerns/config_helper.rb'
|
98
|
+
- 'lib/request_handler/config.rb'
|
99
|
+
- 'spec/integration/fieldsets_parser_spec.rb'
|
100
|
+
- 'spec/integration/header_parser_spec.rb'
|
101
|
+
- 'spec/integration/option_parser_spec.rb'
|
102
|
+
- 'spec/integration/page_parser_spec.rb'
|
103
|
+
- 'spec/integration/schema_parser_spec.rb'
|
104
|
+
- 'spec/request_handler/base_spec.rb'
|
105
|
+
- 'spec/request_handler_spec.rb'
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,16 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
-
## [
|
7
|
+
## ## [3.0.0] - 2023-02-07
|
8
|
+
### Added
|
9
|
+
- JSONAPI data member validation
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
- Update rubocop to 1.44
|
13
|
+
|
14
|
+
## [2.3.0] - 2022-06-29
|
15
|
+
### Changed
|
16
|
+
- Explicitly pass kwargs to support ruby 3.0
|
8
17
|
|
9
18
|
## [2.2.0] - 2022-02-25
|
10
19
|
### Changed
|
data/Gemfile
CHANGED
@@ -1,15 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
source
|
3
|
+
source "https://rubygems.org"
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in dry-request_handler.gemspec
|
6
6
|
gemspec
|
7
|
-
|
8
|
-
group :development, :test do
|
9
|
-
gem 'danger'
|
10
|
-
gem 'danger-commit_lint'
|
11
|
-
gem 'danger-rubocop'
|
12
|
-
gem 'dry-types', '~> 1.0'
|
13
|
-
gem 'dry-validation', '~> 1.0'
|
14
|
-
gem 'rspec_junit_formatter'
|
15
|
-
end
|
data/Guardfile
CHANGED
@@ -18,8 +18,8 @@
|
|
18
18
|
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
19
19
|
|
20
20
|
group :red_green_refactor, halt_on_fail: true do
|
21
|
-
guard :rspec, cmd:
|
22
|
-
require
|
21
|
+
guard :rspec, cmd: "bundle exec rspec", all_after_pass: true do
|
22
|
+
require "guard/rspec/dsl"
|
23
23
|
dsl = Guard::RSpec::Dsl.new(self)
|
24
24
|
|
25
25
|
# Feel free to open issues for suggestions and improvements
|
@@ -37,11 +37,11 @@ group :red_green_refactor, halt_on_fail: true do
|
|
37
37
|
# Turnip features and steps
|
38
38
|
watch(%r{^spec/acceptance/(.+)\.feature$})
|
39
39
|
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
40
|
-
Dir[File.join("**/#{m[1]}.feature")][0] ||
|
40
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
guard :rubocop, all_on_start: false, cli: [
|
44
|
+
guard :rubocop, all_on_start: false, cli: ["--auto-correct"] do
|
45
45
|
watch(/.+\.rb$/)
|
46
46
|
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
47
47
|
end
|
data/Rakefile
CHANGED
@@ -1,22 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "bundler/gem_tasks"
|
4
4
|
|
5
|
+
desc "Init repo"
|
5
6
|
task :init do
|
6
|
-
Rake::Task[
|
7
|
+
Rake::Task["rubocop:install"].execute
|
7
8
|
end
|
8
9
|
|
9
|
-
require
|
10
|
+
require "rubocop/rake_task"
|
10
11
|
RuboCop::RakeTask.new
|
11
12
|
namespace :rubocop do
|
12
|
-
desc
|
13
|
+
desc "Install Rubocop as pre-commit hook"
|
13
14
|
task :install do
|
14
|
-
require
|
15
|
+
require "rubocop_runner"
|
15
16
|
RubocopRunner.install
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
19
|
-
require
|
20
|
+
require "rspec/core/rake_task"
|
20
21
|
RSpec::Core::RakeTask.new(:spec)
|
21
22
|
|
22
23
|
task default: :spec
|
data/bin/console
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
4
|
+
require "bundler/setup"
|
5
|
+
require "request_handler"
|
6
6
|
|
7
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
8
8
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -11,5 +11,5 @@ require 'request_handler'
|
|
11
11
|
# require "pry"
|
12
12
|
# Pry.start
|
13
13
|
|
14
|
-
require
|
14
|
+
require "irb"
|
15
15
|
IRB.start
|
data/lib/request_handler/base.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
14
|
-
require
|
15
|
-
require
|
3
|
+
require "request_handler/filter_parser"
|
4
|
+
require "request_handler/page_parser"
|
5
|
+
require "request_handler/include_option_parser"
|
6
|
+
require "request_handler/sort_option_parser"
|
7
|
+
require "request_handler/header_parser"
|
8
|
+
require "request_handler/body_parser"
|
9
|
+
require "request_handler/multipart_parser"
|
10
|
+
require "request_handler/fieldsets_parser"
|
11
|
+
require "request_handler/query_parser"
|
12
|
+
require "request_handler/helper"
|
13
|
+
require "request_handler/builder/options_builder"
|
14
|
+
require "request_handler/concerns/config_helper"
|
15
|
+
require "request_handler/config"
|
16
16
|
|
17
17
|
module RequestHandler
|
18
18
|
class Base
|
@@ -27,7 +27,8 @@ module RequestHandler
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def initialize(request:)
|
30
|
-
raise MissingArgumentError
|
30
|
+
raise MissingArgumentError.new(request: "is missing") if request.nil?
|
31
|
+
|
31
32
|
@request = request
|
32
33
|
end
|
33
34
|
|
@@ -38,7 +39,7 @@ module RequestHandler
|
|
38
39
|
def page_params
|
39
40
|
@page_params ||= PageParser.new(
|
40
41
|
params: params,
|
41
|
-
page_config: config.lookup!(
|
42
|
+
page_config: config.lookup!("page")
|
42
43
|
).run
|
43
44
|
end
|
44
45
|
|
@@ -79,21 +80,21 @@ module RequestHandler
|
|
79
80
|
attr_reader :request
|
80
81
|
|
81
82
|
def parse_filter_params
|
82
|
-
defaults = fetch_defaults(
|
83
|
+
defaults = fetch_defaults("filter.defaults", {})
|
83
84
|
defaults.merge(FilterParser.new(
|
84
85
|
params: params,
|
85
|
-
schema: config.lookup!(
|
86
|
-
additional_url_filter: config.lookup(
|
87
|
-
schema_options: execute_options(config.lookup(
|
86
|
+
schema: config.lookup!("filter.schema"),
|
87
|
+
additional_url_filter: config.lookup("filter.additional_url_filter"),
|
88
|
+
schema_options: execute_options(config.lookup("filter.options"))
|
88
89
|
).run)
|
89
90
|
end
|
90
91
|
|
91
92
|
def parse_include_params
|
92
|
-
parse_options(type:
|
93
|
+
parse_options(type: "include_options", parser: IncludeOptionParser)
|
93
94
|
end
|
94
95
|
|
95
96
|
def parse_sort_params
|
96
|
-
parse_options(type:
|
97
|
+
parse_options(type: "sort_options", parser: SortOptionParser)
|
97
98
|
end
|
98
99
|
|
99
100
|
def parse_options(type:, parser:)
|
@@ -106,7 +107,7 @@ module RequestHandler
|
|
106
107
|
end
|
107
108
|
|
108
109
|
def parse_headers
|
109
|
-
HeaderParser.new(header_parser_params).run
|
110
|
+
HeaderParser.new(**header_parser_params).run
|
110
111
|
end
|
111
112
|
|
112
113
|
def header_parser_params
|
@@ -115,38 +116,38 @@ module RequestHandler
|
|
115
116
|
return params if config.nil?
|
116
117
|
|
117
118
|
params.merge(
|
118
|
-
schema: config.lookup(
|
119
|
-
schema_options: execute_options(config.lookup(
|
119
|
+
schema: config.lookup("headers.schema"),
|
120
|
+
schema_options: execute_options(config.lookup("headers.options"))
|
120
121
|
)
|
121
122
|
end
|
122
123
|
|
123
124
|
def parse_body_params
|
124
125
|
BodyParser.new(
|
125
|
-
request:
|
126
|
-
schema:
|
127
|
-
schema_options:
|
128
|
-
type:
|
126
|
+
request: request,
|
127
|
+
schema: config.lookup!("body.schema"),
|
128
|
+
schema_options: execute_options(config.lookup("body.options")),
|
129
|
+
type: config.lookup("body.type")
|
129
130
|
).run
|
130
131
|
end
|
131
132
|
|
132
133
|
def parse_multipart_params
|
133
134
|
MultipartsParser.new(
|
134
|
-
request:
|
135
|
-
multipart_config: config.lookup!(
|
135
|
+
request: request,
|
136
|
+
multipart_config: config.lookup!("multipart").to_h
|
136
137
|
).run
|
137
138
|
end
|
138
139
|
|
139
140
|
def parse_fieldsets_params
|
140
141
|
FieldsetsParser.new(params: params,
|
141
|
-
allowed: config.lookup!(
|
142
|
-
required: config.lookup(
|
142
|
+
allowed: config.lookup!("fieldsets.allowed"),
|
143
|
+
required: config.lookup("fieldsets.required") || []).run
|
143
144
|
end
|
144
145
|
|
145
146
|
def parse_query_params
|
146
147
|
QueryParser.new(
|
147
148
|
params: params,
|
148
|
-
schema: config.lookup!(
|
149
|
-
schema_options: execute_options(config.lookup(
|
149
|
+
schema: config.lookup!("query.schema"),
|
150
|
+
schema_options: execute_options(config.lookup("query.options"))
|
150
151
|
).run
|
151
152
|
end
|
152
153
|
|
@@ -154,25 +155,28 @@ module RequestHandler
|
|
154
155
|
value = config.lookup(key)
|
155
156
|
return default if value.nil?
|
156
157
|
return value unless value.respond_to?(:call)
|
158
|
+
|
157
159
|
value.call(request)
|
158
160
|
end
|
159
161
|
|
160
162
|
def execute_options(options)
|
161
163
|
return {} if options.nil?
|
162
164
|
return options unless options.respond_to?(:call)
|
165
|
+
|
163
166
|
options.call(self, request)
|
164
167
|
end
|
165
168
|
|
166
169
|
def params
|
167
|
-
raise MissingArgumentError
|
168
|
-
raise ExternalArgumentError
|
170
|
+
raise MissingArgumentError.new(params: "is missing") if request.params.nil?
|
171
|
+
raise ExternalArgumentError.new([]) unless request.params.is_a?(Hash)
|
172
|
+
|
169
173
|
@params ||= Helper.deep_transform_keys_in_object(request.params) do |k|
|
170
|
-
k.to_s.gsub(
|
174
|
+
k.to_s.gsub(".", separator)
|
171
175
|
end
|
172
176
|
end
|
173
177
|
|
174
178
|
def config
|
175
|
-
self.class.instance_variable_get(
|
179
|
+
self.class.instance_variable_get("@config")
|
176
180
|
end
|
177
181
|
|
178
182
|
def separator
|
@@ -1,13 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
3
|
+
require "request_handler/schema_parser"
|
4
|
+
require "request_handler/error"
|
5
|
+
require "request_handler/document_parser"
|
6
6
|
|
7
7
|
module RequestHandler
|
8
8
|
class BodyParser
|
9
9
|
def initialize(request:, schema:, type: nil, schema_options: {})
|
10
|
-
raise MissingArgumentError
|
10
|
+
raise MissingArgumentError.new("request.body": "is missing") if request.body.nil?
|
11
|
+
|
11
12
|
@request = request
|
12
13
|
@schema = schema
|
13
14
|
@schema_options = schema_options
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "request_handler/builder/base"
|
4
|
+
require "request_handler/builder/fieldsets_resource_builder"
|
5
5
|
|
6
6
|
module RequestHandler
|
7
7
|
module Builder
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "request_handler/builder/base"
|
4
|
+
require "request_handler/builder/multipart_resource_builder"
|
5
5
|
|
6
6
|
module RequestHandler
|
7
7
|
module Builder
|
@@ -1,18 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
3
|
+
require "request_handler/builder/base"
|
4
|
+
require "request_handler/builder/headers_builder"
|
5
|
+
require "request_handler/builder/page_builder"
|
6
|
+
require "request_handler/builder/include_options_builder"
|
7
|
+
require "request_handler/builder/sort_options_builder"
|
8
|
+
require "request_handler/builder/filter_builder"
|
9
|
+
require "request_handler/builder/query_builder"
|
10
|
+
require "request_handler/builder/body_builder"
|
11
|
+
require "request_handler/builder/multipart_builder"
|
12
|
+
require "request_handler/builder/fieldsets_builder"
|
13
13
|
|
14
14
|
module RequestHandler
|
15
15
|
module Builder
|
16
|
+
# rubocop:disable Lint/StructNewOverride
|
16
17
|
class OptionsBuilder < Base
|
17
18
|
Options = Struct.new(:page, :include_options, :sort_options, :filter, :query, :body,
|
18
19
|
:multipart, :fieldsets, :headers)
|
@@ -93,5 +94,6 @@ module RequestHandler
|
|
93
94
|
Docile.dsl_eval(HeadersBuilder.new, &block).build
|
94
95
|
end
|
95
96
|
end
|
97
|
+
# rubocop:enable Lint/StructNewOverride
|
96
98
|
end
|
97
99
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "request_handler/builder/base"
|
4
|
+
require "request_handler/builder/page_resource_builder"
|
5
5
|
|
6
6
|
module RequestHandler
|
7
7
|
module Builder
|