-
-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScrpit init(): A object property is processed as an array of objects. #697
Comments
Is there any workaround for this issue? Can I override the init function externally? |
Hmm, I think there is no easy workaround. I'd say this is a bug as any/object should be just assigned and not looped through the properties. Or add another a check whether the var contains an object (for) or a primitive (assign)? |
I see. Is there any way yo override the whole method and write it myself? |
Maybe by overriding the correct template: |
Somehow it’s treated as dictionary: |
This is the condition for dictionary: |
Can you post the generated schema? |
I already did in the post. I've posted the generated TypeScript code |
... the JSON Schema which is generated from the DTO. |
In this test everything looks fine: 21ce1da |
Actually this happened after an update to the swagger library to the latest version. Can you please try with this schema? |
What library are you using? |
Swashbuckle.AspNetCore.SwaggerGen, Version=2.4.0.0 |
Strings are generated as char arrays. But even worse - other types like boolean, are empty! |
How exactly does the Swagger spec for this look like when generated by Swashbuckle? Somehow NJS treats it as dictionary when it's actually an object (objects are directly assigned, dictionaries are copied) |
If the model in the API contains a field from type object, it is converting string to an array of charecters during the init.
The DTO in my case is:
The generated code is:
So, when the filter.value is a string, it is generated as an array of char.
The text was updated successfully, but these errors were encountered: