swagger-api / swagger-api/swagger-codegen
NullPointerException caused by "in": "body"
Open
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Using this command:
swagger-codegen generate -i https://raw.githubusercontent.com/npomfret/coinsbank-php-sdk/master/reference/coinsbank-sapi.json -l spring -o .
I'm getting a NPE that seems to be caused by this:
"/card/name/_{cardUniqueId}": {
"put": {
"description": "Set user-defined card name",
"parameters": [
{
"name": "cardUniqueId",
"in": "path",
"description": "Card UID",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "params",
"in": "body",
"description": "Card params",
"requried": true,
"schema": {
"properties": {
"name": {
"type": "string",
"description": "User-defined card name"
}
}
}
}
],
"responses": {
"200": {
"description": "Card has been renamed"
}
}
}
},
If I remove the "in": "body", section of the 2nd parameter (the one called "params" confusingly) it works. Is this invalid swagger?
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 failure with the swagger-codegen command and the referenced coinsbank-sapi.json definition, focusing on the parameter whose "in" value is "body". Inspect how body parameters are handled and confirm that generation no longer raises a NullPointerException, or reports the definition as invalid with a useful error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- spring
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100