swagger-api / swagger-api/swagger-codegen
[AspNetCore] Bug - Missing "]" in StringLength attribute
Open
@gracekarina is already working on this.
Since Jun 15, 2020.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
When generating a server stub controller with a parameter that have a MaxLength, swagger-code-generator is not including the ending "]" in the attribute
Example of wrongly generated method:
public virtual IActionResult ActivateSystem([FromRoute][Required][StringLength(32, MinimumLength=3)string systemIdentifier)
Swagger-codegen version
3.0
Swagger declaration file content or url
parameters:
- name: systemIdentifier
in: path
description: Identifier of the System
required: true
schema:
type: string
minLength: 3
maxLength: 32
example: 122XDSSAA222332
Command line used for generation
java -jar swagger-codegen-cli.jar generate -i api.yml -l aspnetcore -o s_t_net
Suggest a fix/enhancement
https://github.com/fbridger/swagger-codegen/commit/bf2a869cc945ec491c403da08dd59799ef1d3bab
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.
Assessment
This issue has not been assessed yet.