openapi_first 2.0.0 → 2.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d712aa1e9c42b4d42bc048fa0cc5c793af9d8e5c4f3afd34deda3afe2136eb70
4
- data.tar.gz: 8a220208d4eb6755a066db142f20271101c97e7c7c26e000d0519770300c0f39
3
+ metadata.gz: 87fceda33e397fa75a8268144e5cbacfb802333a5ef1c315676d14458312b01b
4
+ data.tar.gz: a734ee73e2dce89fea8d2fc93c713b0505923b2b2098b560a2b44ef3e5753c84
5
5
  SHA512:
6
- metadata.gz: d5424ea246ae643962375a22adddac25ec2de49222aed0a3e6cabc4d8efbbd49faf65e569c219a758b62261a085afd06ee9b6c75f453f0c30397610e9460a793
7
- data.tar.gz: 9599b92d69766a231c7a24f708cabfcaff5f3724117b3f1948d1b9e76c1408f72bafceebaf17752a30e58d752375b807de57ab53dad38abf84720f192c5a3180
6
+ metadata.gz: 63d51c543d3d689ced06170e1e53f6d0a20056af2643e1f1fccfbf966b14352c55ad9c0dfd92478ceb7e5aaac0b6f7c7563e17d9e69ab2f924f6a9d4846c45ff
7
+ data.tar.gz: 8649d5737439a2414802e17ed562a0efdf294f29e7515b0e248e5736cd59235eba876baf52aad8e5d602ff90ba5afc8902ed1609d902dfe03c65d4136afc1042
data/CHANGELOG.md CHANGED
@@ -2,7 +2,13 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
- ## 2.0
5
+ ## 2.0.2
6
+
7
+ - Fix setting custom error response (thanks @gobijan)
8
+
9
+ ## 2.0.1 (Janked)
10
+
11
+ ## 2.0.0
6
12
 
7
13
  ### New Features
8
14
  - Test Assertions! 📋 You can now use `assert_api_conform` for contract testing in your rack-test / Rails integration tests. See Readme for details.
@@ -34,7 +34,7 @@ module OpenapiFirst
34
34
 
35
35
  def request_validation_error_response=(mod)
36
36
  @request_validation_error_response = if mod.is_a?(Symbol)
37
- OpenapiFirst.find_plugin(:default)::ErrorResponse
37
+ OpenapiFirst.find_error_response(mod)
38
38
  else
39
39
  mod
40
40
  end
@@ -5,15 +5,23 @@ require_relative 'test/methods'
5
5
  module OpenapiFirst
6
6
  # Test integration
7
7
  module Test
8
+ class NotRegisteredError < StandardError; end
9
+
10
+ DEFINITIONS = {}.freeze
11
+ def self.definitions = DEFINITIONS
12
+
8
13
  def self.register(path, as: :default)
9
- @registry ||= {}
10
- @registry[as] = OpenapiFirst.load(path)
14
+ definitions[as] = OpenapiFirst.load(path)
11
15
  end
12
16
 
13
17
  def self.[](api)
14
- @registry[api] || raise(ArgumentError,
15
- "API description #{api} not found to be used via assert_api_conform. " \
16
- 'Use OpenapiFirst::Test.register to load an API description first.')
18
+ definitions.fetch(api) do
19
+ option = api == :default ? '' : ", as: #{api.inspect}"
20
+ raise(NotRegisteredError,
21
+ "API description '#{api.inspect}' not found." \
22
+ "Please call OpenapiFirst::Test.register('myopenapi.yaml'#{option}) " \
23
+ 'once before calling assert_api_conform.')
24
+ end
17
25
  end
18
26
  end
19
27
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenapiFirst
4
- VERSION = '2.0.0'
4
+ VERSION = '2.0.2'
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: 2.0.0
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Haller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-24 00:00:00.000000000 Z
11
+ date: 2024-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hana