openapi_first 0.12.4 → 0.12.5

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: c55b490840191990eac078738a26002b09f794b0f555ae1144faa679fadd7697
4
- data.tar.gz: 855132c7c8893b9c02670926c820273aa4b7a407a6e7d02dd99ad2f600dd714f
3
+ metadata.gz: e8692df035f2c27738cc74a8265ad45f6235397c0ce35059fdeef29ef54402ba
4
+ data.tar.gz: 156a0c22674e9eed4b2a7ffdfff1cde726b721bf63e8cede6c0d006442c72890
5
5
  SHA512:
6
- metadata.gz: a1acd2cfa2197bcf9dd760cbf63e146d6ffcc5b9a4fef1b291a0d781c095a06976d02b40fae2b6393307b6f958f34b489514e7dcb22bb89df186c2c31c76f1fe
7
- data.tar.gz: 8832ddbbc1101985806d0752f74ab2ca14cc7322def44cc0d3537dec3d04592dfce8b2c8d646d21b100e427176dc7a176c3472fca28fc85ed4ae881757a471d1
6
+ metadata.gz: 7f4bedb9b730bb1c27a29d04fe7b915f2e61b0ac6305d6faccb52fd7baa962356704ce0ec85c192f36b9bb5ba9323d29cefa014d287c564fc48dcdaa8bd953a1
7
+ data.tar.gz: 9341ba6927183ad541b0b5d3dbc4096112a74204ce14abd1b2c72bfa339c757853f93041f80df85aa51d83377380d9ba034ce260885a5ddbbc64cb769e177d16
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.12.5
4
+ - Add `not_found: :continue` option to Router to make it do nothing if request is unknown
5
+
3
6
  ## 0.12.4
4
7
  - content-type is found while ignoring additional content-type parameters (`application/json` is found when request/response content-type is `application/json; charset=UTF8`)
5
8
  - Support wildcard mime-types when finding the content-type
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openapi_first (0.12.4)
4
+ openapi_first (0.12.5)
5
5
  deep_merge (>= 1.2.1)
6
6
  hanami-router (~> 2.0.alpha3)
7
7
  hanami-utils (~> 2.0.alpha1)
@@ -24,7 +24,7 @@ GEM
24
24
  ast (2.4.1)
25
25
  builder (3.2.4)
26
26
  coderay (1.1.3)
27
- concurrent-ruby (1.1.6)
27
+ concurrent-ruby (1.1.7)
28
28
  deep_merge (1.2.1)
29
29
  diff-lcs (1.4.4)
30
30
  ecma-re-validator (0.2.1)
@@ -39,9 +39,9 @@ GEM
39
39
  transproc (~> 1.0)
40
40
  hansi (0.2.0)
41
41
  hash-deep-merge (0.1.1)
42
- i18n (1.8.4)
42
+ i18n (1.8.5)
43
43
  concurrent-ruby (~> 1.0)
44
- json_schemer (0.2.12)
44
+ json_schemer (0.2.13)
45
45
  ecma-re-validator (~> 0.2)
46
46
  hana (~> 1.3)
47
47
  regexp_parser (~> 1.5)
data/README.md CHANGED
@@ -37,6 +37,7 @@ Options and their defaults:
37
37
  |:---|---|---|---|
38
38
  |`spec:`| | The spec loaded via `OpenapiFirst.load` ||
39
39
  | `raise_error:` |`false`, `true` | If set to true the middleware raises `OpenapiFirst::NotFoundError` when a path or method was not found in the API description. This is useful during testing to spot an incomplete API description. | `false` (don't raise an exception)
40
+ | `not_found:` | `:continue`, `:halt`| If set to `:continue` the middleware will not return 404 (405, 415), but just pass handling the request to the next middleware or application in the Rack stack. If combined with `raise_error: true` `raise_error` gets preference and an exception is raised. | `:halt` (return 4xx response)
40
41
 
41
42
  ## OpenapiFirst::RequestValidation
42
43
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- openapi_first (0.12.4)
4
+ openapi_first (0.12.5)
5
5
  deep_merge (>= 1.2.1)
6
6
  hanami-router (~> 2.0.alpha3)
7
7
  hanami-utils (~> 2.0.alpha1)
@@ -75,7 +75,7 @@ GEM
75
75
  i18n (1.8.4)
76
76
  concurrent-ruby (~> 1.0)
77
77
  json_schema (0.20.9)
78
- json_schemer (0.2.12)
78
+ json_schemer (0.2.13)
79
79
  ecma-re-validator (~> 0.2)
80
80
  hana (~> 1.3)
81
81
  regexp_parser (~> 1.5)
@@ -10,11 +10,13 @@ module OpenapiFirst
10
10
  app,
11
11
  spec:,
12
12
  raise_error: false,
13
+ not_found: :halt,
13
14
  parent_app: nil
14
15
  )
15
16
  @app = app
16
17
  @parent_app = parent_app
17
18
  @raise = raise_error
19
+ @not_found = not_found
18
20
  @filepath = spec.filepath
19
21
  @router = build_router(spec.operations)
20
22
  end
@@ -23,9 +25,11 @@ module OpenapiFirst
23
25
  env[OPERATION] = nil
24
26
  response = call_router(env)
25
27
  if env[OPERATION].nil?
26
- return @parent_app.call(env) if @parent_app # This should only happen if used via OpenapiFirst.middlware
28
+ return @parent_app.call(env) if @parent_app # This should only happen if used via OpenapiFirst.middleware
27
29
 
28
30
  raise_error(env) if @raise
31
+
32
+ return @app.call(env) if @not_found == :continue
29
33
  end
30
34
  response
31
35
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenapiFirst
4
- VERSION = '0.12.4'
4
+ VERSION = '0.12.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openapi_first
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.4
4
+ version: 0.12.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Haller
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-22 00:00:00.000000000 Z
11
+ date: 2020-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deep_merge