You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Optional array properties in JSON responses fail validation when an optional array property is null:
// ensure the json data is an arrayif (!jsonObj.get("anotherThing").isJsonArray()) {
thrownewIllegalArgumentException(String.format("Expected the field `linkedContent` to be an array in the JSON string but got `%s`", jsonObj.get("linkedContent").toString()));
}
A null check is required.
java.lang.NullPointerException: Cannot invoke "com.google.gson.JsonElement.isJsonArray()" because the return value of "com.google.gson.JsonObject.get(String)" is null
Bug Report Checklist
Description
Optional array properties in JSON responses fail validation when an optional array property is null:
A null check is required.
Expected to check null and validate successfully.
openapi-generator version
Current
master
(0d56ebc
).OpenAPI declaration file content or url
Declaration of an array property:
Suggest a fix
Looks like it was introduced in 3ae37e2,
pojo.moustache
line 500. I'll work on a PR.The text was updated successfully, but these errors were encountered: