ByteCode.News
Submit RSS Atom Sign in

Back to the channels

#java

  1. deebo anyone happen to use spring-data-rest? is there some existing class in some spring library for deserializing json from the "weird" { "_embedded": { "resultTypes": [...] } response?
  2. deebo -> config.useHalAsDefaultJsonMediaType(false) -> everyone started clapping
  3. Para ~gpt summarize what jackson's config.useHalAsDefaultJsonMediaType means and what does it do in context of spring-data-rest, including what is "hal"
  4. javabot In Spring Data REST, Jackson's `config.useHalAsDefaultJsonMediaType` is a configuration property that sets 'HAL' as the default media type for JSON responses. 'HAL' stands for Hypertext Application Language, a standard which structures API responses to contain not just data, but also hyperlinks for accessing related data. Using it helps to decouple client from server, easing the evolution of the RESTful API.
  5. Para Sounds like SOAP but worse tbh.
  6. deebo HATEOAS psychosis
  7. Para Well, at least "hate" is built in...
  8. deebo i just want to stop writing controller -> service -> repository crud, but spring-data-rest wants to produce something that's meant for 2005 i guess
  9. deebo don't think i've ever seen a "real" rest/hateoas/whatever api in the wild
  10. NeXeN deebo: consume the standard rest/hal api. shouldn't be writing custom json parsers. CollectionModel<T> would map directly to a collection response wrapped in _embedded, EntityModel<T> map to a single resource wrapped in hypermida links, then of course PageModel<T> maps pagged metadata like page, size, totalElements.
  11. NeXeN you know instead of using basic http client or standard jackson mapping, WebClient or RestTemplate or traverson
  12. NeXeN https://docs.spring.io/spring-hateoas/docs/current/reference/html/#client
  13. javabot NeXeN's title: "Spring HATEOAS - Reference Documentation"
  14. NeXeN i just feel like custom json parsers are an anti-pattern, *shrug*
  15. NeXeN if you just want standard crud, spring mvc controllers are better imho
  16. deebo .. its not custom anything? i'm just disabling the HAL/HATEOAS style response generation, so the responses area always plain application/json
  17. deebo but it's anyhow looking like i need to ditch this, seems it's forcing GET usage for search apis, which means you hit the url size limit with very few params in our case
  18. Para deebo: fwiw use idea's live templates :D
  19. Para Write your get controller handle as parameterized live template, allow the intelligent autocomplete to produce gaps, fill the gaps, repeat for service/repo, write the actual bits which are missing.
  20. deebo yeah already quickly wrote data-rest out, just have to find a generic way since all these repositories are just save + findById(s) + find(Pageable)