forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/6.3.x' into 7.0.x
This commit is contained in:
@@ -881,6 +881,8 @@ public class ApiClient {
|
||||
content = null;
|
||||
}
|
||||
return RequestBody.create(content, MediaType.parse(contentType));
|
||||
} else if (obj instanceof String) {
|
||||
return RequestBody.create(MediaType.parse(contentType), (String) obj);
|
||||
} else {
|
||||
throw new ApiException("Content type \"" + contentType + "\" is not supported");
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class SomeObj {
|
||||
@SerializedName(SERIALIZED_NAME_TYPE)
|
||||
private String type;
|
||||
|
||||
public SomeObj() {
|
||||
public SomeObj() {
|
||||
}
|
||||
|
||||
public SomeObj $type(TypeEnum $type) {
|
||||
@@ -303,9 +303,7 @@ public class SomeObj {
|
||||
*/
|
||||
public static void validateJsonObject(JsonObject jsonObj) throws IOException {
|
||||
if (jsonObj == null) {
|
||||
if (SomeObj.openapiRequiredFields.isEmpty()) {
|
||||
return;
|
||||
} else { // has required fields
|
||||
if (!SomeObj.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null
|
||||
throw new IllegalArgumentException(String.format("The required field(s) %s in SomeObj is not found in the empty JSON string", SomeObj.openapiRequiredFields.toString()));
|
||||
}
|
||||
}
|
||||
@@ -317,13 +315,13 @@ public class SomeObj {
|
||||
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SomeObj` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
|
||||
}
|
||||
}
|
||||
if (jsonObj.get("$_type") != null && !jsonObj.get("$_type").isJsonPrimitive()) {
|
||||
if ((jsonObj.get("$_type") != null && !jsonObj.get("$_type").isJsonNull()) && !jsonObj.get("$_type").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format("Expected the field `$_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("$_type").toString()));
|
||||
}
|
||||
if (jsonObj.get("name") != null && !jsonObj.get("name").isJsonPrimitive()) {
|
||||
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
|
||||
}
|
||||
if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonPrimitive()) {
|
||||
if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user