-
Notifications
You must be signed in to change notification settings - Fork 200
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
@NotNull not supported on fields #395
Comments
What do you mean when you say |
If you take a look at hibernate's For the client side documentation it would be nice, if it would be set to required if an annotation already "inherits" But since this is a custom annotation anyway, maybe it's good enough to handle that with the freemarker templates and check explicitly for @Documented
@Constraint(validatedBy = { })
@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
@ReportAsSingleViolation
@NotNull
public @interface NotBlank {
String message() default "{org.hibernate.validator.constraints.NotBlank.message}";
Class<?>[] groups() default { };
Class<? extends Payload>[] payload() default { };
/**
* Defines several {@code @NotBlank} annotations on the same element.
*/
@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
@Documented
public @interface List {
NotBlank[] value();
}
} |
Fixed at defdba0. Added support for detecting "inherited" |
Works, thanks! But this doesn't contain support for annotations on fields, as it seems, right :)? |
The problem is that you're expecting Enunciate to use annotations that are on the fields for the properties (getters/setters). If the fields were getting used as accessors instead of the properties, Enunciate would pick up the |
That means, that Enunciate is using jackson for reading annotations? Or does Enunciate evaluate the |
Enunciate evaluates the annotation itself. |
Now I'm confused ;). Enunciate has its own mechanism for finding/reading annotations. Ok. And Enunciate evaluates |
Correct. |
Hi.
I'm using
@NotNull
to mark attributes as required. I tend to put these on the fields of a class. It seems that enunciate doesn't pick these up - unless they are specified on the getter. Could that be enhanced?Another thing regarding this:
I've created my own annotation
@NotBlank
, that "inherits"@NotNull
but also checks for empty strings using trim(). Would it make sense that enunciate also checks for any annotations on fields that "inherit" from@NotNull
?The text was updated successfully, but these errors were encountered: