Closed honguyenhaituan closed 3 months ago
Nestia swagger generates incorrect schema for type record.
I have an dto:
export type UserGameInfoDto = { achievements: number[]; actions: Record<string, number>; };
"UserGameInfoDto": { "type": "object", "properties": { "achievements": { "type": "array", "items": { "type": "number" } }, "actions": { "type": "object", "additionalProperties": { "type": "number" } } }, "nullable": false, "required": ["achievements", "actions"] },
"UserGameInfoDto": { "type": "object", "properties": { "achievements": { "type": "array", "items": { "type": "number" } }, "actions": { "$ref": "#/components/schemas/Recordstringnumber" } }, "nullable": false, "required": ["achievements", "actions"] }, "Recordstringnumber": { "type": "object", "properties": {}, "nullable": false, "description": "Construct a type with a set of properties K of type T" },
The swagger support type dictionary (https://swagger.io/docs/specification/data-models/dictionaries/) but nestia doesn't generate it.
Checked in onto typia playground website, and found bug in JSON schema generator.
typia
Will fix it soon.
https://typia.io/playground/?script=JYWwDg9gTgLgBDAnmYBDOAzKERwERIqp4DcAUGYWgHQDGUApqjAwJIDOAPAEoO3QATTuxhRgAOwDmAGjjiAriABGDKAD41ACgCU5KqmoArdhHHVUYMABtgtZsFOcA2r35QhIsVNkLlqtQC6WrpAA
Upgrade to typia@5.5.8, then be fixed.
typia@5.5.8
Summary
Nestia swagger generates incorrect schema for type record.
I have an dto:
The swagger support type dictionary (https://swagger.io/docs/specification/data-models/dictionaries/) but nestia doesn't generate it.