Fix null request body issue (#16376)

* suggestion how to fix #9217

* removed check for versions V2/v3

* removed useless import
This commit is contained in:
EdithBirrer1
2023-08-30 07:40:35 +02:00
committed by GitHub
parent 134dc98a71
commit 35f5852cc0

View File

@@ -7496,9 +7496,6 @@ public class DefaultCodegen implements CodegenConfig {
String name = null;
LOGGER.debug("Request body = {}", body);
Schema schema = ModelUtils.getSchemaFromRequestBody(body);
if (schema == null) {
throw new RuntimeException("Request body cannot be null. Possible cause: missing schema in body parameter (OAS v2): " + body);
}
codegenParameter.setContent(getContent(body.getContent(), imports, "RequestBody"));
if (StringUtils.isNotBlank(schema.get$ref())) {
@@ -7563,7 +7560,6 @@ public class DefaultCodegen implements CodegenConfig {
updateRequestBodyForPrimitiveType(codegenParameter, schema, bodyParameterName, imports);
}
addJsonSchemaForBodyRequestInCaseItsNotPresent(codegenParameter, body);
// set the parameter's example value