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

Add JSR-303 support to HAL-FORMS #619

Open
gregturn opened this issue Aug 29, 2017 · 0 comments
Open

Add JSR-303 support to HAL-FORMS #619

gregturn opened this issue Aug 29, 2017 · 0 comments

Comments

@gregturn
Copy link
Contributor

gregturn commented Aug 29, 2017

When a Spring MVC method is marked up with:

  • @Pattern annotation - populate any HAL-FORMS model regexp attribute accordingly.
  • @NotNull annotation - flip required flags to true

This solution should certainly test derivative annotations as well, to ensure it's not just immediate.

@NotNull
@Pattern(regexp = "my pattern")
public @interface MyCustomAnnotation {
}

Such an annotation on a Spring MVC method should apply both of the patterns to the affordance.

Also note that JSR-303 supports patterns like this:

@Pattern.List( {
    @Pattern(regexp="[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}"), //email
    @Pattern(regexp=".*?emmanuel.*?") //emmanuel
} )

HAL-FORMS should ALSO handle this scenario by having a list-based way of showing the user what the pattern is. The spec says regex is a string, so consider a stringified JSON object structure so the list of patterns is consumable by a JavaScript frontend.

@gregturn gregturn changed the title Add JSR-303 @Pattern support to HAL-FORMS Add JSR-303 support to HAL-FORMS Aug 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant