Closed yelhouti closed 11 months ago
This issue is stale because it has been open 30 days with no activity. Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted. We are accepting PRs :smiley:. Comment or this will be closed in 7 days
This issue is stale because it has been open for too long without any activity. Due to the moving nature of jhipster generated application, bugs can become invalid. If this issue still applies please comment otherwise it will be closed in 7 days
Overview of the issue
Validation in JHipster apps is both done client and server side which great, and allows to handle cases where the validation can't always be insured in the client. In that case we would expect constraint validations to return messages that match what the client/frontend can translate. For example this code for angular: https://github.com/jhipster/generator-jhipster/blob/198ac86f251491daa85e4501f7f1bf304040b4b7/generators/client/templates/angular/src/main/webapp/app/shared/alert/alert-error.component.ts.ejs#L75-L84 Which tries to translate what is in message.
Unfortunately, the
@NotNull
java annotation has a default message that is automatically translated server side, and the message containsmust not be null
which results in a message that client is unable to translate.Motivation for or Use Case
Better error handling server side
Reproduce the error
create a new app with a sample jdl, this for example: https://github.com/jhipster/generator-jhipster/blob/main/test-integration/samples/jdl-default/app.jdl
change the client to remove a client side validation, for example in the
department-update.component.ts
remove the validator for name, the click on save.It doesn't show that the error is not null, but the code tries to show that and fails gracefully.
Suggest a Fix
change default translation for messages when translation is enabled to @NotNull => "NotNull" the client will then handle it automatically.
JHipster Version(s)
7.2.0
JHipster configuration
INFO! Using JHipster version installed globally
JHipster Version(s)
JHipster configuration, a
.yo-rc.json
file generated in the root folder.yo-rc.json file
JDL for the Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryJDL entity definitions
Environment and Tools
openjdk version "1.8.0_292" OpenJDK Runtime Environment (build 1.8.0_292-b10) OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)
git version 2.31.1
node: v14.18.0
npm: 6.14.15
Docker version 20.10.7, build f0df350
docker-compose version 1.29.0, build 07737305
Congratulations, JHipster execution is complete! Sponsored with ❤️ by @oktadev.