Skip to content
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

Nestia swagger generate incorrect schema for type record #859

Closed
honguyenhaituan opened this issue Apr 1, 2024 · 2 comments
Closed

Nestia swagger generate incorrect schema for type record #859

honguyenhaituan opened this issue Apr 1, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@honguyenhaituan
Copy link

Summary

Nestia swagger generates incorrect schema for type record.

I have an dto:

export type UserGameInfoDto = {
	achievements: number[];
	actions: Record<string, number>;
};
  • Expected behavior:
"UserGameInfoDto": {
          "type": "object",
          "properties": {
	          "achievements": {
		          "type": "array",
		          "items": { "type": "number" }
	          },
	          "actions": {
		          "type": "object",
                           "additionalProperties": {
                                   "type": "number"
                             }
	          }
          },
          "nullable": false,
          "required": ["achievements", "actions"]
},
  • Actual behavior:
"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.

@samchon samchon self-assigned this Apr 1, 2024
@samchon samchon added the bug Something isn't working label Apr 1, 2024
@samchon
Copy link
Owner

samchon commented Apr 1, 2024

@samchon
Copy link
Owner

samchon commented Apr 1, 2024

Upgrade to typia@5.5.8, then be fixed.

samchon added a commit to samchon/typia that referenced this issue Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants