eclipse / lsp4jakarta

Language Server for Jakarta EE
Eclipse Public License 2.0
34 stars 51 forks source link

Jakarta Bean Validation Size and NotEmpty annotation diagnostics #63

Open rezaakv opened 4 years ago

rezaakv commented 4 years ago

Add diagnostics for these constraints to ensure they are annotated on the supported types.

The main problem is that these annotations work on field types of Collections, Arrays and Map, which should be resolved (before using them to check against the allowed types below) and also the type could be any custom subtype of these interfaces including user made ones.

@NotEmpty: Supported types are:

@Size: Supported types are:

mcruzdev commented 3 years ago

Hello everyone, Can assign to me?

mcruzdev commented 3 years ago

Hi everyone, @kathrynkodama

How can I get a type of IField?

By example:

@Size
private String value;

@Size
private Map map;

I want to get the FQN of filed type (map and value) Because I will need to verify if the type is one java.util.Map or java.util.List etc Is there an example or documentation for help me?

If you have other approach, will be appreciate, thank you 😁

kathrynkodama commented 3 years ago

@mcruzdev you can use IField https://www.ibm.com/support/knowledgecenter/en/SSUFAU_2.0.0/org.eclipse.jdt.doc.isv-3.14.100/reference/api/org/eclipse/jdt/core/class-use/IField.html.

See PersistenceMapKeyDiagnosticsCollector for an example of a diagnostic appearing on a field.

mswatosh commented 5 months ago

This should be added for Jakarta EE 11