-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Replace persistent entities with a simple POJO or DTO objects for controllers #12676
Comments
@tillias : it's because you didn't use service + dto when generating your entities. But as you didn't fill the template with your config, I can't guess :) |
We have a dto option which should do exactly that https://www.jhipster.tech/using-dtos/#how-dtos-work-in-jhipster |
Hello lovely people, sorry for bothering with this, but which parameters should I pass to generator for this? If I check https://www.jhipster.tech/using-dtos/#how-dtos-work-in-jhipster then there is mention that "I have an option" When I use https://www.jhipster.tech/creating-an-entity/ then still can't find any parameters for --import-jdl Please advise |
@tillias : what do you use for generating your entities ? If it's with CLI, you should have the question. I think it's with JDL, so you should use:
|
I'm using JDL Online and then simply run --import-jdl |
Confirmed, works as designed by jhipster-team |
Overview of the feature request
By default persistent entities are used as DTOs for all controllers. For example: https://sonarcloud.io/project/issues?id=microcatalog&open=AXUFA43oaLeiCpuVTUPk&resolved=false&types=VULNERABILITY
Please generate DTO objects for rest controllers (e.g. SomeEntity for persistence layer and SomeEntityDTO for controllers)
Motivation for or Use Case
This is direct violation of java:S4684 and displayed in SonarQube as Security Violation.
See https://jira.sonarsource.com/browse/SONARJAVA-2797 or https://stackoverflow.com/questions/54233672/how-to-avoid-the-vulnerability-created-by-using-entities-at-a-requestmapping-met
Related issues or PR
The text was updated successfully, but these errors were encountered: