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

Handle missing security schemes component #211

Merged
merged 3 commits into from
Feb 28, 2021

Conversation

jrouly
Copy link
Contributor

@jrouly jrouly commented Jan 26, 2021

I was running into a NullPointerException that I did not expect when diffing two specifications.

Turned out my specification was missing components.securitySchemes because it was using a custom extension, but the error was not really expected or informative.

This pull request:

  • patches the code to throw an explicit IllegalArgumentException if components.securitySchemes is missing,
  • adds a test resource security_diff_4.yaml which is copied from security_diff_3.yaml but removes components.securitySchemes,
  • adds an assertion that diffing this file will throw IllegalArgumentException (instead of NullPointerException) -- this test fails without the patch.

Note: this PR continues to assume that missing components.securitySchemes is problematic (i.e., I will need to update my specification file that started this).

cc @joschi

Copy link
Contributor

@joschi joschi left a comment

Choose a reason for hiding this comment

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

@jrouly LGTM. Thanks!

@joschi joschi added this to the Release 2.0.0 milestone Feb 28, 2021
@joschi joschi changed the title Handle missing security schemes component. Handle missing security schemes component Feb 28, 2021
@joschi joschi merged commit 2f90a44 into OpenAPITools:master Feb 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants