Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,16 @@ import {{packageName}}.infrastructure.ITransformForStorage
String.format("Expected the field `{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}` to be an array in the JSON string but got `%s`", jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"].toString())
}
{{/required}}
{{#items.isPrimitiveType}}
// ensure the items in json array are primitive
if (jsonObj["{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"] != null) {
for (i in 0 until jsonObj.getAsJsonArray("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}").size()) {
require(jsonObj.getAsJsonArray("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}").get(i).isJsonPrimitive) {
String.format("Expected the property in array `{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}` to be primitive")
}
}
}
{{/items.isPrimitiveType}}
{{/items.isModel}}
{{/isArray}}
{{^isContainer}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ data class ApiPet (
require(jsonObj["photoUrls"].isJsonArray()) {
String.format("Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj["photoUrls"].toString())
}
// ensure the items in json array are primitive
if (jsonObj["photoUrls"] != null) {
for (i in 0 until jsonObj.getAsJsonArray("photoUrls").size()) {
require(jsonObj.getAsJsonArray("photoUrls").get(i).isJsonPrimitive) {
String.format("Expected the property in array `photoUrls` to be primitive")
}
}
}
// validate the optional field `category`
if (jsonObj["category"] != null && !jsonObj["category"].isJsonNull) {
ApiCategory.validateJsonElement(jsonObj["category"])
Expand Down
Loading