api-platform / admin

A beautiful and fully-featured administration interface builder for hypermedia APIs
https://api-platform.com/docs/admin/
MIT License
480 stars 130 forks source link

Validation errors are shown as "Server communication error" #488

Closed denisvmedia closed 9 months ago

denisvmedia commented 1 year ago

API Platform version(s) affected: 3.4.3

Description

I'm trying to submit a form that returns validation errors. The errors are properly highlighted in the form, but the main message says "Server communication error" (which is confusing).

Hydra response has proper fields set:

@context: "/api/contexts/ConstraintViolationList"
@type: "ConstraintViolationList"
hydra:title: "An error occurred"
hydra:description: "purchasePrice: A valid number is expected\ncurrentValue: A valid number is expected"

How to reproduce

Just use Hydra and submit a form with a server-side validation failure.

Possible Solution

I think, hydra:title (and maybe hydra:description) should be used instead of Server communication error message. And in general, 4xx statuses are probably not server communication errors.

Additional Context

This can be also seen on the official Admin demo:

image

papppeter commented 10 months ago

@denisvmedia did you managed to solve it? We are facing the same problem.

denisvmedia commented 10 months ago

@papppeter honestly, I don't remember now. But most likely not. Unfortunately, this project seems to be rather dead than alive.

papppeter commented 10 months ago

@alanpoulain do you have maybe any suggestion here? it would be really nice to see if this package is still alive?

Or is there any other hydra data provider to react admin on github to use?

s-fog commented 9 months ago

Please, maybe someone fix this issue ?

alanpoulain commented 9 months ago

See https://github.com/api-platform/admin/pull/515

s-fog commented 9 months ago

Merge request still not is repository :(

Thanks!