sober_swag 0.21.0 → 0.22.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.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -0
  3. data/CHANGELOG.md +5 -0
  4. data/bin/console +30 -10
  5. data/docs/reporting.md +190 -0
  6. data/example/Gemfile +2 -2
  7. data/example/Gemfile.lock +92 -101
  8. data/example/app/controllers/application_controller.rb +4 -0
  9. data/example/app/controllers/people_controller.rb +44 -28
  10. data/example/app/output_objects/identified_output.rb +7 -0
  11. data/example/app/output_objects/person_output_object.rb +37 -11
  12. data/example/app/output_objects/post_output_object.rb +0 -4
  13. data/example/app/output_objects/reporting_post_output.rb +18 -0
  14. data/example/bin/rspec +29 -0
  15. data/example/spec/requests/people/create_spec.rb +3 -2
  16. data/example/spec/requests/people/index_spec.rb +1 -1
  17. data/lib/sober_swag/compiler/path.rb +3 -1
  18. data/lib/sober_swag/compiler.rb +58 -12
  19. data/lib/sober_swag/controller/route.rb +44 -8
  20. data/lib/sober_swag/controller.rb +18 -5
  21. data/lib/sober_swag/reporting/compiler.rb +39 -0
  22. data/lib/sober_swag/reporting/input/base.rb +11 -0
  23. data/lib/sober_swag/reporting/input/bool.rb +19 -0
  24. data/lib/sober_swag/reporting/input/converting/bool.rb +24 -0
  25. data/lib/sober_swag/reporting/input/converting/date.rb +30 -0
  26. data/lib/sober_swag/reporting/input/converting/date_time.rb +28 -0
  27. data/lib/sober_swag/reporting/input/converting/decimal.rb +24 -0
  28. data/lib/sober_swag/reporting/input/converting/integer.rb +19 -0
  29. data/lib/sober_swag/reporting/input/converting.rb +16 -0
  30. data/lib/sober_swag/reporting/input/defer.rb +29 -0
  31. data/lib/sober_swag/reporting/input/described.rb +38 -0
  32. data/lib/sober_swag/reporting/input/dictionary.rb +37 -0
  33. data/lib/sober_swag/reporting/input/either.rb +51 -0
  34. data/lib/sober_swag/reporting/input/enum.rb +44 -0
  35. data/lib/sober_swag/reporting/input/format.rb +39 -0
  36. data/lib/sober_swag/reporting/input/interface.rb +87 -0
  37. data/lib/sober_swag/reporting/input/list.rb +44 -0
  38. data/lib/sober_swag/reporting/input/mapped.rb +36 -0
  39. data/lib/sober_swag/reporting/input/merge_objects.rb +72 -0
  40. data/lib/sober_swag/reporting/input/null.rb +34 -0
  41. data/lib/sober_swag/reporting/input/number.rb +19 -0
  42. data/lib/sober_swag/reporting/input/object/property.rb +53 -0
  43. data/lib/sober_swag/reporting/input/object.rb +100 -0
  44. data/lib/sober_swag/reporting/input/pattern.rb +46 -0
  45. data/lib/sober_swag/reporting/input/referenced.rb +38 -0
  46. data/lib/sober_swag/reporting/input/struct.rb +271 -0
  47. data/lib/sober_swag/reporting/input/text.rb +42 -0
  48. data/lib/sober_swag/reporting/input.rb +54 -0
  49. data/lib/sober_swag/reporting/invalid_schema_error.rb +21 -0
  50. data/lib/sober_swag/reporting/output/base.rb +25 -0
  51. data/lib/sober_swag/reporting/output/bool.rb +25 -0
  52. data/lib/sober_swag/reporting/output/defer.rb +69 -0
  53. data/lib/sober_swag/reporting/output/described.rb +42 -0
  54. data/lib/sober_swag/reporting/output/dictionary.rb +46 -0
  55. data/lib/sober_swag/reporting/output/interface.rb +83 -0
  56. data/lib/sober_swag/reporting/output/list.rb +54 -0
  57. data/lib/sober_swag/reporting/output/merge_objects.rb +97 -0
  58. data/lib/sober_swag/reporting/output/null.rb +25 -0
  59. data/lib/sober_swag/reporting/output/number.rb +25 -0
  60. data/lib/sober_swag/reporting/output/object/property.rb +45 -0
  61. data/lib/sober_swag/reporting/output/object.rb +54 -0
  62. data/lib/sober_swag/reporting/output/partitioned.rb +77 -0
  63. data/lib/sober_swag/reporting/output/pattern.rb +50 -0
  64. data/lib/sober_swag/reporting/output/referenced.rb +42 -0
  65. data/lib/sober_swag/reporting/output/struct.rb +262 -0
  66. data/lib/sober_swag/reporting/output/text.rb +25 -0
  67. data/lib/sober_swag/reporting/output/via_map.rb +67 -0
  68. data/lib/sober_swag/reporting/output/viewed.rb +72 -0
  69. data/lib/sober_swag/reporting/output.rb +54 -0
  70. data/lib/sober_swag/reporting/report/base.rb +57 -0
  71. data/lib/sober_swag/reporting/report/either.rb +36 -0
  72. data/lib/sober_swag/reporting/report/error.rb +15 -0
  73. data/lib/sober_swag/reporting/report/list.rb +28 -0
  74. data/lib/sober_swag/reporting/report/merged_object.rb +25 -0
  75. data/lib/sober_swag/reporting/report/object.rb +29 -0
  76. data/lib/sober_swag/reporting/report/output.rb +14 -0
  77. data/lib/sober_swag/reporting/report/value.rb +28 -0
  78. data/lib/sober_swag/reporting/report.rb +16 -0
  79. data/lib/sober_swag/reporting.rb +11 -0
  80. data/lib/sober_swag/version.rb +1 -1
  81. data/lib/sober_swag.rb +1 -0
  82. metadata +65 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f9dce6daadaff9f7ddb1530ecf5fa69693454a29f04da849eec9bea8969166bc
4
- data.tar.gz: a6cd16e93640b2d9c27fab081c3551d8498643044a6ebf9cab8100b51d8d916d
3
+ metadata.gz: da1c1c2df36ccecf700e4d3ecf104c1324f9fa35b4588b4a040238f2513bf4b8
4
+ data.tar.gz: 3d22562035e1d8e93b11876fc82f6a23b1d26e95952d988423559d555adf680a
5
5
  SHA512:
6
- metadata.gz: fb2dcb7bee3b89e643b3e5d2d1e3d5b7034161ae563de59909120a3f4c817a8f14ab88d5d1968efb2b914b068cf0370d41f9094bbec7ae8ef96a87dfe3ad64fd
7
- data.tar.gz: bfc9bfe3b4e93dca2a774e416496d430dfa63185acc82db780cc4f26d7eec1ff2a6db0f10103fd962243ab46b9799b8e6536dd94cc07758b5f52ea07af71df67
6
+ metadata.gz: 3a486a7b09b631d567f509c94b3b161350de61971f148ba24f707e117fa6915e6d7be99c6782ff07662da44edc3edb56ebb1691ac0fe8e819fc138dca4513ac9
7
+ data.tar.gz: e4447e3a951d0867c76a6bbd30a49da136d9406d00dfe0c5e0632574746a59fa72b936eb736c573de33bfe01e1d36d36771561fed7b9a6b00be43dcaa0c82653
data/.rubocop.yml CHANGED
@@ -7,6 +7,7 @@ AllCops:
7
7
  - 'bin/bundle'
8
8
  - 'example/bin/bundle'
9
9
  - 'vendor/bundle/**/*'
10
+ - 'bin/console'
10
11
 
11
12
  Layout/LineLength:
12
13
  Max: 160
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.22.0] 2021-12-21
4
+
5
+ - Added `SoberSwag::Reporting`, which is basically a v2 of the gem!
6
+ Docs for this can be found in [docs/reporting.md].
7
+
3
8
  ## [v0.21.0] 2021-09-02
4
9
 
5
10
  - Added a new method of serializing views based on hash lookups, improving performance
data/bin/console CHANGED
@@ -9,11 +9,6 @@ Bio = SoberSwag.input_object do
9
9
  attribute :gender, SoberSwag::Types::String.enum('male', 'female') | SoberSwag::Types::String
10
10
  end
11
11
 
12
- Person = SoberSwag.input_object do
13
- attribute :name, SoberSwag::Types::String
14
- attribute? :bio, Bio.optional
15
- end
16
-
17
12
  MultiFloorLocation = SoberSwag.input_object do
18
13
  attribute :building, SoberSwag::Types::String.enum('science', 'mathematics', 'literature')
19
14
  attribute :floor, SoberSwag::Types::String
@@ -25,12 +20,37 @@ SingleFloorLocation = SoberSwag.input_object do
25
20
  attribute :room, SoberSwag::Types::Integer
26
21
  end
27
22
 
28
- SchoolClass = SoberSwag.input_object do
29
- attribute :prof, Person.meta(description: 'The person who teaches this class.')
30
- attribute :students, SoberSwag::Types::Array.of(Person)
31
- attribute :location, (SingleFloorLocation | MultiFloorLocation).meta(description: 'What building and room this is in')
23
+ SortDirections = SoberSwag::Types::CommaArray.of(SoberSwag::Types::String.enum('created_at', 'updated_at', '-created_at', '-updated_at'))
24
+
25
+ # test
26
+ class Whatever < SoberSwag::Reporting::Input::Struct
27
+ attribute :first_name, SoberSwag::Reporting::Input::Text.new
28
+ attribute :last_name, SoberSwag::Reporting::Input::Text.new
29
+ attribute? :father, SoberSwag::Reporting::Input::Null.new | SoberSwag::Reporting::Input::Defer.new(proc { Whatever }), description: 'if the father is in our db, will be present'
30
+ attribute? :mother, SoberSwag::Reporting::Input::Null.new | SoberSwag::Reporting::Input::Defer.new(proc { Whatever }), description: 'if the mother is in our db, will be present'
32
31
  end
33
32
 
34
- SortDirections = SoberSwag::Types::CommaArray.of(SoberSwag::Types::String.enum('created_at', 'updated_at', '-created_at', '-updated_at'))
33
+ # Kinda neat thing
34
+ class Otherwised < Whatever
35
+ attribute :ident, SoberSwag::Reporting::Input::Text.new.with_pattern(/^[A-Za-z0-9]+$/)
36
+ end
37
+
38
+ ArrayOfPeople = Otherwised.or(Whatever).list
39
+
40
+ ##
41
+ # Output for a person
42
+ class OutputPerson < SoberSwag::Reporting::Output::Struct
43
+ field :first_name, SoberSwag::Reporting::Output::Text.new
44
+ field :last_name, SoberSwag::Reporting::Output::Text.new
45
+ define_view :detail do
46
+ field :initials, SoberSwag::Reporting::Output::Text.new do |obj|
47
+ [obj.first_name, obj.last_name].map { |e| e[0..0] }.map { |e| "#{e}." }.join(' ')
48
+ end
49
+ end
50
+ end
51
+
52
+ Person = Struct.new(:first_name, :last_name)
53
+
54
+ OutputPerson.view(:base)
35
55
 
36
56
  Pry.start
data/docs/reporting.md ADDED
@@ -0,0 +1,190 @@
1
+ # SoberSwag Reporting
2
+
3
+ `SoberSwag::Reporting` is a new module that provides a more *composable* interface of sober swag types.
4
+ Unlike the base version, it is *not* based on `dry-types`, instead using a simpler scheme.
5
+ It also allows for modeling of more complex type domains, and more reusable types.
6
+
7
+ The module is called `SoberSwag::Reporting` because it *reports* what happened on failure.
8
+ Consider trying to parse a struct with a first and last name, both of which need to be non-empty strings.
9
+ If I give it this input:
10
+
11
+ ```json
12
+ {
13
+ "first_name": 10,
14
+ "last_name": ""
15
+ }
16
+ ```
17
+
18
+ I will get back a report, which can tell me:
19
+
20
+ ```json
21
+ {
22
+ "$.first_name": ["must be a string"],
23
+ "$.last_name": ["does not match pattern (.+)"]
24
+ }
25
+ ```
26
+
27
+ As you can see, we get a dictionary of JSON-path values to errors.
28
+
29
+ More interestingly, you can use serializers in "reporting mode," which will *verify* that you're actually serializing what you said you would.
30
+ If you mess up, it'll give you a report of where the errors were.
31
+ This is intended to be used to make writing specs easier: to check that your serializer gives the right types, just use it in reporting mode and check the value!
32
+
33
+ ## Basic Design
34
+
35
+ SoberSwag's reporting module is designed from the ground up to be *node-based*.
36
+ Everything conforms to a common interface.
37
+ For reporting *inputs*, all values:
38
+
39
+ - Have a method `call` which converts an input to the desired format, or a report if there was an error
40
+ - Have a method `call!` which converts an input to the desired format, or raises an exception if there was an error
41
+ - Have a method `swagger_schema` which converts the node to its swagger schema.
42
+
43
+
44
+ For reporting *outputs*, all values:
45
+
46
+ - Have a method `call` which serializes out a value
47
+ - Have a method `serialize_report` which serializes in "reporting mode," IE, it will return a report if serialization happened improperly
48
+ - Have a method `views` which returns a *set of applicable views*.
49
+ This is used to implement a serializer with many alternatives.
50
+ These views *propagate* correctly.
51
+ So if you have views `[:base, :detail]` on a serializer for a person, a serializer for an array of people will have the same views.
52
+ - Have a method `view` which takes in an argument, and returns a serializer specialized to that view.
53
+ - Have a method `swagger_schema` which converts the node to its swagger schema
54
+
55
+ From there, everything is done via composition.
56
+ Nodes delegate to other nodes to provide functionality like "wrap this type in a common reference" and "validate that this string matches this regexp."
57
+ Currently, the only validator built-in is matching a regexp or being a member of an enum, but we may add more in the future.
58
+ You can also use `.mapped` to do custom validation:
59
+
60
+ ```ruby
61
+ NotTheStringBob = SoberSwag::Reporting::Input.text.mapped do |text|
62
+ if text == "Bob"
63
+ Report::Value.new(['was the string bob I specifically told you not to be the string bob'])
64
+ else
65
+ text
66
+ end
67
+ end
68
+ ```
69
+
70
+ ## Input Structs
71
+
72
+ SoberSwag's reporting mode includes a class called `SoberSwag::Reporting::Input::Struct`.
73
+ It can be used to model *struct inputs*, IE, inputs that have some properties and are represented by JSON objects.
74
+
75
+ These structs behave much like Ruby structs, and implement inheritance *correctly*.
76
+ This means that the following works:
77
+
78
+ ```ruby
79
+ class Person < SoberSwag::Reporting::Input::Struct
80
+ attribute :first_name, SoberSwag::Reporting::Input.text
81
+ attribute :last_name, SoberSwag::Reporting::Input.text
82
+ end
83
+
84
+ class GradedPerson < Person
85
+ attribute :grade, SoberSwag::Reporting::Input.text.enum('A', 'B', 'C', 'D', 'F')
86
+ end
87
+ ```
88
+
89
+ ## Output Structs
90
+
91
+ SoberSwag's Reporting Output Structs work much the same way.
92
+ You can define *fields* on them, which they will serialize.
93
+ You can use them to define how to serialize an object, like so:
94
+
95
+ ```ruby
96
+ class PersonOutput < SoberSwag::Output::Struct
97
+ field :first_name, SoberSwag::Reporting::Output.text
98
+ field :last_name, SoberSwag::Reporting::Output.text
99
+
100
+ field :grade, SoberSwag::Reporting::Output.text.nilable do
101
+ if object_to_serialize.respond_to?(:grade)
102
+ object_to_serialize.grade
103
+ else
104
+ nil
105
+ end
106
+ end
107
+
108
+ field :has_grade, SoberSwag::Reporting::Output.bool do
109
+ grade.nil? # fields are defined as *methods* on the output struct
110
+ end
111
+ end
112
+ ```
113
+
114
+ Output Structs can also have *views*.
115
+ Views can be nested only once - if you use a serializer with views as the key of an object, we will *always* use the base view.
116
+ This prevents some weirdness with the non-reporting SoberSwag serializers, where views could technically be read by child objects in some circumstances as they were only passed in the `view` key.
117
+ A view will *always inherit all attributes of the parent object, regardless of order.*
118
+
119
+ ```ruby
120
+ class AlternativePersonOutput < SoberSwag::Output::Struct
121
+ field :first_name, SoberSwag::Reporting::Output.text
122
+
123
+ view :with_grade do
124
+ field :grade, SoberSwag::Reporting::Output.text.nilable do
125
+ if object_to_serialize.respond_to?(:grade)
126
+ object_to_serialize.grade
127
+ else
128
+ nil
129
+ end
130
+ end
131
+ end
132
+
133
+ field :last_name, SoberSwag::Reporting::Output.text
134
+ end
135
+
136
+ AlternativePersonOutput.views # => Set.new(:base, :with_grade)
137
+ AlternativePersonOutput.view(:with_grade).serialize(my_person) # includes the last_name field
138
+ ```
139
+
140
+ View relationships are modeled with *composition*.
141
+ This leads to slightly more natural to read swagger schemas.
142
+
143
+ ## Dictionary Types
144
+
145
+ SoberSwag's reporting outputs allow defining a *dictionary* of key-value types.
146
+ This lets you represent an object like this in your schema:
147
+
148
+ ```json
149
+ {
150
+ "name": "Advanced Time Travel",
151
+ "student_grades": {
152
+ "student_id_1": "F",
153
+ "student_id_2": "F"
154
+ }
155
+ }
156
+ ```
157
+
158
+ This type would probably be represented by:
159
+
160
+ ```ruby
161
+ class Classroom < SoberSwag::Reporting::Input::Struct
162
+ attribute :name, SoberSwag::Reporting::Input.text
163
+ attribute :student_grades, SoberSwag::Reporting::Input::Dictionary.of(
164
+ SoberSwag::Reporting::Input.text.enum('A', 'B', 'C', 'D', 'F')
165
+ )
166
+ end
167
+ ```
168
+
169
+ ## Referenced Types
170
+
171
+ If you have a type you use a lot, and you want to refer to it by a common name, you can describe it like so:
172
+
173
+ ```ruby
174
+ GradeEnum = SoberSwag::Reporting::Input.text.enum('A', 'B', 'C', 'D', 'F').referenced('GradeEnum')
175
+ ```
176
+
177
+ This will now be represented as a Reference type in generated swagger.
178
+
179
+ ## Things not present
180
+
181
+ There are basically two things to keep in mind when upgrading to `SoberSwag::Reporting`.
182
+
183
+ 1. There is no longer a `default` for a type.
184
+ This is because that was really hard to model in Swagger, and can be better served via use of `.mapped` and `.optional`.
185
+ We may add this back eventually.
186
+ 2. Serializers no longer take an arbitrary `options` key.
187
+ Instead, view management is now *explicit*.
188
+ This is because it was too tempting to pass data to serialize in the options key, which is against the point of the serializers.
189
+
190
+
data/example/Gemfile CHANGED
@@ -8,7 +8,7 @@ gem 'actionpack', '>= 6.0.3.2'
8
8
  # Use sqlite3 as the database for Active Record
9
9
  gem 'sqlite3', '~> 1.4'
10
10
  # Use Puma as the app server
11
- gem 'puma', '~> 5.3'
11
+ gem 'puma', '~> 5.4'
12
12
  # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
13
13
  # gem 'jbuilder', '~> 2.7'
14
14
  # Use Active Model has_secure_password
@@ -34,7 +34,7 @@ group :development, :test do
34
34
  end
35
35
 
36
36
  group :development do
37
- gem 'listen', '>= 3.0.5', '< 3.7'
37
+ gem 'listen', '>= 3.0.5', '< 3.8'
38
38
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
39
39
  gem 'spring'
40
40
  gem 'spring-watcher-listen', '~> 2.0.0'
data/example/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- sober_swag (0.19.0)
4
+ sober_swag (0.21.0)
5
5
  activesupport
6
6
  dry-struct (~> 1.0)
7
7
  dry-types (~> 1.2)
@@ -9,164 +9,155 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actioncable (6.0.3.2)
13
- actionpack (= 6.0.3.2)
12
+ actioncable (6.0.4.1)
13
+ actionpack (= 6.0.4.1)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
- actionmailbox (6.0.3.2)
17
- actionpack (= 6.0.3.2)
18
- activejob (= 6.0.3.2)
19
- activerecord (= 6.0.3.2)
20
- activestorage (= 6.0.3.2)
21
- activesupport (= 6.0.3.2)
16
+ actionmailbox (6.0.4.1)
17
+ actionpack (= 6.0.4.1)
18
+ activejob (= 6.0.4.1)
19
+ activerecord (= 6.0.4.1)
20
+ activestorage (= 6.0.4.1)
21
+ activesupport (= 6.0.4.1)
22
22
  mail (>= 2.7.1)
23
- actionmailer (6.0.3.2)
24
- actionpack (= 6.0.3.2)
25
- actionview (= 6.0.3.2)
26
- activejob (= 6.0.3.2)
23
+ actionmailer (6.0.4.1)
24
+ actionpack (= 6.0.4.1)
25
+ actionview (= 6.0.4.1)
26
+ activejob (= 6.0.4.1)
27
27
  mail (~> 2.5, >= 2.5.4)
28
28
  rails-dom-testing (~> 2.0)
29
- actionpack (6.0.3.2)
30
- actionview (= 6.0.3.2)
31
- activesupport (= 6.0.3.2)
29
+ actionpack (6.0.4.1)
30
+ actionview (= 6.0.4.1)
31
+ activesupport (= 6.0.4.1)
32
32
  rack (~> 2.0, >= 2.0.8)
33
33
  rack-test (>= 0.6.3)
34
34
  rails-dom-testing (~> 2.0)
35
35
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
- actiontext (6.0.3.2)
37
- actionpack (= 6.0.3.2)
38
- activerecord (= 6.0.3.2)
39
- activestorage (= 6.0.3.2)
40
- activesupport (= 6.0.3.2)
36
+ actiontext (6.0.4.1)
37
+ actionpack (= 6.0.4.1)
38
+ activerecord (= 6.0.4.1)
39
+ activestorage (= 6.0.4.1)
40
+ activesupport (= 6.0.4.1)
41
41
  nokogiri (>= 1.8.5)
42
- actionview (6.0.3.2)
43
- activesupport (= 6.0.3.2)
42
+ actionview (6.0.4.1)
43
+ activesupport (= 6.0.4.1)
44
44
  builder (~> 3.1)
45
45
  erubi (~> 1.4)
46
46
  rails-dom-testing (~> 2.0)
47
47
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
48
- activejob (6.0.3.2)
49
- activesupport (= 6.0.3.2)
48
+ activejob (6.0.4.1)
49
+ activesupport (= 6.0.4.1)
50
50
  globalid (>= 0.3.6)
51
- activemodel (6.0.3.2)
52
- activesupport (= 6.0.3.2)
53
- activerecord (6.0.3.2)
54
- activemodel (= 6.0.3.2)
55
- activesupport (= 6.0.3.2)
56
- activestorage (6.0.3.2)
57
- actionpack (= 6.0.3.2)
58
- activejob (= 6.0.3.2)
59
- activerecord (= 6.0.3.2)
60
- marcel (~> 0.3.1)
61
- activesupport (6.0.3.2)
51
+ activemodel (6.0.4.1)
52
+ activesupport (= 6.0.4.1)
53
+ activerecord (6.0.4.1)
54
+ activemodel (= 6.0.4.1)
55
+ activesupport (= 6.0.4.1)
56
+ activestorage (6.0.4.1)
57
+ actionpack (= 6.0.4.1)
58
+ activejob (= 6.0.4.1)
59
+ activerecord (= 6.0.4.1)
60
+ marcel (~> 1.0.0)
61
+ activesupport (6.0.4.1)
62
62
  concurrent-ruby (~> 1.0, >= 1.0.2)
63
63
  i18n (>= 0.7, < 2)
64
64
  minitest (~> 5.1)
65
65
  tzinfo (~> 1.1)
66
66
  zeitwerk (~> 2.2, >= 2.2.2)
67
- bootsnap (1.7.5)
67
+ bootsnap (1.9.3)
68
68
  msgpack (~> 1.0)
69
69
  builder (3.2.4)
70
70
  byebug (11.1.3)
71
71
  coderay (1.1.3)
72
- concurrent-ruby (1.1.8)
72
+ concurrent-ruby (1.1.9)
73
73
  crass (1.0.6)
74
74
  diff-lcs (1.4.4)
75
- dry-configurable (0.11.6)
75
+ dry-configurable (0.13.0)
76
76
  concurrent-ruby (~> 1.0)
77
- dry-core (~> 0.4, >= 0.4.7)
78
- dry-equalizer (~> 0.2)
79
- dry-container (0.7.2)
77
+ dry-core (~> 0.6)
78
+ dry-container (0.9.0)
80
79
  concurrent-ruby (~> 1.0)
81
- dry-configurable (~> 0.1, >= 0.1.3)
82
- dry-core (0.4.9)
80
+ dry-configurable (~> 0.13, >= 0.13.0)
81
+ dry-core (0.7.1)
83
82
  concurrent-ruby (~> 1.0)
84
- dry-equalizer (0.3.0)
85
- dry-inflector (0.2.0)
86
- dry-logic (1.0.6)
83
+ dry-inflector (0.2.1)
84
+ dry-logic (1.2.0)
87
85
  concurrent-ruby (~> 1.0)
88
- dry-core (~> 0.2)
89
- dry-equalizer (~> 0.2)
90
- dry-struct (1.3.0)
91
- dry-core (~> 0.4, >= 0.4.4)
92
- dry-equalizer (~> 0.3)
93
- dry-types (~> 1.3)
86
+ dry-core (~> 0.5, >= 0.5)
87
+ dry-struct (1.4.0)
88
+ dry-core (~> 0.5, >= 0.5)
89
+ dry-types (~> 1.5)
94
90
  ice_nine (~> 0.11)
95
- dry-types (1.4.0)
91
+ dry-types (1.5.1)
96
92
  concurrent-ruby (~> 1.0)
97
93
  dry-container (~> 0.3)
98
- dry-core (~> 0.4, >= 0.4.4)
99
- dry-equalizer (~> 0.3)
94
+ dry-core (~> 0.5, >= 0.5)
100
95
  dry-inflector (~> 0.1, >= 0.1.2)
101
96
  dry-logic (~> 1.0, >= 1.0.2)
102
97
  dry-types-rails (0.3.4)
103
98
  dry-types (>= 0.8.1)
104
99
  rails (>= 3)
105
100
  erubi (1.10.0)
106
- ffi (1.15.3)
107
- globalid (0.4.2)
108
- activesupport (>= 4.2.0)
109
- i18n (1.8.9)
101
+ ffi (1.15.4)
102
+ globalid (1.0.0)
103
+ activesupport (>= 5.0)
104
+ i18n (1.8.11)
110
105
  concurrent-ruby (~> 1.0)
111
106
  ice_nine (0.11.2)
112
- listen (3.6.0)
107
+ listen (3.7.0)
113
108
  rb-fsevent (~> 0.10, >= 0.10.3)
114
109
  rb-inotify (~> 0.9, >= 0.9.10)
115
- loofah (2.9.0)
110
+ loofah (2.12.0)
116
111
  crass (~> 1.0.2)
117
112
  nokogiri (>= 1.5.9)
118
113
  mail (2.7.1)
119
114
  mini_mime (>= 0.1.1)
120
- marcel (0.3.3)
121
- mimemagic (~> 0.3.2)
115
+ marcel (1.0.2)
122
116
  method_source (1.0.0)
123
- mimemagic (0.3.10)
124
- nokogiri (~> 1)
125
- rake
126
- mini_mime (1.0.2)
127
- mini_portile2 (2.5.1)
117
+ mini_mime (1.1.2)
118
+ mini_portile2 (2.6.1)
128
119
  minitest (5.14.4)
129
120
  msgpack (1.4.2)
130
- nio4r (2.5.7)
131
- nokogiri (1.11.5)
132
- mini_portile2 (~> 2.5.0)
121
+ nio4r (2.5.8)
122
+ nokogiri (1.12.5)
123
+ mini_portile2 (~> 2.6.1)
133
124
  racc (~> 1.4)
134
125
  pry (0.14.1)
135
126
  coderay (~> 1.1)
136
127
  method_source (~> 1.0)
137
- puma (5.3.2)
128
+ puma (5.5.2)
138
129
  nio4r (~> 2.0)
139
- racc (1.5.2)
130
+ racc (1.6.0)
140
131
  rack (2.2.3)
141
132
  rack-test (1.1.0)
142
133
  rack (>= 1.0, < 3)
143
- rails (6.0.3.2)
144
- actioncable (= 6.0.3.2)
145
- actionmailbox (= 6.0.3.2)
146
- actionmailer (= 6.0.3.2)
147
- actionpack (= 6.0.3.2)
148
- actiontext (= 6.0.3.2)
149
- actionview (= 6.0.3.2)
150
- activejob (= 6.0.3.2)
151
- activemodel (= 6.0.3.2)
152
- activerecord (= 6.0.3.2)
153
- activestorage (= 6.0.3.2)
154
- activesupport (= 6.0.3.2)
134
+ rails (6.0.4.1)
135
+ actioncable (= 6.0.4.1)
136
+ actionmailbox (= 6.0.4.1)
137
+ actionmailer (= 6.0.4.1)
138
+ actionpack (= 6.0.4.1)
139
+ actiontext (= 6.0.4.1)
140
+ actionview (= 6.0.4.1)
141
+ activejob (= 6.0.4.1)
142
+ activemodel (= 6.0.4.1)
143
+ activerecord (= 6.0.4.1)
144
+ activestorage (= 6.0.4.1)
145
+ activesupport (= 6.0.4.1)
155
146
  bundler (>= 1.3.0)
156
- railties (= 6.0.3.2)
147
+ railties (= 6.0.4.1)
157
148
  sprockets-rails (>= 2.0.0)
158
149
  rails-dom-testing (2.0.3)
159
150
  activesupport (>= 4.2.0)
160
151
  nokogiri (>= 1.6)
161
- rails-html-sanitizer (1.3.0)
152
+ rails-html-sanitizer (1.4.2)
162
153
  loofah (~> 2.3)
163
- railties (6.0.3.2)
164
- actionpack (= 6.0.3.2)
165
- activesupport (= 6.0.3.2)
154
+ railties (6.0.4.1)
155
+ actionpack (= 6.0.4.1)
156
+ activesupport (= 6.0.4.1)
166
157
  method_source
167
158
  rake (>= 0.8.7)
168
159
  thor (>= 0.20.3, < 2.0)
169
- rake (13.0.3)
160
+ rake (13.0.6)
170
161
  rb-fsevent (0.11.0)
171
162
  rb-inotify (0.10.1)
172
163
  ffi (~> 1.0)
@@ -178,7 +169,7 @@ GEM
178
169
  rspec-mocks (3.10.2)
179
170
  diff-lcs (>= 1.2.0, < 2.0)
180
171
  rspec-support (~> 3.10.0)
181
- rspec-rails (5.0.1)
172
+ rspec-rails (5.0.2)
182
173
  actionpack (>= 5.2)
183
174
  activesupport (>= 5.2)
184
175
  railties (>= 5.2)
@@ -186,7 +177,7 @@ GEM
186
177
  rspec-expectations (~> 3.10)
187
178
  rspec-mocks (~> 3.10)
188
179
  rspec-support (~> 3.10)
189
- rspec-support (3.10.2)
180
+ rspec-support (3.10.3)
190
181
  spring (2.1.1)
191
182
  spring-watcher-listen (2.0.1)
192
183
  listen (>= 2.7, < 4.0)
@@ -194,19 +185,19 @@ GEM
194
185
  sprockets (4.0.2)
195
186
  concurrent-ruby (~> 1.0)
196
187
  rack (> 1, < 3)
197
- sprockets-rails (3.2.1)
198
- actionpack (>= 4.0)
199
- activesupport (>= 4.0)
188
+ sprockets-rails (3.4.1)
189
+ actionpack (>= 5.2)
190
+ activesupport (>= 5.2)
200
191
  sprockets (>= 3.0.0)
201
192
  sqlite3 (1.4.2)
202
193
  thor (1.1.0)
203
194
  thread_safe (0.3.6)
204
195
  tzinfo (1.2.9)
205
196
  thread_safe (~> 0.1)
206
- websocket-driver (0.7.3)
197
+ websocket-driver (0.7.5)
207
198
  websocket-extensions (>= 0.1.0)
208
199
  websocket-extensions (0.1.5)
209
- zeitwerk (2.4.2)
200
+ zeitwerk (2.5.1)
210
201
 
211
202
  PLATFORMS
212
203
  ruby
@@ -216,9 +207,9 @@ DEPENDENCIES
216
207
  bootsnap (>= 1.4.2)
217
208
  byebug
218
209
  dry-types-rails
219
- listen (>= 3.0.5, < 3.7)
210
+ listen (>= 3.0.5, < 3.8)
220
211
  pry
221
- puma (~> 5.3)
212
+ puma (~> 5.4)
222
213
  rails (~> 6.0.2, >= 6.0.2.2)
223
214
  rspec-rails
224
215
  sober_swag!
@@ -4,4 +4,8 @@ class ApplicationController < ActionController::API
4
4
  rescue_from Dry::Struct::Error do
5
5
  head :bad_request
6
6
  end
7
+
8
+ rescue_from SoberSwag::Reporting::Report::Error do |error|
9
+ render json: error.report.path_hash, status: :bad_request
10
+ end
7
11
  end