ng-openapi-gen
ng-openapi-gen copied to clipboard
String property of model sent as integer
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
Have you debugged your UI? JS do not have types, so probably the data you are sending is actually integer, eg coming from control.
Can you post the following info?
- ng-openapi-gen version
- Model / request descriptor
- Generated model / service