rails-param-validation 0.4.7 → 0.4.10
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6986755ba3d6b9b626b5544560e111b5ec57fb880775d3743f3fd10c82f56141
|
4
|
+
data.tar.gz: 93932c2a023ca4a9ee260fcac52472d3d32c299369c1f68a395110d51940d7b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 900f628d863aab14082ce9948cda48189d60a101729a7709fd97588a1561ff54915e0832f92e6f6614ffe05e3b8cd1272468493da28e8e7371ec9016c161764c
|
7
|
+
data.tar.gz: 63d4fde71ceec6d935cbd7553af841de930a57d68caaefdf5d9642515a62e0bc4f7ae9238e0a437cda0b7ef1f4da7f4b72aba0079cb7f95360e197719c33b375
|
@@ -23,7 +23,7 @@ module RailsParamValidation
|
|
23
23
|
|
24
24
|
@param_definition.store_origin! class_name, method_name
|
25
25
|
RailsParamValidation.config.post_action_definition_hook.call(@param_definition)
|
26
|
-
@param_definition.finalize! class_name, method_name, (@base_paths || {}).fetch(self.name, self.name.underscore)
|
26
|
+
@param_definition.finalize! class_name, method_name, (@base_paths || {}).fetch(self.name, self.name.gsub(/Controller$/, "").underscore)
|
27
27
|
|
28
28
|
AnnotationManager.instance.annotate_method! self, name, :param_definition, @param_definition
|
29
29
|
@param_definition = nil
|
@@ -67,7 +67,19 @@ module RailsParamValidation
|
|
67
67
|
end.to_h
|
68
68
|
}
|
69
69
|
|
70
|
-
|
70
|
+
param_documentation = operation
|
71
|
+
.params
|
72
|
+
.filter { |_, v| v[:description].present? }
|
73
|
+
.map { |name, param| "* `#{name}`<br />#{param[:description]}" }
|
74
|
+
.join("\n\n")
|
75
|
+
|
76
|
+
if param_documentation.present?
|
77
|
+
param_documentation = "**Parameters**\n#{param_documentation}"
|
78
|
+
end
|
79
|
+
|
80
|
+
if param_documentation.present? || operation.description.present?
|
81
|
+
action_definition.merge!(description: "#{operation.description}\n\n#{param_documentation}".strip)
|
82
|
+
end
|
71
83
|
|
72
84
|
if body.any?
|
73
85
|
body_type_name = Types::Namespace.with_namespace(
|
@@ -43,10 +43,11 @@ class OptionalT < AnnotationT
|
|
43
43
|
end
|
44
44
|
|
45
45
|
class CustomT < AnnotationT
|
46
|
-
attr_reader :type
|
46
|
+
attr_reader :type, :from
|
47
47
|
|
48
|
-
def initialize(type)
|
48
|
+
def initialize(type, from: :name)
|
49
49
|
@type = type
|
50
|
+
@from = from
|
50
51
|
end
|
51
52
|
|
52
53
|
def schema
|
@@ -62,7 +63,7 @@ class CustomT < AnnotationT
|
|
62
63
|
|
63
64
|
def self.registered(type)
|
64
65
|
raise TypeNotFound.new(type) unless registry.key? type
|
65
|
-
registry[type]
|
66
|
+
registry[type].is_a?(Proc) ? registry[type].call : registry[type]
|
66
67
|
end
|
67
68
|
|
68
69
|
def self.types
|
@@ -75,6 +76,8 @@ class CustomT < AnnotationT
|
|
75
76
|
@@types ||= {}
|
76
77
|
end
|
77
78
|
end
|
79
|
+
|
80
|
+
CustomType = CustomT
|
78
81
|
end
|
79
82
|
|
80
83
|
module Types
|
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.10
|
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-04-
|
11
|
+
date: 2022-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Declarative parameter definition and validation for Rails
|
14
14
|
email:
|