rails-param-validation 0.4.9 → 0.4.12

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: 159abe7b80c564e22c8558d37cf678e893af6438bf0953a777508e83710da3d3
4
- data.tar.gz: 6bae6fef3bd27f3c8f6ecfd04b6177e38857e2f3a4d97355451d9035eab3190c
3
+ metadata.gz: 61bc0afb5dba4401d6afa3f851416b53bed20ebde9c62fd89493da840fd82157
4
+ data.tar.gz: a517bcab6f56b5e1c70884f126dcd91170b34bd503705ad8003c335a44ae5b7f
5
5
  SHA512:
6
- metadata.gz: 25ce91f9ebd0d83ced27a2c01a74b1103e6a6559d53f0166cc20a9b81e731c72746b04b8f86cbfccf4153815605220a5f6f13f7d19bea0a90c3dd9e979ca4b12
7
- data.tar.gz: c9a0e8e46a114d6b636c0e5f302f8cff2a0bbe7a1c89cfbe9e366d2ac6244e29d053f0fd5ee3778b0d3f1db51625ac597f32bce907cfde71baf4f6d8e1a3e6c9
6
+ metadata.gz: e8dc19eedd724d32b5bded8f7c01db9650fdc811fa4491d3e5fd89fed82fe9ea7fa7e073e0821ad3ac8c7c54b4f260032727c8547ffba53eed694c2214ccbb3b
7
+ data.tar.gz: 82a35745f21469296d35073f82a5858a3dbbf0d524710457a20bb6e2d8f0711e9cc1f6d85ffb837af693747f395da635adff4cc0e0ea0da8129cf57a9c577478
data/bin/.keep CHANGED
File without changes
@@ -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
@@ -38,7 +38,11 @@ module RailsParamValidation
38
38
  end
39
39
 
40
40
  module ClassMethods
41
- def base_path(path)
41
+ def base_path(path, include_module_name: true)
42
+ if include_module_name
43
+ path = "#{module_parent_name.underscore}/#{path}".gsub("//", "/")
44
+ end
45
+
42
46
  @base_paths ||= {}
43
47
  @base_paths[self.name] = path
44
48
  end
@@ -31,7 +31,9 @@ module RailsParamValidation
31
31
  }
32
32
 
33
33
  @actions.each do |operation|
34
- body = operation.params.filter { |_, v| v[:type] == :body }.map { |name, pd| [name, pd[:schema]] }.to_h
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] }
@@ -67,7 +69,19 @@ module RailsParamValidation
67
69
  end.to_h
68
70
  }
69
71
 
70
- action_definition.merge!(summary: operation.description) if operation.description.present?
72
+ param_documentation = operation
73
+ .params
74
+ .filter { |_, v| v[:description].present? }
75
+ .map { |name, param| "* `#{name}`<br />#{param[:description]}" }
76
+ .join("\n\n")
77
+
78
+ if param_documentation.present?
79
+ param_documentation = "**Parameters**\n#{param_documentation}"
80
+ end
81
+
82
+ if param_documentation.present? || operation.description.present?
83
+ action_definition.merge!(description: "#{operation.description}\n\n#{param_documentation}".strip)
84
+ end
71
85
 
72
86
  if body.any?
73
87
  body_type_name = Types::Namespace.with_namespace(
@@ -1,3 +1,3 @@
1
1
  module RailsParamValidation
2
- VERSION = "0.4.9"
2
+ VERSION = "0.4.12"
3
3
  end
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.9
4
+ version: 0.4.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oskar Kirmis
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-22 00:00:00.000000000 Z
11
+ date: 2022-09-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Declarative parameter definition and validation for Rails
14
14
  email:
@@ -78,7 +78,7 @@ metadata:
78
78
  homepage_uri: https://okirmis.github.io/rails-param-validation
79
79
  source_code_uri: https://github.com/okirmis/rails-param-validation
80
80
  changelog_uri: https://github.com/okirmis/rails-param-validation
81
- post_install_message:
81
+ post_install_message:
82
82
  rdoc_options: []
83
83
  require_paths:
84
84
  - lib
@@ -93,8 +93,8 @@ 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.12
97
- signing_key:
96
+ rubygems_version: 3.3.13
97
+ signing_key:
98
98
  specification_version: 4
99
99
  summary: Declarative parameter definition and validation for Rails
100
100
  test_files: []