Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: security schemes keys to symbols #74

Merged
merged 1 commit into from
Sep 2, 2024
Merged

fix: security schemes keys to symbols #74

merged 1 commit into from
Sep 2, 2024

Conversation

ikadix
Copy link
Contributor

@ikadix ikadix commented Sep 1, 2024

Looks up the x-scope-security value by either a string or a symbol.
Would appreciate if there's a better way to do this look up or enforce the key type in the hash.

Edit

Rewritten to transform security scheme keys to symbols

scope_prefix = @spec[:components][:securitySchemes][key][:"x-scope-prefix"]
auth_scheme = @spec[:components][:securitySchemes][key]
Copy link
Contributor

@paulsturgess paulsturgess Sep 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could call symbolize_keys! or probably deep_symbolize_keys to forcibly convert the keys to symbols. In this loop is likely not the best place to do that. Perhaps when additions is constructed in the Specification initialize method. That way it would be standard for any code that accesses it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! on lookup it seems like that's a rails specific function so I've settled on using transform_keys 🙇

@ikadix ikadix force-pushed the fix_x_scope_prefix branch from 13f2e98 to b75811c Compare September 2, 2024 11:53
@ikadix ikadix changed the title fix: x-scope-security lookup by string and/or symbol fix: security schemes keys to symbols Sep 2, 2024
@ikadix ikadix requested a review from paulsturgess September 2, 2024 11:56
@ikadix ikadix merged commit 3506742 into main Sep 2, 2024
7 checks passed
@ikadix ikadix deleted the fix_x_scope_prefix branch September 2, 2024 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants