What about a simpler approach:
Let's create a class:
public class FooDto {
@NotNull
private final Foo foo;
public FooDto(Foo foo) {
this.foo = foo;
}
public String getName() {
return foo.name();
}
public String getDescription() {
return foo.getLabel();
}
}
And then in Controller:
@GetMapping
public ResponseEntity<Set<FooDto>> allOfFoo() {
return ResponseEntity.ok(EnumSet.allOf(Foo.class).stream().map(f -> new FooDto(f)).collect(Collectors.toSet()));
}