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

Invoking Overlay.isReference(Schema,Key) gives a NullPointer if key does not exist #18

Open
MikeSchumacherCapgemini opened this issue May 16, 2018 · 0 comments

Comments

@MikeSchumacherCapgemini
Copy link

MikeSchumacherCapgemini commented May 16, 2018

When trying to find out whether a property is a reference or not, or getting the reference, if the key does not exist, a NullPointer is thrown. Perhaps it would be better to return false or null.

Stacktrace:

java.lang.NullPointerException
	at com.reprezen.jsonoverlay.PropertiesOverlay.getReference(PropertiesOverlay.java:209)
	at com.reprezen.jsonoverlay.Overlay.getPropertyReference(Overlay.java:309)
	at com.reprezen.jsonoverlay.Overlay.getReference(Overlay.java:283)
	at com.reprezen.jsonoverlay.Overlay.isReference(Overlay.java:266)
	at com.reprezen.jsonoverlay.Overlay.isReference(Overlay.java:270)

Example:

if(Overlay.isReference(someSchema,"items")){
     some code
}

returns null when someSchema is like

{"type":"array","items":{"$ref":"#/components/schemas/MoreData"},"description":"a single ref to MoreData (many-to-one)"}

@maybeec

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

No branches or pull requests

1 participant