openapi_first 1.0.0.beta5 → 1.0.0.beta6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +2 -1
  3. data/CHANGELOG.md +8 -0
  4. data/Gemfile +2 -1
  5. data/Gemfile.lock +6 -9
  6. data/Gemfile.rack2 +15 -0
  7. data/lib/openapi_first/{body_parser_middleware.rb → body_parser.rb} +3 -15
  8. data/lib/openapi_first/definition/cookie_parameters.rb +12 -0
  9. data/lib/openapi_first/definition/has_content.rb +37 -0
  10. data/lib/openapi_first/definition/header_parameters.rb +12 -0
  11. data/lib/openapi_first/definition/operation.rb +103 -0
  12. data/lib/openapi_first/definition/parameters.rb +47 -0
  13. data/lib/openapi_first/definition/path_item.rb +23 -0
  14. data/lib/openapi_first/definition/path_parameters.rb +13 -0
  15. data/lib/openapi_first/definition/query_parameters.rb +12 -0
  16. data/lib/openapi_first/definition/request_body.rb +32 -0
  17. data/lib/openapi_first/definition/response.rb +37 -0
  18. data/lib/openapi_first/{json_schema → definition/schema}/result.rb +1 -1
  19. data/lib/openapi_first/{json_schema.rb → definition/schema.rb} +2 -2
  20. data/lib/openapi_first/definition.rb +26 -6
  21. data/lib/openapi_first/error_response.rb +2 -0
  22. data/lib/openapi_first/request_body_validator.rb +17 -21
  23. data/lib/openapi_first/request_validation.rb +34 -30
  24. data/lib/openapi_first/response_validation.rb +31 -11
  25. data/lib/openapi_first/router.rb +19 -53
  26. data/lib/openapi_first/version.rb +1 -1
  27. data/openapi_first.gemspec +7 -4
  28. metadata +32 -52
  29. data/.rspec +0 -3
  30. data/.rubocop.yml +0 -14
  31. data/Rakefile +0 -15
  32. data/benchmarks/Gemfile +0 -16
  33. data/benchmarks/Gemfile.lock +0 -142
  34. data/benchmarks/README.md +0 -29
  35. data/benchmarks/apps/committee_with_hanami_api.ru +0 -26
  36. data/benchmarks/apps/committee_with_response_validation.ru +0 -29
  37. data/benchmarks/apps/committee_with_sinatra.ru +0 -31
  38. data/benchmarks/apps/grape.ru +0 -21
  39. data/benchmarks/apps/hanami_api.ru +0 -21
  40. data/benchmarks/apps/hanami_router.ru +0 -14
  41. data/benchmarks/apps/openapi.yaml +0 -268
  42. data/benchmarks/apps/openapi_first_with_hanami_api.ru +0 -24
  43. data/benchmarks/apps/openapi_first_with_plain_rack.ru +0 -32
  44. data/benchmarks/apps/openapi_first_with_response_validation.ru +0 -25
  45. data/benchmarks/apps/openapi_first_with_sinatra.ru +0 -29
  46. data/benchmarks/apps/roda.ru +0 -27
  47. data/benchmarks/apps/sinatra.ru +0 -26
  48. data/benchmarks/apps/syro.ru +0 -25
  49. data/benchmarks/benchmark-wrk.sh +0 -3
  50. data/benchmarks/benchmarks.rb +0 -48
  51. data/benchmarks/post.lua +0 -3
  52. data/bin/console +0 -15
  53. data/bin/setup +0 -8
  54. data/examples/README.md +0 -13
  55. data/examples/app.rb +0 -18
  56. data/examples/config.ru +0 -7
  57. data/examples/openapi.yaml +0 -29
  58. data/lib/openapi_first/operation.rb +0 -170
  59. data/lib/openapi_first/string_keyed_hash.rb +0 -20
@@ -5,7 +5,6 @@ require 'multi_json'
5
5
  require_relative 'use_router'
6
6
  require_relative 'error_response'
7
7
  require_relative 'request_body_validator'
8
- require_relative 'string_keyed_hash'
9
8
  require_relative 'request_validation_error'
10
9
  require 'openapi_parameters'
11
10
 
@@ -19,11 +18,12 @@ module OpenapiFirst
19
18
 
20
19
  # @param status [Integer] The intended HTTP status code (usually 400)
21
20
  # @param location [Symbol] One of :body, :header, :cookie, :query, :path
22
- # @param schema_validation [OpenapiFirst::JsonSchema::Result]
23
- def self.fail!(status, location, schema_validation: nil)
21
+ # @param schema_validation [OpenapiFirst::Schema::Result]
22
+ def self.fail!(status, location, message: nil, schema_validation: nil)
24
23
  throw FAIL, RequestValidationError.new(
25
24
  status:,
26
25
  location:,
26
+ message:,
27
27
  schema_validation:
28
28
  )
29
29
  end
@@ -51,6 +51,7 @@ module OpenapiFirst
51
51
 
52
52
  return @error_response_class.new(env, error).render
53
53
  end
54
+
54
55
  @app.call(env)
55
56
  end
56
57
 
@@ -59,60 +60,63 @@ module OpenapiFirst
59
60
  def validate_request(operation, env)
60
61
  catch(FAIL) do
61
62
  env[PARAMS] = {}
62
- validate_query_params!(operation, env)
63
- validate_path_params!(operation, env)
64
- validate_cookie_params!(operation, env)
65
- validate_header_params!(operation, env)
63
+ validate_parameters!(operation, env)
66
64
  validate_request_body!(operation, env)
67
65
  nil
68
66
  end
69
67
  end
70
68
 
69
+ def validate_parameters!(operation, env)
70
+ validate_query_params!(operation, env)
71
+ validate_path_params!(operation, env)
72
+ validate_cookie_params!(operation, env)
73
+ validate_header_params!(operation, env)
74
+ end
75
+
71
76
  def validate_path_params!(operation, env)
72
- path_parameters = operation.path_parameters
73
- return if path_parameters.empty?
77
+ parameters = operation.path_parameters
78
+ return unless parameters
74
79
 
75
- hashy = StringKeyedHash.new(env[Router::RAW_PATH_PARAMS])
76
- unpacked_path_params = OpenapiParameters::Path.new(path_parameters).unpack(hashy)
77
- schema_validation = operation.path_parameters_schema.validate(unpacked_path_params)
80
+ unpacked_params = parameters.unpack(env)
81
+ schema_validation = parameters.schema.validate(unpacked_params)
78
82
  RequestValidation.fail!(400, :path, schema_validation:) if schema_validation.error?
79
- env[PATH_PARAMS] = unpacked_path_params
80
- env[PARAMS].merge!(unpacked_path_params)
83
+ env[PATH_PARAMS] = unpacked_params
84
+ env[PARAMS].merge!(unpacked_params)
81
85
  end
82
86
 
83
87
  def validate_query_params!(operation, env)
84
- query_parameters = operation.query_parameters
85
- return if operation.query_parameters.empty?
88
+ parameters = operation.query_parameters
89
+ return unless parameters
86
90
 
87
- unpacked_query_params = OpenapiParameters::Query.new(query_parameters).unpack(env['QUERY_STRING'])
88
- schema_validation = operation.query_parameters_schema.validate(unpacked_query_params)
91
+ unpacked_params = parameters.unpack(env)
92
+ schema_validation = parameters.schema.validate(unpacked_params)
89
93
  RequestValidation.fail!(400, :query, schema_validation:) if schema_validation.error?
90
- env[QUERY_PARAMS] = unpacked_query_params
91
- env[PARAMS].merge!(unpacked_query_params)
94
+ env[QUERY_PARAMS] = unpacked_params
95
+ env[PARAMS].merge!(unpacked_params)
92
96
  end
93
97
 
94
98
  def validate_cookie_params!(operation, env)
95
- cookie_parameters = operation.cookie_parameters
96
- return unless cookie_parameters&.any?
99
+ parameters = operation.cookie_parameters
100
+ return unless parameters
97
101
 
98
- unpacked_params = OpenapiParameters::Cookie.new(cookie_parameters).unpack(env['HTTP_COOKIE'])
99
- schema_validation = operation.cookie_parameters_schema.validate(unpacked_params)
102
+ unpacked_params = parameters.unpack(env)
103
+ schema_validation = parameters.schema.validate(unpacked_params)
100
104
  RequestValidation.fail!(400, :cookie, schema_validation:) if schema_validation.error?
101
105
  env[COOKIE_PARAMS] = unpacked_params
102
106
  end
103
107
 
104
108
  def validate_header_params!(operation, env)
105
- header_parameters = operation.header_parameters
106
- return if header_parameters.empty?
109
+ parameters = operation.header_parameters
110
+ return unless parameters
107
111
 
108
- unpacked_header_params = OpenapiParameters::Header.new(header_parameters).unpack_env(env)
109
- schema_validation = operation.header_parameters_schema.validate(unpacked_header_params)
112
+ unpacked_params = parameters.unpack(env)
113
+ schema_validation = parameters.schema.validate(unpacked_params)
110
114
  RequestValidation.fail!(400, :header, schema_validation:) if schema_validation.error?
111
- env[HEADER_PARAMS] = unpacked_header_params
115
+ env[HEADER_PARAMS] = unpacked_params
112
116
  end
113
117
 
114
118
  def validate_request_body!(operation, env)
115
- RequestBodyValidator.new(operation, env).validate! if operation.request_body
119
+ env[REQUEST_BODY] = RequestBodyValidator.new(operation, env).validate!
116
120
  end
117
121
  end
118
122
  end
@@ -22,18 +22,39 @@ module OpenapiFirst
22
22
 
23
23
  def validate(response, operation)
24
24
  status, headers, body = response.to_a
25
- return validate_status_only(operation, status) if status == 204
25
+ response_definition = response_for(operation, status)
26
26
 
27
- content_type = headers[Rack::CONTENT_TYPE]
28
- response_schema = operation.response_body_schema(status, content_type)
29
- validate_response_body(response_schema, body) if response_schema
30
- validate_response_headers(operation, status, headers)
27
+ validate_response_headers(response_definition.headers, headers, openapi_version: operation.openapi_version)
28
+
29
+ return if no_content?(response_definition)
30
+
31
+ content_type = Rack::Response[status, headers, body].content_type
32
+ raise ResponseInvalid, "Response has no content-type for '#{operation.name}'" unless content_type
33
+
34
+ response_schema = response_definition.schema_for(content_type)
35
+ unless response_schema
36
+ message = "Response content type not found '#{content_type}' for '#{operation.name}'"
37
+ raise ResponseContentTypeNotFoundError, message
38
+ end
39
+ validate_response_body(response_schema, body)
31
40
  end
32
41
 
33
42
  private
34
43
 
44
+ def no_content?(response_definition)
45
+ response_definition.status == 204 || !response_definition.content?
46
+ end
47
+
48
+ def response_for(operation, status)
49
+ response = operation.response_for(status)
50
+ return response if response
51
+
52
+ message = "Response status code or default not found: #{status} for '#{operation.name}'"
53
+ raise OpenapiFirst::ResponseCodeNotFoundError, message
54
+ end
55
+
35
56
  def validate_status_only(operation, status)
36
- operation.response_for(status)
57
+ response_for(operation, status)
37
58
  end
38
59
 
39
60
  def validate_response_body(schema, response)
@@ -44,15 +65,14 @@ module OpenapiFirst
44
65
  raise ResponseBodyInvalidError, validation.message if validation.error?
45
66
  end
46
67
 
47
- def validate_response_headers(operation, status, response_headers)
48
- response_header_definitions = operation.response_for(status)&.dig('headers')
68
+ def validate_response_headers(response_header_definitions, response_headers, openapi_version:)
49
69
  return unless response_header_definitions
50
70
 
51
71
  unpacked_headers = unpack_response_headers(response_header_definitions, response_headers)
52
72
  response_header_definitions.each do |name, definition|
53
73
  next if name == 'Content-Type'
54
74
 
55
- validate_response_header(name, definition, unpacked_headers, openapi_version: operation.openapi_version)
75
+ validate_response_header(name, definition, unpacked_headers, openapi_version:)
56
76
  end
57
77
  end
58
78
 
@@ -65,7 +85,7 @@ module OpenapiFirst
65
85
 
66
86
  return unless definition.key?('schema')
67
87
 
68
- validation = JsonSchema.new(definition['schema'], openapi_version:)
88
+ validation = Schema.new(definition['schema'], openapi_version:)
69
89
  value = unpacked_headers[name]
70
90
  schema_validation = validation.validate(value)
71
91
  raise ResponseHeaderInvalidError, schema_validation.message if schema_validation.error?
@@ -73,7 +93,7 @@ module OpenapiFirst
73
93
 
74
94
  def unpack_response_headers(response_header_definitions, response_headers)
75
95
  headers_as_parameters = response_header_definitions.map do |name, definition|
76
- definition.merge('name' => name)
96
+ definition.merge('name' => name, 'in' => 'header')
77
97
  end
78
98
  OpenapiParameters::Header.new(headers_as_parameters).unpack(response_headers)
79
99
  end
@@ -2,14 +2,17 @@
2
2
 
3
3
  require 'rack'
4
4
  require 'multi_json'
5
- require 'hanami/router'
6
- require_relative 'body_parser_middleware'
5
+ require 'mustermann'
6
+ require_relative 'body_parser'
7
7
 
8
8
  module OpenapiFirst
9
9
  class Router
10
10
  # The unconverted path parameters before they are converted to the types defined in the API description
11
11
  RAW_PATH_PARAMS = 'openapi.raw_path_params'
12
12
 
13
+ NOT_FOUND = Rack::Response.new('Not Found', 404).finish.freeze
14
+ METHOD_NOT_ALLOWED = Rack::Response.new('Method Not Allowed', 405).finish.freeze
15
+
13
16
  def initialize(
14
17
  app,
15
18
  options
@@ -21,22 +24,28 @@ module OpenapiFirst
21
24
  spec = options.fetch(:spec)
22
25
  raise "You have to pass spec: when initializing #{self.class}" unless spec
23
26
 
24
- spec = OpenapiFirst.load(spec) unless spec.is_a?(Definition)
25
-
26
- @filepath = spec.filepath
27
- @router = build_router(spec.operations)
27
+ @definition = spec.is_a?(Definition) ? spec : OpenapiFirst.load(spec)
28
+ @filepath = @definition.filepath
28
29
  end
29
30
 
30
31
  def call(env)
31
32
  env[OPERATION] = nil
32
- response = call_router(env)
33
- if env[OPERATION].nil?
34
- raise_error(env) if @raise
33
+ request = Rack::Request.new(env)
34
+ path_item, path_params = @definition.find_path_item_and_params(request.path)
35
+ operation = path_item&.find_operation(request.request_method.downcase)
36
+
37
+ env[OPERATION] = operation
38
+ env[RAW_PATH_PARAMS] = path_params
35
39
 
40
+ if operation.nil?
41
+ raise_error(env) if @raise
36
42
  return @app.call(env) if @not_found == :continue
37
43
  end
38
44
 
39
- response
45
+ return NOT_FOUND unless path_item
46
+ return METHOD_NOT_ALLOWED unless operation
47
+
48
+ @app.call(env)
40
49
  end
41
50
 
42
51
  ORIGINAL_PATH = 'openapi_first.path_info'
@@ -55,48 +64,5 @@ module OpenapiFirst
55
64
  }' in API description #{@filepath}"
56
65
  raise NotFoundError, msg
57
66
  end
58
-
59
- def call_router(env)
60
- # Changing and restoring PATH_INFO is needed, because Hanami::Router does not respect existing script_path
61
- env[ORIGINAL_PATH] = env[Rack::PATH_INFO]
62
- env[Rack::PATH_INFO] = Rack::Request.new(env).path
63
- @router.call(env)
64
- rescue BodyParsingError => e
65
- message = e.message
66
- raise RequestInvalidError, message if @raise
67
-
68
- error = RequestValidationError.new(status: 400, location: :body, message:)
69
- @error_response_class.new(env, error).render
70
- ensure
71
- env[Rack::PATH_INFO] = env.delete(ORIGINAL_PATH) if env[ORIGINAL_PATH]
72
- end
73
-
74
- def build_router(operations)
75
- router = Hanami::Router.new.tap do |r|
76
- operations.each do |operation|
77
- normalized_path = operation.path.gsub('{', ':').gsub('}', '')
78
- r.public_send(
79
- operation.method,
80
- normalized_path,
81
- to: build_route(operation)
82
- )
83
- end
84
- end
85
- Rack::Builder.app do
86
- use(BodyParserMiddleware)
87
- run router
88
- end
89
- end
90
-
91
- def build_route(operation)
92
- lambda do |env|
93
- env[OPERATION] = operation
94
- path_info = env.delete(ORIGINAL_PATH)
95
- env[REQUEST_BODY] = env.delete(ROUTER_PARSED_BODY) if env.key?(ROUTER_PARSED_BODY)
96
- env[RAW_PATH_PARAMS] = env['router.params']
97
- env[Rack::PATH_INFO] = path_info
98
- @app.call(env)
99
- end
100
- end
101
67
  end
102
68
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenapiFirst
4
- VERSION = '1.0.0.beta5'
4
+ VERSION = '1.0.0.beta6'
5
5
  end
@@ -26,19 +26,22 @@ Gem::Specification.new do |spec|
26
26
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
27
27
  `git ls-files -z`
28
28
  .split("\x0")
29
- .reject { |f| f.match(%r{^(test|spec|features)/}) }
30
- .reject { |f| %w[Dockerfile Jenkinsfile .tool-versions].include?(f) }
29
+ .reject { |f| f.match(%r{^(test|spec|features|benchmarks|examples|bin)/}) }
30
+ .reject do |f|
31
+ %w[Dockerfile Jenkinsfile .tool-versions CODEOWNERS .rspec .rubocop.yml .tool-versions
32
+ Rakefile].include?(f)
33
+ end
31
34
  end
32
35
  spec.bindir = 'exe'
33
36
  spec.require_paths = ['lib']
34
37
 
35
38
  spec.required_ruby_version = '>= 3.1.1'
36
39
 
37
- spec.add_runtime_dependency 'hanami-router', '~> 2.0.0'
38
40
  spec.add_runtime_dependency 'json_refs', '~> 0.1', '>= 0.1.7'
39
41
  spec.add_runtime_dependency 'json_schemer', '~> 2.0.0'
40
42
  spec.add_runtime_dependency 'multi_json', '~> 1.15'
41
- spec.add_runtime_dependency 'openapi_parameters', '>= 0.3.1', '< 2.0'
43
+ spec.add_runtime_dependency 'mustermann-contrib', '~> 3.0.0'
44
+ spec.add_runtime_dependency 'openapi_parameters', '>= 0.3.2', '< 2.0'
42
45
  spec.add_runtime_dependency 'rack', '>= 2.2', '< 4.0'
43
46
  spec.metadata = {
44
47
  'rubygems_mfa_required' => 'true'
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openapi_first
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta5
4
+ version: 1.0.0.beta6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Haller
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-12 00:00:00.000000000 Z
11
+ date: 2023-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: hanami-router
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: 2.0.0
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: 2.0.0
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: json_refs
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -72,13 +58,27 @@ dependencies:
72
58
  - - "~>"
73
59
  - !ruby/object:Gem::Version
74
60
  version: '1.15'
61
+ - !ruby/object:Gem::Dependency
62
+ name: mustermann-contrib
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: 3.0.0
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: 3.0.0
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: openapi_parameters
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - ">="
80
80
  - !ruby/object:Gem::Version
81
- version: 0.3.1
81
+ version: 0.3.2
82
82
  - - "<"
83
83
  - !ruby/object:Gem::Version
84
84
  version: '2.0'
@@ -88,7 +88,7 @@ dependencies:
88
88
  requirements:
89
89
  - - ">="
90
90
  - !ruby/object:Gem::Version
91
- version: 0.3.1
91
+ version: 0.3.2
92
92
  - - "<"
93
93
  - !ruby/object:Gem::Version
94
94
  version: '2.0'
@@ -122,51 +122,32 @@ files:
122
122
  - ".github/CODEOWNERS"
123
123
  - ".github/workflows/ruby.yml"
124
124
  - ".gitignore"
125
- - ".rspec"
126
- - ".rubocop.yml"
127
125
  - CHANGELOG.md
128
126
  - Gemfile
129
127
  - Gemfile.lock
128
+ - Gemfile.rack2
130
129
  - LICENSE.txt
131
130
  - README.md
132
- - Rakefile
133
- - benchmarks/Gemfile
134
- - benchmarks/Gemfile.lock
135
- - benchmarks/README.md
136
- - benchmarks/apps/committee_with_hanami_api.ru
137
- - benchmarks/apps/committee_with_response_validation.ru
138
- - benchmarks/apps/committee_with_sinatra.ru
139
- - benchmarks/apps/grape.ru
140
- - benchmarks/apps/hanami_api.ru
141
- - benchmarks/apps/hanami_router.ru
142
- - benchmarks/apps/openapi.yaml
143
- - benchmarks/apps/openapi_first_with_hanami_api.ru
144
- - benchmarks/apps/openapi_first_with_plain_rack.ru
145
- - benchmarks/apps/openapi_first_with_response_validation.ru
146
- - benchmarks/apps/openapi_first_with_sinatra.ru
147
- - benchmarks/apps/roda.ru
148
- - benchmarks/apps/sinatra.ru
149
- - benchmarks/apps/syro.ru
150
- - benchmarks/benchmark-wrk.sh
151
- - benchmarks/benchmarks.rb
152
- - benchmarks/post.lua
153
- - bin/console
154
- - bin/setup
155
- - examples/README.md
156
- - examples/app.rb
157
- - examples/config.ru
158
- - examples/openapi.yaml
159
131
  - lib/openapi_first.rb
160
- - lib/openapi_first/body_parser_middleware.rb
132
+ - lib/openapi_first/body_parser.rb
161
133
  - lib/openapi_first/config.rb
162
134
  - lib/openapi_first/definition.rb
135
+ - lib/openapi_first/definition/cookie_parameters.rb
136
+ - lib/openapi_first/definition/has_content.rb
137
+ - lib/openapi_first/definition/header_parameters.rb
138
+ - lib/openapi_first/definition/operation.rb
139
+ - lib/openapi_first/definition/parameters.rb
140
+ - lib/openapi_first/definition/path_item.rb
141
+ - lib/openapi_first/definition/path_parameters.rb
142
+ - lib/openapi_first/definition/query_parameters.rb
143
+ - lib/openapi_first/definition/request_body.rb
144
+ - lib/openapi_first/definition/response.rb
145
+ - lib/openapi_first/definition/schema.rb
146
+ - lib/openapi_first/definition/schema/result.rb
163
147
  - lib/openapi_first/error_response.rb
164
148
  - lib/openapi_first/error_responses/default.rb
165
149
  - lib/openapi_first/error_responses/json_api.rb
166
150
  - lib/openapi_first/errors.rb
167
- - lib/openapi_first/json_schema.rb
168
- - lib/openapi_first/json_schema/result.rb
169
- - lib/openapi_first/operation.rb
170
151
  - lib/openapi_first/plugins.rb
171
152
  - lib/openapi_first/request_body_validator.rb
172
153
  - lib/openapi_first/request_validation.rb
@@ -174,7 +155,6 @@ files:
174
155
  - lib/openapi_first/response_validation.rb
175
156
  - lib/openapi_first/response_validator.rb
176
157
  - lib/openapi_first/router.rb
177
- - lib/openapi_first/string_keyed_hash.rb
178
158
  - lib/openapi_first/use_router.rb
179
159
  - lib/openapi_first/version.rb
180
160
  - openapi_first.gemspec
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,14 +0,0 @@
1
- AllCops:
2
- TargetRubyVersion: 3.1.1
3
- NewCops: enable
4
- SuggestExtensions: false
5
- Style/Documentation:
6
- Enabled: false
7
- Style/ExponentialNotation:
8
- Enabled: true
9
- Metrics/BlockLength:
10
- Exclude:
11
- - "spec/**/*.rb"
12
- - "*.gemspec"
13
- Metrics/MethodLength:
14
- Max: 20
data/Rakefile DELETED
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
- require 'rubocop/rake_task'
6
-
7
- RuboCop::RakeTask.new
8
-
9
- task :version do
10
- puts Gem::Specification.load('openapi_first.gemspec').version
11
- end
12
-
13
- RSpec::Core::RakeTask.new(:spec)
14
-
15
- task default: %i[spec rubocop]
data/benchmarks/Gemfile DELETED
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'benchmark-ips'
6
- gem 'benchmark-memory'
7
- gem 'committee'
8
- gem 'grape'
9
- gem 'hanami-api'
10
- gem 'hanami-router'
11
- gem 'multi_json'
12
- gem 'openapi_first', path: '../'
13
- gem 'puma'
14
- gem 'roda'
15
- gem 'sinatra'
16
- gem 'syro'
@@ -1,142 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- openapi_first (1.0.0.beta5)
5
- hanami-router (~> 2.0.0)
6
- json_refs (~> 0.1, >= 0.1.7)
7
- json_schemer (~> 2.0.0)
8
- multi_json (~> 1.15)
9
- openapi_parameters (>= 0.3.1, < 2.0)
10
- rack (>= 2.2, < 4.0)
11
-
12
- GEM
13
- remote: https://rubygems.org/
14
- specs:
15
- activesupport (7.1.2)
16
- base64
17
- bigdecimal
18
- concurrent-ruby (~> 1.0, >= 1.0.2)
19
- connection_pool (>= 2.2.5)
20
- drb
21
- i18n (>= 1.6, < 2)
22
- minitest (>= 5.1)
23
- mutex_m
24
- tzinfo (~> 2.0)
25
- base64 (0.2.0)
26
- benchmark-ips (2.12.0)
27
- benchmark-memory (0.2.0)
28
- memory_profiler (~> 1)
29
- bigdecimal (3.1.4)
30
- builder (3.2.4)
31
- committee (5.0.0)
32
- json_schema (~> 0.14, >= 0.14.3)
33
- openapi_parser (~> 1.0)
34
- rack (>= 1.5)
35
- concurrent-ruby (1.2.2)
36
- connection_pool (2.4.1)
37
- drb (2.2.0)
38
- ruby2_keywords
39
- dry-core (1.0.1)
40
- concurrent-ruby (~> 1.0)
41
- zeitwerk (~> 2.6)
42
- dry-inflector (1.0.0)
43
- dry-logic (1.5.0)
44
- concurrent-ruby (~> 1.0)
45
- dry-core (~> 1.0, < 2)
46
- zeitwerk (~> 2.6)
47
- dry-types (1.7.1)
48
- concurrent-ruby (~> 1.0)
49
- dry-core (~> 1.0)
50
- dry-inflector (~> 1.0)
51
- dry-logic (~> 1.4)
52
- zeitwerk (~> 2.6)
53
- grape (2.0.0)
54
- activesupport (>= 5)
55
- builder
56
- dry-types (>= 1.1)
57
- mustermann-grape (~> 1.0.0)
58
- rack (>= 1.3.0)
59
- rack-accept
60
- hana (1.3.7)
61
- hanami-api (0.3.0)
62
- hanami-router (~> 2.0)
63
- hanami-router (2.0.2)
64
- mustermann (~> 3.0)
65
- mustermann-contrib (~> 3.0)
66
- rack (~> 2.0)
67
- hansi (0.2.1)
68
- i18n (1.14.1)
69
- concurrent-ruby (~> 1.0)
70
- json_refs (0.1.8)
71
- hana
72
- json_schema (0.21.0)
73
- json_schemer (2.0.0)
74
- hana (~> 1.3)
75
- regexp_parser (~> 2.0)
76
- simpleidn (~> 0.2)
77
- memory_profiler (1.0.1)
78
- minitest (5.20.0)
79
- multi_json (1.15.0)
80
- mustermann (3.0.0)
81
- ruby2_keywords (~> 0.0.1)
82
- mustermann-contrib (3.0.0)
83
- hansi (~> 0.2.0)
84
- mustermann (= 3.0.0)
85
- mustermann-grape (1.0.2)
86
- mustermann (>= 1.0.0)
87
- mutex_m (0.2.0)
88
- nio4r (2.5.9)
89
- openapi_parameters (0.3.1)
90
- rack (>= 2.2)
91
- zeitwerk (~> 2.6)
92
- openapi_parser (1.0.0)
93
- puma (6.4.0)
94
- nio4r (~> 2.0)
95
- rack (2.2.8)
96
- rack-accept (0.4.5)
97
- rack (>= 0.4)
98
- rack-protection (3.1.0)
99
- rack (~> 2.2, >= 2.2.4)
100
- regexp_parser (2.8.2)
101
- roda (3.73.0)
102
- rack
103
- ruby2_keywords (0.0.5)
104
- seg (1.2.0)
105
- simpleidn (0.2.1)
106
- unf (~> 0.1.4)
107
- sinatra (3.1.0)
108
- mustermann (~> 3.0)
109
- rack (~> 2.2, >= 2.2.4)
110
- rack-protection (= 3.1.0)
111
- tilt (~> 2.0)
112
- syro (3.2.1)
113
- rack (>= 1.6.0)
114
- seg
115
- tilt (2.3.0)
116
- tzinfo (2.0.6)
117
- concurrent-ruby (~> 1.0)
118
- unf (0.1.4)
119
- unf_ext
120
- unf_ext (0.0.9)
121
- zeitwerk (2.6.12)
122
-
123
- PLATFORMS
124
- arm64-darwin-21
125
- x86_64-linux
126
-
127
- DEPENDENCIES
128
- benchmark-ips
129
- benchmark-memory
130
- committee
131
- grape
132
- hanami-api
133
- hanami-router
134
- multi_json
135
- openapi_first!
136
- puma
137
- roda
138
- sinatra
139
- syro
140
-
141
- BUNDLED WITH
142
- 2.3.10