Skip to content

Commit ec3e6f2

Browse files
committed
Fix for last commit!
1 parent b6503aa commit ec3e6f2

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/open_api/config.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module Config
2323
end
2424

2525
cattr_accessor :active_record_base do
26-
ApplicationRecord
26+
'ApplicationRecord'
2727
end
2828

2929
# Everything about OAS3 is on https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md

lib/open_api/dsl/components.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ class Components < Hash
88

99
def schema component_key, type = nil, one_of: nil, all_of: nil, any_of: nil, not: nil, **schema_hash
1010
(schema_hash = type) and (type = type.delete(:type)) if type.is_a?(Hash) && type.key?(:type)
11-
type = schema_hash[:type] if type.nil?
12-
type = load_schema component_key if component_key.try(:superclass) == Config.active_record_base && type.nil?
11+
type ||= schema_hash[:type]
12+
type ||= load_schema component_key if component_key.try(:superclass) == Config.active_record_base.to_s.constantize
1313

1414
combined_schema = one_of || all_of || any_of || (_not = binding.local_variable_get(:not))
1515
combined_schema = CombinedSchema.new(one_of: one_of, all_of: all_of, any_of: any_of, _not: _not) if combined_schema

lib/open_api/generator.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def generate_doc(doc_name)
2727
security: settings[:global_security], tags: [ ], paths: { },
2828
components: {
2929
securitySchemes: { }, schemas: { }, parameters: { }, requestBodies: { }
30-
}.merge(settings[:components])
30+
}.merge(settings[:components] || { })
3131
)
3232

3333
settings[:root_controller].descendants.each do |ctrl|

0 commit comments

Comments
 (0)