swagger-api / swagger-api/swagger-codegen
[All] spec 1.2 doesn't WARN or ERROR on invalid template
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Swagger-codegen version
v2.2.3
Swagger declaration file content or url
{ "apiVersion": "0.1",
"apis": [
{ "operations": [{"method": "GET", "nickname": "testGet"} ],
"path": "/test"
}
],
"models": {
"MyError": {
"properties": {
"fields": {
"description": ["Arrays in the description seems to break the generator"],
"type": "object"
}
}
}
},
"resourcePath": "/test",
"swaggerVersion": "1.2"
}
Command line used for generation
swagger-codegen generate -i bareminimum.json -o bm1 -l go
Steps to reproduce
- Run the command
- Notice that it does not generate a
my_error.goclass nor does it throw a warning or an error - Change the
"description"value to a string - Rerun the command
- Notice that it does generate a
my_error.goclass
Related issues/PRs
I closed #6811 and opened this, more general, issue. This issue seems similar to #5312 in that it is a parsing error with 1.2 spec.
Suggest a fix/enhancement
I suspect that the 1.2 spec parsing is swallowing errors/warnings somewhere. It would be great to expose these messages so that offending spec files can be more easily corrected.
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
Start by running swagger-codegen generate -i bareminimum.json -o bm1 -l go with the supplied Swagger 1.2 declaration and compare it with the version whose description is a string. Trace the 1.2 parsing and template-generation path for how the invalid array value is handled; done means the invalid template produces a visible warning or error instead of silently omitting my_error.go.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100