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

@nestjs/swagger ApiProperty not required on Entity classes #13

Open
aschnebelext opened this issue Jan 17, 2023 · 1 comment
Open

@nestjs/swagger ApiProperty not required on Entity classes #13

aschnebelext opened this issue Jan 17, 2023 · 1 comment

Comments

@aschnebelext
Copy link

The auto-generated entity classes are for internal use only, correct?

I would not assume that such classes are annotated in such a case.

But this is currently generated.

@Brakebein
Copy link
Owner

The original package had only the ConnectDTO, CreateDTO, UpdateDTO, and Entity classes. We were adding the plain DTO later, because you usually don't return all the relations of a model. And the Entity classes have, due to their relations, potentially a lot of circular dependencies. That's maybe why both the plain DTO and the Entity classes are annotated.

We actually still use some of the Entity classes as response type in our project. Because if you want to return an entity with only some nested relations, you would still have to define some extra DTOs. After some fast initial implemention in our project, we wanted to replace them, but haven't done it yet.

I haven't seen it yet from the perspective that the Entity classes should only be intended for internal use. It basically makes sense, in particular that you don't want these circular dependencies (leads to some trouble with the generated API docs). But changing this would also mean a breaking change of the package.

I guess you find that the current version generates too much (unused) extra lines of code you have to commit in your project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants