[Typescript Angular] Object parameters not serialized properly
luca-vercelli opened this issue · 6 comments
In a GET endpoint, I have a object parameter that should be serialized in JSON:
parameters:
- in: query
name: filter
content:
application/json:
schema:
type: object
properties:
size:
type: integer
color:
type: string
This is supported by specs however the generated typescript code does not serialize the object:
queryParameters = queryParameters.set('filter', filter);
instead of
queryParameters = queryParameters.set('filter', JSON.stringify(filter));
If I am not wrong no serialization is done at all, I mean, not only JSON serialization, but also style
keyword is ignored.
I could work on this issue if community considers it useful.
Hey @luca-vercelli thanks for filing this issue, if you are still willing to work on issue it would be great. You can ping me if needs help
ok thank you. I will try.
Hi @HugoMario I found a solution, please tell me if this sounds good to you.
I had to modify classes in both projects swagger-codegen-generators
and swagger-codegen
.
I add a new attribute isJson
here:
luca-vercelli/swagger-codegen@6d29bf4
then I populate and use that attribute here:
Actually I received some errors from github pipeline, I cannot understand if it's my fault:
https://github.com/luca-vercelli/swagger-codegen/actions/runs/6982237267/job/19000997585#step:5:26
@luca-vercelli
Commit looks good to me, please file a PR and ping me to merge it. Thanks!
Should I file 2 different PR for the 2 projects, right?
Yea, If you see both projects need the change, feel free to file the PR in each of them