Feature request: Option to remove _embedded from CollectionModel
See original GitHub issueToday, when returning a CollectionModel from any resource, it seems impossible to render it without _embedded
. It’s possible to disable the deserializer though, but it makes the field to be rendered as content
instead of _embedded
.
The purpose of this feature request would be, then, to wrap the elements in the content
field at all, and at the same time rendering the links field as usual.
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
How to remove the "_embedded" property in Spring HATEOAS
I close HAL feature, because it is hard to using Resources/Resource by restTemplate. I disable this feature by following code:
Read more >Spring HATEOAS - Reference Documentation
The representation can be enriched by a variety of embedded documents, which can be either arbitrary objects or HAL representations themselves ( ...
Read more >spring-projects/spring-hateoas - Gitter
Hi! I've got a little typing problem here. I got a WebTestClient and I use the kotlin extension for .returnResult<CollectionModel<AssignmentConfigurationModel>> ...
Read more >Remove _embedded in HATEOAS link using spring-boot-2.2 ...
I was able to remove the _embedded attribute by passing false as an argument to useHalAsDefaultJsonMediaType method in RepositoryRestConfiguration class.
Read more >How to Build Hypermedia API with Spring HATEOAS - Grape Up
We use HTTP methods instead of verbs describing actions, e.g., DELETE method instead of ... We can get a similar result when requesting...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The
_embedded
attribute is a requirement for collection when you render HAL.If you’re trying to get away from HAL, the simplest thing could be rendering directly, using Jackson, our types (
CollectionModel
,EntityModel
, etc.).That’s easy if you just register your own mediatype. Here’s an example:
This will register another mediatype, and basically clone the Jackson
ObjectMapper
, but without registering any special serializers. If you wish to register your own handlers for those types, look into the rest of theHypermediaMappingInformation
SPI.That would yield:
I’ve commented on the StackOverflow question.