rails-param-validation 0.4.8 → 0.4.11

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: 43dd035e9528951cf0b74e1b8c34f9c58d59953ce1d60dc9d453bfec86ca1093
4
- data.tar.gz: a2567aab228e7ce55f5b3dad0207fd83c59b0f762288d7efed203b3fa6a079b3
3
+ metadata.gz: 03afb2f7dae8d957fa9081d67451746f907a34e3a0cf19f02327c6e0d53e1a2c
4
+ data.tar.gz: 7ee1ce7f02547ce4580ade8081c9347824c7bc2ea63dc956e449a0a777291700
5
5
  SHA512:
6
- metadata.gz: b4c833ea0c91100ab9320da15bd8e7b9df2a05215092a172e6b459a6b536354e480a18da9999e1baeb09fe953f46c93fa5bd46c819455d77caff1e6e3ac0ab50
7
- data.tar.gz: 81732ea1dc34e5d7ad2b97c8e390bf2bf3dc43948c1096cf83701e088897d13b1b12b492cac7a82f2f6684179b5f49a7be4832502a2220b8f95fea3ac60d8f5f
6
+ metadata.gz: 8adb46a6ff77b010065fc54f9b28439aba097db32306e24ddc62e433319659edc12492f13efe514aee68e7640f7546385727ec93c4ece9549375ffe9ea9e9a08
7
+ data.tar.gz: aaebdb605611682da1a7c90273b3e7433ffb53cf2524eb29d56277bc03f5f6914d815263223c7efbc6715858cddc86c7bfd460cec99199c96013d2cfde69fb9f
@@ -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
@@ -67,7 +67,19 @@ module RailsParamValidation
67
67
  end.to_h
68
68
  }
69
69
 
70
- action_definition.merge!(summary: operation.description) if operation.description.present?
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(
@@ -63,7 +63,7 @@ class CustomT < AnnotationT
63
63
 
64
64
  def self.registered(type)
65
65
  raise TypeNotFound.new(type) unless registry.key? type
66
- registry[type]
66
+ registry[type].is_a?(Proc) ? registry[type].call : registry[type]
67
67
  end
68
68
 
69
69
  def self.types
@@ -1,3 +1,3 @@
1
1
  module RailsParamValidation
2
- VERSION = "0.4.8"
2
+ VERSION = "0.4.11"
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.8
4
+ version: 0.4.11
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-05-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.7
97
+ signing_key:
98
98
  specification_version: 4
99
99
  summary: Declarative parameter definition and validation for Rails
100
100
  test_files: []