-
Notifications
You must be signed in to change notification settings - Fork 6k
Open
Description
Description
Swagger-codegen is generating duplicate methods in a class when multiple request bodies are defined. This seems to only happen when the title and/or description is included in the scheme for the request body.
error output on packaging
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/cisom/dev/workspace/swagger-codegen/samples/src/main/java/com/sample/api/DefaultApi.java:[183,37] method postDataCall(java.lang.Object,com.sample.ProgressResponseBody.ProgressListener,com.sample.ProgressRequestBody.ProgressRequestListener) is already defined in class com.sample.api.DefaultApi
[ERROR] /Users/cisom/dev/workspace/swagger-codegen/samples/src/main/java/com/sample/api/DefaultApi.java:[225,38] method postDataValidateBeforeCall(java.lang.Object,com.sample.ProgressResponseBody.ProgressListener,com.sample.ProgressRequestBody.ProgressRequestListener) is already defined in class com.sample.api.DefaultApi
[ERROR] /Users/cisom/dev/workspace/swagger-codegen/samples/src/main/java/com/sample/api/DefaultApi.java:[246,17] method postData(java.lang.Object) is already defined in class com.sample.api.DefaultApi
[ERROR] /Users/cisom/dev/workspace/swagger-codegen/samples/src/main/java/com/sample/api/DefaultApi.java:[257,30] method postDataWithHttpInfo(java.lang.Object) is already defined in class com.sample.api.DefaultApi
[ERROR] /Users/cisom/dev/workspace/swagger-codegen/samples/src/main/java/com/sample/api/DefaultApi.java:[270,37] method postDataAsync(java.lang.Object,com.sample.ApiCallback<java.lang.Void>) is already defined in class com.sample.api.DefaultApi
Swagger-codegen version
3.0.34 and 3.0.35-SNAPSHOT
Swagger declaration file content or url
sample.yaml
openapi: 3.0.2
info:
title: Sample Service
version: '1.0'
description: Sample yaml file to recreate bug
servers:
- url: 'http://127.0.0.1'
description: local
paths:
/sample/v1/paths:
post:
summary: post to path
operationId: post_data
responses:
'200':
description: received
description: Send data to the Sample Service
requestBody:
content:
sample.com/syslog:
schema:
type: string
title: SysSysloglog
description: "Syslog messages separated by `\\n`"
format: binary
sample.org/unified:
schema:
type: string
title: Unified
description: "Unified records"
format: binary
description: 'Request Body'
required: trueconfig file
{
"apiPackage": "com.sample.api",
"modelPackage": "com.sample.model",
"invokerPackage": "com.sample",
"useRuntimeException": "true",
"java11": "true",
"parcelableModel": "false"
}Command line used for generation
swagger-codegen generate -i sample.yaml -l java -c config.json
Steps to reproduce
Copy the sample.yaml and config.json below and run the following command.
swagger-codegen generate -i sample.yaml -l java -c config.json
Once generated mnv package will generate the error above showing the duplicate methods in the class.
Related issues/PRs
N/A
Suggest a fix/enhancement
Please fix this to allow title and description to be added to the schema of multiple request bodies.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels