cyclosproject / ng-openapi-gen

An OpenAPI 3.0 codegen for Angular
MIT License
397 stars 132 forks source link

String property of model sent as integer #228

Open No1e opened 2 years ago

No1e commented 2 years ago

Hi,

I have just discovered an issue, but I am not sure if its on your side, or I am doing something wrong.

Let me try to describe it.

I have Web API (support for user interaction - Login, 2SV, 2FA, etc.) implemented on the latest version of ASP.NET Core platform, and one of my API methods was not working. I was always getting null for the input parameter. The parameter was marked with [FromBody] attribute. The model it self is pretty simple, it have only one property of string type.

So, I generate all the artifacts (model, services, etc.) with ng-openapi-gen, and when I look that the definition of model, it looks fine. Defined as interface with one string property. So, all good.

The problem is that, when I send the request by using method of generated service, it sends the property as integer, instead of string. This causes that my API method gets null.

If I change my model, so that the property is of integer type, instead of string, and repeat all mentioned above, everything works as expected.

Is this known issue? Or am I doing something wrong?

Best regards, Novak

Lonli-Lokli commented 2 years ago

Have you debugged your UI? JS do not have types, so probably the data you are sending is actually integer, eg coming from control.

luisfpg commented 1 year ago

Can you post the following info?