spring-projects / spring-projects/spring-hateoas
Add JSR-303 support to HAL-FORMS
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 476
- PR merge metrics
- No merged PRs in 30d
Description
When a Spring MVC method is marked up with:
@Patternannotation - populate any HAL-FORMS model regexp attribute accordingly.@NotNullannotation - flip required flags totrue
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by locating the Spring MVC HAL-FORMS affordance processing and existing handling for required and regex attributes; then trace how composed annotations and @Pattern.List are represented. Done means direct and derivative JSR-303 annotations are reflected in affordances, including a consumable representation for multiple patterns.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100