rails-param-validation 0.4.11 → 0.4.13
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c3f3777922312f5fe9d76c93625e28794cd41a1265fd7fedc9cfc24f6087d35
|
4
|
+
data.tar.gz: 8615b0ae5bf732082ed011fdb6c832c816cc0cd7efcfd3c5ef1aaba317431db0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0523930b96dfb11efb94ce78d34b8909ffe6ccf74a5834daf697f8a4ae99326a1880a49be9f491d96252bab44ea53f80d12ff935c54c34fedcb444d63b7c79bd'
|
7
|
+
data.tar.gz: b47077b6b9308a1cce79542c633a603887249e0120f227562a2c86549333aec17dc92fcae698c8320116de46307171b739c8c308ce81d8fd9e0726319d0718f1
|
data/README.md
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# RailsParamValidation
|
2
2
|
|
3
|
-
[![pipeline status](https://git.iftrue.de/okirmis/rails-param-validation/badges/master/pipeline.svg)](https://git.iftrue.de/okirmis/rails-param-validation/commits/master)
|
4
|
-
|
5
3
|
This gem provides parameter validation for Rails using a declarative parameter definition and makes the automatic validation of complex parameters very easy. It also supports an export of the definition as an OpenAPI document.
|
6
4
|
|
7
5
|
* [Why this gem?](./docs/main-idea.md)
|
data/bin/.keep
CHANGED
File without changes
|
@@ -54,6 +54,16 @@ module RailsParamValidation
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def add_response(status, schema, description)
|
57
|
+
if @responses.key?(status)
|
58
|
+
if @responses[status][:schema].is_a?(Array)
|
59
|
+
schema = @responses[status][:schema] + [schema];
|
60
|
+
else
|
61
|
+
schema = [@responses[status][:schema], schema]
|
62
|
+
end
|
63
|
+
|
64
|
+
description = @responses[status][:description] + "<br /> <br />OR<br /> <br />" + description
|
65
|
+
end
|
66
|
+
|
57
67
|
@responses[status] = {
|
58
68
|
schema: schema,
|
59
69
|
description: description
|
@@ -31,7 +31,9 @@ module RailsParamValidation
|
|
31
31
|
}
|
32
32
|
|
33
33
|
@actions.each do |operation|
|
34
|
-
body = operation.params.filter
|
34
|
+
body = operation.params.filter do |_, v|
|
35
|
+
v[:type] == :body && !RailsParamValidation::ValidatorFactory.create(v[:schema]).to_openapi.nil?
|
36
|
+
end.map { |name, pd| [name, pd[:schema]] }.to_h
|
35
37
|
|
36
38
|
parameters = operation.params.filter { |_, v| v[:type] != :body }.map do |name, pd|
|
37
39
|
param_definition = { name: name, in: pd[:type] }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-param-validation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oskar Kirmis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Declarative parameter definition and validation for Rails
|
14
14
|
email:
|
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '0'
|
95
95
|
requirements: []
|
96
|
-
rubygems_version: 3.3.
|
96
|
+
rubygems_version: 3.3.13
|
97
97
|
signing_key:
|
98
98
|
specification_version: 4
|
99
99
|
summary: Declarative parameter definition and validation for Rails
|