Open cyangle opened 2 years ago
So whether to generate a list of form params or a single model for request body is determined by request contentType at here.
I think it's better to provide a cli option to always generate a single model for each request body.
I'm considering adding a new boolean flag --generate-form-as-model
similar to --generate-alias-as-model
.
The cli option is false by default so that it behaves the same as before.
I can send a PR implementing this.
What do you think? @wing328
Bug Report Checklist
Description
It seems like OAG can't generate below spec correctly.
I have tried below command line options:
With minimal options
fake_api.cr
but there's no models generatedinline_map
is missing fromfake_api.cr
def fake(id : String?, map_of_string : Hash(String, String)?, map_of_pet : Hash(String, Pet)?)
With
--global-property skipFormModel=false
FakeRequest
andPet
FakeRequest
has all request body propertiesFakeRequest
is never used in the generated api filefake_api.cr
def fake(id : String?)
Maybe I'm missing some command line flags for this to work.
I found this problem while trying to improve support for form serialization in crystal generator.
@wing328
openapi-generator version
6.2.1-SNAPSHOT
OpenAPI declaration file content or url
bug_spec.yml
Generation Details
See description.
Steps to reproduce
See description.
Related issues/PRs
Suggest a fix