openapi_parameters 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/openapi_parameters/converter.rb +0 -1
- data/lib/openapi_parameters/cookie.rb +0 -2
- data/lib/openapi_parameters/parameter.rb +8 -7
- data/lib/openapi_parameters/query.rb +1 -1
- data/lib/openapi_parameters/unpacker.rb +1 -1
- data/lib/openapi_parameters/version.rb +1 -1
- data/lib/openapi_parameters.rb +11 -3
- metadata +2 -25
- data/.rspec +0 -3
- data/.rubocop.yml +0 -19
- data/.tool-versions +0 -1
- data/Gemfile +0 -13
- data/Gemfile.lock +0 -89
- data/LICENSE +0 -21
- data/Rakefile +0 -10
- data/openapi_parameters.gemspec +0 -46
- data/sig/openapi_parameters.rbs +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e010a357f13e7452f8945d95e7c277fc35c87d1cc713e41dccae68a20d37db03
|
4
|
+
data.tar.gz: 763b4eed6e0e11c4f0ff839afa366cadc6569c371a4ccd5490a7b3368f8849fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49a1e95d33f513346408826aa1954d9a8c58b7a656d23b1643f8f5664e3747ab04589586d8c6ffcd9392022ff85ad2f4722dd9e541f569399ff8a7bd2226ecb6
|
7
|
+
data.tar.gz: 6bc8eadb1948050b12ab6561c8e412ab124d0bfd64d94414506f71d5c1549d963c2d765ce0e9ebea1908c258ef30d17b7f8c4db3bd9c81643897c0bac86ad487
|
data/CHANGELOG.md
CHANGED
@@ -6,17 +6,18 @@ module OpenapiParameters
|
|
6
6
|
class Parameter
|
7
7
|
# @param definition [Hash] The parameter definition. A string keyed Hash.
|
8
8
|
def initialize(definition)
|
9
|
-
check_supported!(definition)
|
10
9
|
@definition = definition
|
10
|
+
@name = definition['name']
|
11
|
+
@is_deep_object = style == 'deepObject'
|
12
|
+
check_supported!
|
11
13
|
end
|
12
14
|
|
13
|
-
attr_reader :definition
|
15
|
+
attr_reader :definition, :name
|
14
16
|
|
15
|
-
def
|
16
|
-
|
17
|
+
def deep_object?
|
18
|
+
@is_deep_object
|
17
19
|
end
|
18
20
|
|
19
|
-
##
|
20
21
|
# @return [String] The location of the parameter in the request, "path", "query", "header" or "cookie".
|
21
22
|
def location
|
22
23
|
definition['in']
|
@@ -90,8 +91,8 @@ module OpenapiParameters
|
|
90
91
|
REF = '$ref'
|
91
92
|
private_constant :REF
|
92
93
|
|
93
|
-
def check_supported!
|
94
|
-
return unless
|
94
|
+
def check_supported!
|
95
|
+
return unless schema&.key?(REF)
|
95
96
|
|
96
97
|
raise NotSupportedError,
|
97
98
|
"Parameter schema with $ref is not supported: #{definition.inspect}"
|
@@ -16,7 +16,7 @@ module OpenapiParameters
|
|
16
16
|
parsed_query = Rack::Utils.parse_query(query_string)
|
17
17
|
parameters.each_with_object({}) do |parameter, result|
|
18
18
|
parameter = Parameter.new(parameter)
|
19
|
-
if parameter.
|
19
|
+
if parameter.deep_object?
|
20
20
|
parsed_nested_query = Rack::Utils.parse_nested_query(query_string)
|
21
21
|
next unless parsed_nested_query.key?(parameter.name)
|
22
22
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module OpenapiParameters
|
4
|
-
|
4
|
+
# Unpacks a parameter value from a string as defined in the OpenAPI specification.
|
5
5
|
# @visibility private
|
6
6
|
module Unpacker
|
7
7
|
class << self
|
data/lib/openapi_parameters.rb
CHANGED
@@ -1,9 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'rack'
|
4
|
+
require_relative 'openapi_parameters/converter'
|
5
|
+
require_relative 'openapi_parameters/cookie'
|
6
|
+
require_relative 'openapi_parameters/error'
|
7
|
+
require_relative 'openapi_parameters/header'
|
8
|
+
require_relative 'openapi_parameters/headers_hash'
|
9
|
+
require_relative 'openapi_parameters/not_supported_error'
|
10
|
+
require_relative 'openapi_parameters/parameter'
|
11
|
+
require_relative 'openapi_parameters/path'
|
12
|
+
require_relative 'openapi_parameters/query'
|
13
|
+
require_relative 'openapi_parameters/unpacker'
|
4
14
|
|
5
15
|
# OpenapiParameters is a gem that parses OpenAPI parameters from Rack
|
6
16
|
module OpenapiParameters
|
7
|
-
LOADER = Zeitwerk::Loader.for_gem
|
8
|
-
LOADER.setup
|
9
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openapi_parameters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Haller
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.2'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: zeitwerk
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '2.6'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '2.6'
|
41
27
|
description: This parses HTTP query/path/header/cookie parameters exactly as described
|
42
28
|
in an OpenAPI API description.
|
43
29
|
email:
|
@@ -46,15 +32,8 @@ executables: []
|
|
46
32
|
extensions: []
|
47
33
|
extra_rdoc_files: []
|
48
34
|
files:
|
49
|
-
- ".rspec"
|
50
|
-
- ".rubocop.yml"
|
51
|
-
- ".tool-versions"
|
52
35
|
- CHANGELOG.md
|
53
|
-
- Gemfile
|
54
|
-
- Gemfile.lock
|
55
|
-
- LICENSE
|
56
36
|
- README.md
|
57
|
-
- Rakefile
|
58
37
|
- lib/openapi_parameters.rb
|
59
38
|
- lib/openapi_parameters/converter.rb
|
60
39
|
- lib/openapi_parameters/cookie.rb
|
@@ -67,8 +46,6 @@ files:
|
|
67
46
|
- lib/openapi_parameters/query.rb
|
68
47
|
- lib/openapi_parameters/unpacker.rb
|
69
48
|
- lib/openapi_parameters/version.rb
|
70
|
-
- openapi_parameters.gemspec
|
71
|
-
- sig/openapi_parameters.rbs
|
72
49
|
homepage: https://github.com/ahx/openapi_parameters
|
73
50
|
licenses:
|
74
51
|
- MIT
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require:
|
2
|
-
- rubocop-rspec
|
3
|
-
|
4
|
-
Naming/MethodParameterName:
|
5
|
-
Enabled: false
|
6
|
-
|
7
|
-
AllCops:
|
8
|
-
NewCops: enable
|
9
|
-
SuggestExtensions: false
|
10
|
-
TargetRubyVersion: 3.1
|
11
|
-
|
12
|
-
RSpec/ExampleLength:
|
13
|
-
Enabled: false
|
14
|
-
|
15
|
-
RSpec/NestedGroups:
|
16
|
-
Max: 4
|
17
|
-
|
18
|
-
Metrics/MethodLength:
|
19
|
-
Max: 20
|
data/.tool-versions
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ruby 3.2.1
|
data/Gemfile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source 'https://rubygems.org'
|
4
|
-
|
5
|
-
# Specify your gem's dependencies in OpenapiParameters.gemspec
|
6
|
-
gemspec
|
7
|
-
|
8
|
-
gem 'rack-test'
|
9
|
-
gem 'rake', '~> 13.0'
|
10
|
-
gem 'rspec', '~> 3.0'
|
11
|
-
gem 'rspec-benchmark'
|
12
|
-
gem 'rubocop'
|
13
|
-
gem 'rubocop-rspec'
|
data/Gemfile.lock
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
openapi_parameters (0.3.2)
|
5
|
-
rack (>= 2.2)
|
6
|
-
zeitwerk (~> 2.6)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
ast (2.4.2)
|
12
|
-
benchmark-malloc (0.2.0)
|
13
|
-
benchmark-perf (0.6.0)
|
14
|
-
benchmark-trend (0.4.0)
|
15
|
-
diff-lcs (1.5.0)
|
16
|
-
json (2.6.3)
|
17
|
-
language_server-protocol (3.17.0.3)
|
18
|
-
parallel (1.23.0)
|
19
|
-
parser (3.2.2.4)
|
20
|
-
ast (~> 2.4.1)
|
21
|
-
racc
|
22
|
-
racc (1.7.3)
|
23
|
-
rack (3.0.8)
|
24
|
-
rack-test (2.1.0)
|
25
|
-
rack (>= 1.3)
|
26
|
-
rainbow (3.1.1)
|
27
|
-
rake (13.1.0)
|
28
|
-
regexp_parser (2.8.2)
|
29
|
-
rexml (3.2.6)
|
30
|
-
rspec (3.12.0)
|
31
|
-
rspec-core (~> 3.12.0)
|
32
|
-
rspec-expectations (~> 3.12.0)
|
33
|
-
rspec-mocks (~> 3.12.0)
|
34
|
-
rspec-benchmark (0.6.0)
|
35
|
-
benchmark-malloc (~> 0.2)
|
36
|
-
benchmark-perf (~> 0.6)
|
37
|
-
benchmark-trend (~> 0.4)
|
38
|
-
rspec (>= 3.0)
|
39
|
-
rspec-core (3.12.2)
|
40
|
-
rspec-support (~> 3.12.0)
|
41
|
-
rspec-expectations (3.12.3)
|
42
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
-
rspec-support (~> 3.12.0)
|
44
|
-
rspec-mocks (3.12.6)
|
45
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
-
rspec-support (~> 3.12.0)
|
47
|
-
rspec-support (3.12.1)
|
48
|
-
rubocop (1.57.2)
|
49
|
-
json (~> 2.3)
|
50
|
-
language_server-protocol (>= 3.17.0)
|
51
|
-
parallel (~> 1.10)
|
52
|
-
parser (>= 3.2.2.4)
|
53
|
-
rainbow (>= 2.2.2, < 4.0)
|
54
|
-
regexp_parser (>= 1.8, < 3.0)
|
55
|
-
rexml (>= 3.2.5, < 4.0)
|
56
|
-
rubocop-ast (>= 1.28.1, < 2.0)
|
57
|
-
ruby-progressbar (~> 1.7)
|
58
|
-
unicode-display_width (>= 2.4.0, < 3.0)
|
59
|
-
rubocop-ast (1.30.0)
|
60
|
-
parser (>= 3.2.1.0)
|
61
|
-
rubocop-capybara (2.19.0)
|
62
|
-
rubocop (~> 1.41)
|
63
|
-
rubocop-factory_bot (2.24.0)
|
64
|
-
rubocop (~> 1.33)
|
65
|
-
rubocop-rspec (2.25.0)
|
66
|
-
rubocop (~> 1.40)
|
67
|
-
rubocop-capybara (~> 2.17)
|
68
|
-
rubocop-factory_bot (~> 2.22)
|
69
|
-
ruby-progressbar (1.13.0)
|
70
|
-
unicode-display_width (2.5.0)
|
71
|
-
zeitwerk (2.6.12)
|
72
|
-
|
73
|
-
PLATFORMS
|
74
|
-
arm64-darwin-21
|
75
|
-
arm64-darwin-22
|
76
|
-
x86_64-darwin-20
|
77
|
-
x86_64-linux
|
78
|
-
|
79
|
-
DEPENDENCIES
|
80
|
-
openapi_parameters!
|
81
|
-
rack-test
|
82
|
-
rake (~> 13.0)
|
83
|
-
rspec (~> 3.0)
|
84
|
-
rspec-benchmark
|
85
|
-
rubocop
|
86
|
-
rubocop-rspec
|
87
|
-
|
88
|
-
BUNDLED WITH
|
89
|
-
2.3.10
|
data/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2023 Andreas Haller
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
data/Rakefile
DELETED
data/openapi_parameters.gemspec
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'lib/openapi_parameters/version'
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = 'openapi_parameters'
|
7
|
-
spec.version = OpenapiParameters::VERSION
|
8
|
-
spec.authors = ['Andreas Haller']
|
9
|
-
spec.email = ['andreas.haller@posteo.de']
|
10
|
-
|
11
|
-
spec.summary = 'openapi_parameters is an OpenAPI aware parameter parser'
|
12
|
-
spec.description =
|
13
|
-
'This parses HTTP query/path/header/cookie parameters exactly as described in an OpenAPI API description.'
|
14
|
-
spec.homepage = 'https://github.com/ahx/openapi_parameters'
|
15
|
-
spec.required_ruby_version = '>= 3.1.0'
|
16
|
-
spec.licenses = ['MIT']
|
17
|
-
|
18
|
-
spec.metadata['homepage_uri'] = spec.homepage
|
19
|
-
spec.metadata['source_code_uri'] = 'https://github.com/ahx/openapi_parameters'
|
20
|
-
spec.metadata[
|
21
|
-
'changelog_uri'
|
22
|
-
] = 'https://github.com/ahx/openapi_parameters/blob/main/CHANGELOG.md'
|
23
|
-
|
24
|
-
# Specify which files should be added to the gem when it is released.
|
25
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
26
|
-
spec.files =
|
27
|
-
Dir.chdir(__dir__) do
|
28
|
-
`git ls-files -z`.split("\x0")
|
29
|
-
.reject do |f|
|
30
|
-
(f == __FILE__) ||
|
31
|
-
f.match(
|
32
|
-
%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)}
|
33
|
-
)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
spec.bindir = 'exe'
|
37
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
38
|
-
spec.require_paths = ['lib']
|
39
|
-
|
40
|
-
spec.add_dependency 'rack', '>= 2.2'
|
41
|
-
spec.add_dependency 'zeitwerk', '~> 2.6'
|
42
|
-
|
43
|
-
# For more information and examples about making a new gem, check out our
|
44
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
45
|
-
spec.metadata['rubygems_mfa_required'] = 'true'
|
46
|
-
end
|
data/sig/openapi_parameters.rbs
DELETED