spring-projects / spring-data-rest

Simplifies building hypermedia-driven REST web services on top of Spring Data repositories
https://spring.io/projects/spring-data-rest
Apache License 2.0
921 stars 563 forks source link

Use JSON instead HAL in 3.6 version for projection #2132

Open iatomatt opened 2 years ago

iatomatt commented 2 years ago

Hello. My problem is that I got response in HAL format for projections (Entity's are in JSON) using spring boot + data-rest. My project configuration include next params:

spring: data: rest: default-media-type: application/json hateoas: use-hal-as-default-json-media-type: false

I've got answer from endpoint in format like:

{ "dateIn": "2021-10-25T10:43:32.021", "stopList": "1", "devicesInfo": [ { "id": 2, "ipAddress": "192.167.1.1", "countryCode": "643", "deviceType": "web", "deviceName": "Dell ", "deviceModel": "G5 3500" } ], "links": [ { "rel": "self", "href": "http://localhost/api/afNonPayments/1" }, { "rel": "afNonPayment", "href": "http://localhost/api/afNonPayments/1{?projection}" } ] } The devicesInfo section is the simple entity, and there is no links attribute. But the full object is projection, and its JSON representation contains links section, which I want to remove. Is any way to make it?

tmc9031 commented 2 years ago

I also want to disable HAL format simply !!! Please maintainer provide one selection for plain JSON, thanks :) But look like NOT clear way to close HAL ??? spring-boot#26814