vaadin / hilla

Build better business applications, faster. No more juggling REST endpoints or deciphering GraphQL queries. Hilla seamlessly connects Spring Boot and React to accelerate application development.
https://hilla.dev
Apache License 2.0
921 stars 58 forks source link

Consider changing the response format for VaadinConnectException to use the RFC7807 standard #349

Open vlukashov opened 4 years ago

vlukashov commented 4 years ago

When calling Vaadin Service methods, Connect validates the parameters passed to the server-side (based on the JSR-380 spec. If validation fails the error details are propagated to the client side using Connect's custom protocol based on the VaadinConnectException class (see https://github.com/vaadin/vaadin-connect/blob/master/doc/vaadin-connect-exceptions.asciidoc).

There is an RFC that aims at standardizing this scenario: RFC 7807 - Problem Details for HTTP APIs.

Vaadin should consider changing the approach to passing validation error details over HTTP to the client-side so that it uses the RFC instead of the own custom implementation.

Keeping aside the generic 'following standards is better than not following' mantra, some immediate benefits from following this RFC in this case may be

knoobie commented 2 years ago

@Legioth Nice ping that RFC-7807 is very likely included in the error handling in spring 6 / spring boot 3 - I think it would be really good to get familiar with the concept and adapt it in Hilla if feasible

Legioth commented 2 months ago

Example on how to use this in Spring MVC: https://www.baeldung.com/spring-boot-return-errors-problemdetail