Skip to content

OpenApi Schemas for errors/violations do not match actual response #7080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
BernardA opened this issue Apr 11, 2025 · 1 comment
Open

OpenApi Schemas for errors/violations do not match actual response #7080

BernardA opened this issue Apr 11, 2025 · 1 comment
Labels

Comments

@BernardA
Copy link

API Platform version(s) affected: 4.1.1

Description

I found that two new schemas were added: Error and ConstraintViolation. The actual errors do not seem to match:

ConstraintViolation:
The property "instance" exists on OpenApi but not on the actual violation, while "code" and "hint" exist on the actual "violations" but not on OpenApi.

OpenApi:

Image

Actual:

 `{
 "status": 422,
  "violations": [
  {
      "propertyPath": "societe",
      "message": "This value should be of type App\\Entity\\Societe.",
      "code": "ba785a8c-82cb-4283-967c-3cf342181b40",
     "hint": "Item not found for \"/api/lecture/societes/038757282\"."
    }
  ],
  "detail": "societe: This value should be of type App\\Entity\\Societe.",
  "type": "/validation_errors/ba785a8c-82cb-4283-967c-3cf342181b40",
  "title": "An error occurred"
  }`

Error

On error the property "instance" exists on OpenApi but not on the actual response:

OpenApi:

Image

Actual:

 `{
  "title": "An error occurred",
  "detail": "Societe inexistante.",
  "status": 400,
  "type": "/errors/400"
 }`

How to reproduce

Possible Solution

Additional Context

@soyuka
Copy link
Member

soyuka commented May 5, 2025

#6960

@soyuka soyuka added the bug label May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants