openapi_first 2.9.2 → 2.9.3

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: 77ee23a7f40889116a6ae239e51711460c21c9f134f7e85bef5c2869d91d7d26
4
- data.tar.gz: 5b541d1727e879c8e1ace187679bd6bc708054e2675d127dfca718fc963fb10b
3
+ metadata.gz: ef8ea95833884daf36e8a33742ce4a6eddfb9343b67de0b5e787ebc377c0691d
4
+ data.tar.gz: b63916918c1d1116d99c2e071c3e8e752b1cce66cd431dceb5076a3e70688c10
5
5
  SHA512:
6
- metadata.gz: 68e0311f5a70192b54a4d3c3654e1910b39bdfc420db4c5abcce38ba4dc2d2f4e78a278ac35be8a9796c59ba42428c3b67912adb08c1aeb469ba5d08f8223800
7
- data.tar.gz: e43db82ccea7aeca33f58fa705f16844080f672dc0b157f72f10aa1e5fdf7ca4a71d6146c93622b46b226811b6e9cd09c61fa72fec6fb16831edfc606668089b
6
+ metadata.gz: 3cbf77e0a4a51b213a90458c1181bd29474f378195210cf76466c24ef832195b32e4cbd8aec7ba97ece0bd7d9a97b6022e02b5288600d8879b82401c398d1ddc
7
+ data.tar.gz: 8789c3dadcff66b6cbb831dfae948da5adcbcd2788ff40765f39d4a1a0ba238cef1d7df609b4dd57e8ba71653103e21f9fb6a7e1f0a212e45c02d4f8c5e41e39
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.9.3
6
+
7
+ - Fix OpenapiFirst.load when MultiJson is configured to return symbol keys
8
+
5
9
  ## 2.9.2
6
10
 
7
11
  - OpenapiFirst::Test reports all non-covered requests now
data/README.md CHANGED
@@ -56,11 +56,7 @@ Here is how to set it up:
56
56
  end
57
57
  ```
58
58
  2. Observe your application. You can do this in one of two ways:
59
- - Inject a Module to wrap (prepend) the `call` method of your Rack app Class.
60
- ```ruby
61
- OpenapiFirst::Test.observe(MyApplication)
62
- ```
63
- - Or add an `app` method to your tests, which wraps your application with silent request / response validation. (✷1)
59
+ - Add an `app` method to your tests, which wraps your application with silent request / response validation. (✷1)
64
60
  ```ruby
65
61
  RSpec.configure do |config|
66
62
  config.include OpenapiFirst::Test::Methods[MyApp], type: :request
@@ -73,6 +69,13 @@ Here is how to set it up:
73
69
  OpenapiFirst::Test.app(MyApp)
74
70
  end
75
71
  ```
72
+ - Or inject a Module to wrap (prepend) the `call` method of your Rack app Class.
73
+
74
+ NOTE: This is still work in progress. It works with basic Sinatra apps, but does not work with Hanami or Rails out of the box, yet. PRs welcome 🤗
75
+
76
+ ```ruby
77
+ OpenapiFirst::Test.observe(MyApplication)
78
+ ```
76
79
  3. Run your tests. The Coverage feature will tell you about missing or invalid requests/responses.
77
80
 
78
81
  (✷1): It does not matter what method of openapi_first you use to validate requests/responses. Instead of using `OpenapiFirstTest.app` to wrap your application, you could also use the [middlewares](#rack-middlewares) or [test assertion method](#test-assertions), but you would have to do that for all requests/responses defined in your API description to make coverage work.
@@ -13,7 +13,7 @@ module OpenapiFirst
13
13
 
14
14
  body = File.read(file_path)
15
15
  extname = File.extname(file_path)
16
- return JSON.parse(body) if extname == '.json'
16
+ return ::JSON.parse(body) if extname == '.json'
17
17
  return YAML.unsafe_load(body) if ['.yaml', '.yml'].include?(extname)
18
18
 
19
19
  body
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenapiFirst
4
- VERSION = '2.9.2'
4
+ VERSION = '2.9.3'
5
5
  end
data/lib/openapi_first.rb CHANGED
@@ -66,7 +66,7 @@ module OpenapiFirst
66
66
  # @return [Definition]
67
67
  # TODO: This needs to work with unresolved contents as well
68
68
  def self.parse(contents, only: nil, filepath: nil, &)
69
- contents = JSON.parse(JSON.generate(contents)) # Deeply stringify keys, because of YAML. See https://github.com/ahx/openapi_first/issues/367
69
+ contents = ::JSON.parse(::JSON.generate(contents)) # Deeply stringify keys, because of YAML. See https://github.com/ahx/openapi_first/issues/367
70
70
  contents['paths'].filter!(&->(key, _) { only.call(key) }) if only
71
71
  Definition.new(contents, filepath, &)
72
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openapi_first
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.2
4
+ version: 2.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Haller