add support for extension in request body to name body parameter (#17850)

This commit is contained in:
William Cheng 2024-02-13 17:33:51 +08:00 committed by GitHub
parent dd3ab0a1fa
commit 4fb97b1003
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4744,6 +4744,10 @@ public class DefaultCodegen implements CodegenConfig {
if (op.vendorExtensions != null && op.vendorExtensions.containsKey("x-codegen-request-body-name")) { if (op.vendorExtensions != null && op.vendorExtensions.containsKey("x-codegen-request-body-name")) {
bodyParameterName = (String) op.vendorExtensions.get("x-codegen-request-body-name"); bodyParameterName = (String) op.vendorExtensions.get("x-codegen-request-body-name");
} }
if (requestBody.getExtensions() != null && requestBody.getExtensions().containsKey("x-codegen-request-body-name")) {
bodyParameterName = (String) requestBody.getExtensions().get("x-codegen-request-body-name");
}
bodyParam = fromRequestBody(requestBody, imports, bodyParameterName); bodyParam = fromRequestBody(requestBody, imports, bodyParameterName);
if (bodyParam != null) { if (bodyParam != null) {