Skip to content

Line 7115 Bug fixed from "“modules/openapi- generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java” route. #14919

@pablobuza014

Description

@pablobuza014

// CORRECT CODE
if (mostInnerItem == null) { // If "mostInnerItem" is null, then we throw an exception with an error message.
throw new RuntimeException("mostInnerItem (codegen property of array item) cannot be null. " + arraySchema); // We throw a "RunTimeException" with an error message that indicates that "mostInnerItem" cannot be null. The message also includes the value of "arraySchema".
// "ArraySchema" has been imported via "import org.openapitools.codegen.utils.ModelUtils;" at the beginning of the project; it's an external library from OpenAPI Tools, from which OpenAPI Generator originates.
}

        if (bodyParameterName != null && !bodyParameterName.isEmpty()) { // If "bodyParameterName" is not null and not empty... --- THIS LINE HAS BEEN MODIFIED ---
            if (StringUtils.isEmpty(mostInnerItem.complexType)) { // If the "mostInnerItem" object has an empty "complexType" property...
                codegenParameter.baseName = "request_body"; // We set the value of the "codegenParameter.baseName" property to "request_body".
            } else { 
                codegenParameter.baseName = mostInnerItem.complexType; // Otherwise, we set the value of the "codegenParameter.baseName" property to the value of the "complexType" property of "mostInnerItem".
            }
        } else {
            codegenParameter.baseName = "request_body"; // If "bodyParameterName" is null or empty, we set the default value "request_body" for "codegenParameter.baseName". --- THIS LINE HAS BEEN MODIFIED ---
        }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions