Skip to content

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