forked from loafle/openapi-generator-original
update samples
This commit is contained in:
parent
1bfd86a350
commit
d1fe2e17f1
@ -672,11 +672,19 @@ public class ApiClient {
|
|||||||
} else {
|
} else {
|
||||||
// We let jersey handle the serialization
|
// We let jersey handle the serialization
|
||||||
if (isBodyNullable) { // payload is nullable
|
if (isBodyNullable) { // payload is nullable
|
||||||
|
if (obj instanceof String) {
|
||||||
|
entity = Entity.entity(obj == null ? "null" : "\"" + ((String)obj).replaceAll("\"", Matcher.quoteReplacement("\\\"")) + "\"", contentType);
|
||||||
|
} else {
|
||||||
entity = Entity.entity(obj == null ? "null" : obj, contentType);
|
entity = Entity.entity(obj == null ? "null" : obj, contentType);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (obj instanceof String) {
|
||||||
|
entity = Entity.entity(obj == null ? "" : "\"" + ((String)obj).replaceAll("\"", Matcher.quoteReplacement("\\\"")) + "\"", contentType);
|
||||||
} else {
|
} else {
|
||||||
entity = Entity.entity(obj == null ? "" : obj, contentType);
|
entity = Entity.entity(obj == null ? "" : obj, contentType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -709,7 +717,7 @@ public class ApiClient {
|
|||||||
if (isBodyNullable) {
|
if (isBodyNullable) {
|
||||||
return obj == null ? "null" : json.getMapper().writeValueAsString(obj);
|
return obj == null ? "null" : json.getMapper().writeValueAsString(obj);
|
||||||
} else {
|
} else {
|
||||||
return json.getMapper().writeValueAsString(obj);
|
return obj == null ? "" : json.getMapper().writeValueAsString(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user