Skip to content

Commit

Permalink
fix: ensure we have symbolized keys
Browse files Browse the repository at this point in the history
  • Loading branch information
ikadix committed Sep 3, 2024
1 parent b87594b commit 3d961f9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/apia/open_api/specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,15 @@ def add_additional_security_schemes(security_schemes)
security_schemes.each do |key, value|
@spec[:components][:securitySchemes] ||= {}

# Ensure we have symbolized keys
value = JSON.parse(value.to_json, symbolize_names: true)

if value[:type] == "oauth2" && value[:flows].key?(:authorizationCode)
puts "Adding scopes to OAuth2 security scheme"
value[:flows][:authorizationCode][:scopes] = build_scope_map
end

@spec[:components][:securitySchemes][key] = value.transform_keys(&:to_sym)
@spec[:components][:securitySchemes][key] = value
@spec[:security] << { key => [] }
end
end
Expand Down

0 comments on commit 3d961f9

Please sign in to comment.