apipie-dsl 2.6.1 → 2.6.2
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 +4 -4
- data/app/helpers/apipie_dsl_helper.rb +2 -0
- data/lib/apipie_dsl/dsl.rb +8 -0
- data/lib/apipie_dsl/validator.rb +21 -0
- data/lib/apipie_dsl/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0360ed5341b04a7cb6210b133eea8d5b67c89f0171fe8e6d8d058f022c0556a
|
4
|
+
data.tar.gz: 115b4d7fe32b43da55ebe582a0ab7420351f99a985ad89e37ad1cbb669414712
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af07ec99aeff3ac81c1f8dc8940aaa66e76f69a6097636e7a43385e257158204f3746d7041ab672e2502c815a629597720b1df42941c82469a86a09bcc4fbe15
|
7
|
+
data.tar.gz: f8dca5a0acb988a094921bcd41fd03c6273f11af8399293809c31b4adf91fa6d787bc69b54e869330efadaa609f1cb0cc4551e352dc43c8761975280721801a5
|
data/lib/apipie_dsl/dsl.rb
CHANGED
@@ -130,6 +130,14 @@ module ApipieDSL
|
|
130
130
|
alias_method :splat, :list
|
131
131
|
alias_method :rest, :list
|
132
132
|
|
133
|
+
def kwlist(name, desc_or_options = nil, options = {})
|
134
|
+
options[:type] = :optional
|
135
|
+
options[:default] ||= 'empty key: value list'
|
136
|
+
param(name, :kwrest, desc_or_options, options)
|
137
|
+
end
|
138
|
+
alias_method :kwsplat, :kwlist
|
139
|
+
alias_method :kwrest, :kwlist
|
140
|
+
|
133
141
|
def define_param_group(name, &block)
|
134
142
|
ApipieDSL.define_param_group(class_scope, name, &block)
|
135
143
|
end
|
data/lib/apipie_dsl/validator.rb
CHANGED
@@ -440,6 +440,27 @@ module ApipieDSL
|
|
440
440
|
end
|
441
441
|
end
|
442
442
|
|
443
|
+
class KWRestValidator < BaseValidator
|
444
|
+
def self.build(param_description, argument, _options, _block)
|
445
|
+
return unless %i[kwrest kwlist kwsplat].include?(argument)
|
446
|
+
|
447
|
+
new(param_description)
|
448
|
+
end
|
449
|
+
|
450
|
+
def validate(_value)
|
451
|
+
# In **kwrest param we don't care about passed values.
|
452
|
+
true
|
453
|
+
end
|
454
|
+
|
455
|
+
def description
|
456
|
+
'Must be a list of key: value'
|
457
|
+
end
|
458
|
+
|
459
|
+
def expected_type
|
460
|
+
'kwlist'
|
461
|
+
end
|
462
|
+
end
|
463
|
+
|
443
464
|
class NestedValidator < BaseValidator
|
444
465
|
def initialize(param_description, argument, param_group)
|
445
466
|
super(param_description)
|
data/lib/apipie_dsl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apipie-dsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleh Fedorenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|