-
Notifications
You must be signed in to change notification settings - Fork 450
fix: Suppress deprecation warning when strict setting is not set #785
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
Conversation
@@ -12,8 +12,7 @@ module Specs | |||
swagger_root: :openapi_root, | |||
swagger_docs: :openapi_specs, | |||
swagger_dry_run: :rswag_dry_run, | |||
swagger_format: :openapi_format, | |||
swagger_strict_schema_validation: :openapi_strict_schema_validation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm removing this because it implies that swagger_strict_schema_validation
is being renamed to openapi_strict_schema_validation
if metadata.key?(:swagger_strict_schema_validation) | ||
Rswag::Specs.deprecator.warn('Rswag::Specs: WARNING: This option will be removed in v3.0 please use openapi_all_properties_required and openapi_no_additional_properties set to true') | ||
is_strict = !!metadata[:swagger_strict_schema_validation] | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unconditional else statement here is the source of the bug where we would always receive the deprecation warning regardless of whether the deprecated settings were used or not.
bd9a237
to
ecca183
Compare
@romanblanco If you are seeking maintainers for this repo, I'm interested in getting involved. |
@hasghari Yes, this repo could use a couple of more eyes. I'll contact maintainers who have privileges to get you in. Thank you, for volunteering! |
/cc @domaindrivendev @sergioisidoro @oblakeerickson @jtannas @BookOfGreg |
Problem
Even when the settings
swagger_strict_schema_validation
andopenapi_strict_schema_validation
are not used, deprecation warnings are issued.Solution
Only print deprecation warning when the deprecated settings are used.
The changes I made are compatible with:
Related Issues
Links to any related issues.
Checklist