Skip to content

Instantly share code, notes, and snippets.

@rzymek
Last active December 23, 2020 14:08
Show Gist options
  • Save rzymek/9ce09c67fb9edbada0f02468689cc63a to your computer and use it in GitHub Desktop.
Save rzymek/9ce09c67fb9edbada0f02468689cc63a to your computer and use it in GitHub Desktop.
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
@RestController
@RequestMapping("/users")
class UserResource {
@GetMapping()
List<User> allUsers() { /* ... */ }
static class User {
@NotNull
public String email;
public String firstName;
@ApiModelProperty(notes = "User's surname")
public String lastName;
@NotNull
public EnumSet<Role> roles;
}
enum Role {
USER, ADMIN
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment