8000 fix: Suppress deprecation warning when strict setting is not set by hasghari · Pull Request #785 · rswag/rswag · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 2 commits into from
Oct 4, 2024

Conversation

hasghari
Copy link
Contributor
@hasghari hasghari commented Sep 29, 2024

Problem

Even when the settings swagger_strict_schema_validation and openapi_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:

  • OAS2
  • OAS3
  • OAS3.1

Related Issues

Links to any related issues.

Checklist

  • Added tests
  • Changelog updated

@@ -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
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

@hasghari hasghari force-pushed the fix-deprecation-warnings branch from bd9a237 to ecca183 Compare September 30, 2024 01:42
@hasghari
Copy link
Contributor Author

@romanblanco If you are seeking maintainers for this repo, I'm interested in getting involved.

@romanblanco
Copy link
Member
romanblanco commented Sep 30, 2024

@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!

@romanblanco
Copy link
Member

@romanblanco If you are seeking maintainers for this repo, I'm interested in getting involved.

/cc @domaindrivendev @sergioisidoro @oblakeerickson @jtannas @BookOfGreg

@romanblanco romanblanco merged commit f52f979 into rswag:master Oct 4, 2024
24 checks passed
@hasghari hasghari deleted the fix-deprecation-warnings branch October 4, 2024 08:29
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
0