-
Notifications
You must be signed in to change notification settings - Fork 15
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
JsonApiModelBuilder is not compatible with ReactiveRepresentationModelAssembler #61
Comments
The code does not compile because If you want to use an assembler to create representation models, you can easily build your own, like. public class MyAssembler {
public Mono<RepresentationModel<?>> toModel(final MyStupidDto entity, final ServerWebExchange exchange) {
return Mono.just(JsonApiModelBuilder.jsonApiModel().model(entity).build());
}
public Mono<RepresentationModel<?>> toCollectionModel(Flux<? extends MyStupidDto> entities, ServerWebExchange exchange) {
// use the builder here to create a JsonApiModel based on entities
}
} So why would you like to re-use |
You are right, that we can bypass But the fact |
@jimirocks yes, you are right, but the main reason for that is that those assembler interfaces were designed to work mostly with the build-in What I was actually thinking about was to create JsonApiModel wrappers to wrap JsonApiModels in EntityModels and CollectionModels, but unfortunatelly it turned to be way more complicated than expected... Since it is no blocker for you I would close this issue and think further about the wraping :) |
Ahh ha so that was the missing piece of puzzle to understand. Thank you for explanation. We will go with custom interface.... |
Just fyi, I filed an issue at Spring HATEOAS: |
As I commented on #59 (after close), I believe it should be possible to use
JsonApiModelBuilder
while implementingReactiveRepresentationModelAssembler
but it's not. See the code, which can't compile on the class declaration:I see two possible solutions:
JsonApiModel
public - as suggested in Make JsonApiModel public #59ReactiveRepresentationModelAssembler
to<T, D extends RepresentationModel<?>>
from<T, D extends RepresentationModel<D>>
The text was updated successfully, but these errors were encountered: