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

Improve Validation Error Messages for non visible Fields by Including Attribute Context #4062

Open
mariodavid opened this issue Jan 14, 2025 · 0 comments
Labels
in: flowui triage Issue is waiting for triage type: bug Something isn't working

Comments

@mariodavid
Copy link
Contributor

Environment

Jmix version: 2.4.2

Bug Description

Validation error messages, such as may not be null, often lack context about the specific attribute causing the issue. This makes it difficult for developers to identify and fix the problem.

Example:

A Customer entity has the following fields:

  • name (@NotNull)
  • birthday (@NotNull)

In the corresponding detail view, the birthday field is mistakenly not added to the UI. When attempting to save a new customer, the validation fails because birthday is not set. However, the error message shown is:

may not be null

This message does not indicate that the issue is with the birthday field.

Additionally, similar issues can occur with other validation errors, not just @NotNull.

Steps To Reproduce

  1. Create a Customer entity:
@Entity
public class Customer {
    @NotNull
    private String name;

    @NotNull
    private LocalDate birthday;

    // Getters and setters
}
  1. Generate an edit screen for the Customer entity.
  2. Remove the birthday field from the view.
  3. Attempt to save a new customer by filling in only the name field.

Current Behavior

The application shows a generic error message:

may not be null

This message does not specify the attribute causing the issue.

Expected Behavior

The validation error message should include the specific attribute, such as:

Birthday may not be null

This would make it easier for developers to identify and fix the problem.

jmix-problem-error-message

Sample Project

jmix-problem-error-message.zip

@mariodavid mariodavid added type: bug Something isn't working triage Issue is waiting for triage in: flowui labels Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: flowui triage Issue is waiting for triage type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant