Skip to content

Commit 91b897c

Browse files
Update samples
1 parent 8e9ede6 commit 91b897c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

  • samples/client/petstore/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/models

samples/client/petstore/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/models/ApiPet.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,14 @@ data class ApiPet (
151151
require(jsonObj["photoUrls"].isJsonArray()) {
152152
String.format("Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj["photoUrls"].toString())
153153
}
154+
// ensure the items in json array are primitive
155+
if (jsonObj["photoUrls"] != null) {
156+
for (i in 0 until jsonObj.getAsJsonArray("photoUrls").size()) {
157+
require(jsonObj.getAsJsonArray("photoUrls").get(i).isJsonPrimitive) {
158+
String.format("Expected the property in array `photoUrls` to be primitive")
159+
}
160+
}
161+
}
154162
// validate the optional field `category`
155163
if (jsonObj["category"] != null && !jsonObj["category"].isJsonNull) {
156164
ApiCategory.validateJsonElement(jsonObj["category"])

0 commit comments

Comments
 (0)