swagger-api / swagger-api/swagger-codegen
It seems that the groovy client doesn't work well
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I generate groovy client, and find out that the post method doesn't attach any post body with the request.
As a result the request post with no body data.
Let me excerpt some piece of code generated:
//method excerpted from pet store sample
def createUsersWithArrayInput ( List<User> body, Closure onSuccess, Closure onFailure) {
// create path and map variables
String resourcePath = "/user/createWithArray"
// query params
def queryParams = [:]
def headerParams = [:]
// verify required params are set
if (body == null) {
throw new RuntimeException("missing required params body")
}
invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams,
"POST", "",
null )
}
we can see that the body is validated not null. and that's all for the body.
In no way the body is attached in the request.
Is there anyone can explain?
Swagger-codegen version
the code is generate via swagger online tool
Swagger declaration file content or url
/user/createWithArray:
post:
tags:
- user
summary: Creates list of users with given input array
description: ''
operationId: createUsersWithArrayInput
produces:
- application/xml
- application/json
parameters:
- in: body
name: body
description: List of user object
required: true
schema:
type: array
items:
$ref: '#/definitions/User'
responses:
default:
description: successful operation
Command line used for generation
groovy
Steps to reproduce
just generate groovy client code with definition from https://github.com/vorburger/swagger-codegen-gradle-plugin-example/blob/master/petstore-swagger.json via the online swagger generator
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the linked petstore Swagger definition and the online Groovy generator, then trace the generated invokeApi call shown in the excerpt. Confirm the generated POST client includes the required body data in the request and add or update coverage for this body parameter behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100