swagger-api / swagger-api/swagger-codegen
[typescript-angular] Primitive typed parameters
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I have some API's that contain primitive parameters in the request body of POST requests.
The problem is that primtive parameters are forced to be JSON encoded, generating random
interfaces like:
export interface Body2 {
usuario: OctopusEntitiesColetorTUsuario;
iRecnoSolicitacao: number;
}
This also happens to responses classes.
Thank you.
Swagger-codegen version
2.4.0.
Also tested on 2.3.0. Same problem.
Swagger declaration file content or url
"/WmsService/AlocarTransferirMateriaisWms":{
"post":{
"tags":[
"WmsService"
],
"operationId":"IWmsService.AlocarTransferirMateriaisWms",
"consumes":[
"application/json"
],
"produces":[
"application/json"
],
"parameters":[
{
"in":"body",
"name":"body",
"required":true,
"schema":{
"type":"object",
"properties":{
"sCodigoItem":{
"type":"string"
},
"sLote":{
"type":"string"
},
"sMotivoMovimentacao":{
"type":"string"
},
"sUsuarioSistema":{
"type":"string"
},
"dQtdeMovimentacao":{
"type":"number"
},
"iNumeroOdf":{
"type":"integer"
},
"iCodigoLocalOrigem":{
"type":"integer"
},
"iCodigoLocalDestino":{
"type":"integer"
},
"iEmpresaRecno":{
"type":"integer"
}
},
"required":[
"sCodigoItem",
"sLote",
"sMotivoMovimentacao",
"sUsuarioSistema",
"dQtdeMovimentacao",
"iNumeroOdf",
"iCodigoLocalOrigem",
"iCodigoLocalDestino",
"iEmpresaRecno"
]
}
}
],
"responses":{
"200":{
"description":"Successful response",
"schema":{
"type":"object",
"properties":{
"value":{
"type":"boolean"
}
}
}
}
}
}
},
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 the typescript-angular generator against the Swagger declaration in the issue, focusing on the POST body and response schemas containing primitive properties. Done means primitive request and response values use their declared types without generating unnecessary interfaces or JSON encoding.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100