Skip to content

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

@MikeSchumacherCapgemini

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions