I got a simple endpoint which returns a simple DTO:
interface Topic {
/**
* @isInt ID must be an integer.
*/
id: number;
name: string;
}
Generating the swagger.yaml works as expected:
Topic:
properties:
id:
type: integer
format: int32
name:
type: string
required:
- id
- name
type: object
additionalProperties: false
the problem is that the actual serialization is wrong. Instead of an integer, id will be serialized as a string:
{"id": "1", "name": "Science"}
Is this expected/normal/standard or am I doing something wrong here?
I'd expect basic types such as boolean, integer, decimal numbers and strings to be serialized accordingly.
It should serialize according to your interface. This appears to be a bug. Which version are you currently running? I'm unable to replicate this issue on the latest version,
v6.2.Here is my controller.