openapi-ruby 2.5.1 → 2.6.0

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: e5b5aa8b42fe199142eb84aa503b7ed590e2cb0399790a3a749f1df5a98c543b
4
- data.tar.gz: 9a32a812806610a71af36ea018ca7774dbc8cfd8f0ea3d44a73b91303e3dbec2
3
+ metadata.gz: 624a9de17a27fc482cf818dde3e816f4a4117f75abe79360acc21ebf6adc3c94
4
+ data.tar.gz: f886aa70bf6d15d26a88ed99abda4a7440eb6d3f8304a6759896e28e6dfeb137
5
5
  SHA512:
6
- metadata.gz: 78d10fcbf342b18f50988bf9984767cc911fc8e3466a6f07cc5b6f404277b5fa7cb93bbc41767e1eb185fd46c04503e0fb714c02ebbfa5bc78ae1f1a5393bff3
7
- data.tar.gz: 6c520011e5868a4c1dca5d6b2bd51ef066cc40c9006cd8411962b250364d4aabcc7ae201982324088611eb4e35055800c90500949ca5dbe4e58df0fcde300333
6
+ metadata.gz: 54139198ea02942afe69bce8b677bd582ea60e303aece0cbca150b04583a2bc5688f8a56e3dafbf6d2ee4cba87d10396fff54996956d8ad77ab4db109a849fd6
7
+ data.tar.gz: 31489283c2805df247155d08ce89575015342429a3d507c5b44549a09baa853646ede82288ca5ecc443d660bcfa93a34036e58fdc872757688471a2e07d804fe
@@ -161,7 +161,8 @@ module OpenapiRuby
161
161
  schema_config.dig("components", "securitySchemes") || {}
162
162
 
163
163
  if security_schemes.empty?
164
- loader = Components::Loader.new(scope: schema_name.to_s.tr("/", "_").to_sym)
164
+ scope = schema_config[:component_scope] || schema_config["component_scope"]
165
+ loader = Components::Loader.new(scope: scope&.to_sym)
165
166
  security_schemes = loader.security_schemes
166
167
  end
167
168
 
@@ -232,9 +232,10 @@ module OpenapiRuby
232
232
  security_schemes = schema_config.dig(:components, :securitySchemes) ||
233
233
  schema_config.dig("components", "securitySchemes") || {}
234
234
 
235
- # Also check registered components
235
+ # Also check registered components using the schema's configured scope
236
236
  if security_schemes.empty?
237
- loader = Components::Loader.new(scope: schema_name.to_s.tr("/", "_").to_sym)
237
+ scope = schema_config[:component_scope] || schema_config["component_scope"]
238
+ loader = Components::Loader.new(scope: scope&.to_sym)
238
239
  security_schemes = loader.security_schemes
239
240
  end
240
241
 
@@ -3,7 +3,7 @@
3
3
  module OpenapiRuby
4
4
  module Core
5
5
  class Document
6
- MIN_OPENAPI_VERSION = "3.1.0"
6
+ MIN_OPENAPI_VERSION = "3.0.0"
7
7
  DEFAULT_OPENAPI_VERSION = "3.1.0"
8
8
 
9
9
  attr_reader :data
@@ -79,10 +79,11 @@ module OpenapiRuby
79
79
  ctx.instance_eval(&block) if block
80
80
 
81
81
  key = status_code.to_s
82
- # Don't overwrite a visible response with a hidden one hidden responses
83
- # are test-only variants that should not remove the endpoint from the schema.
82
+ # Keep the first visible response for each status code. Subsequent responses
83
+ # with the same code are test variants and should not overwrite the schema.
84
+ # A visible response always wins over a hidden one.
84
85
  existing = @responses[key]
85
- @responses[key] = ctx unless hidden && existing && !existing.hidden
86
+ @responses[key] = ctx if existing.nil? || (existing.hidden && !hidden)
86
87
 
87
88
  ctx
88
89
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenapiRuby
4
- VERSION = "2.5.1"
4
+ VERSION = "2.6.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openapi-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Morten Hartvig