api-platform / api-platform/core

[OpenAPI/Hydra] Validation error schema should be generated

Đang mở
#4,480 1 bình luận 5 reaction 0 người được giao Xem trên GitHub
Hacktoberfest OpenAPI
Ngôn ngữ chính
PHP
Star
2.6k
Fork
980
Merge trung bình
2 ngày 4 giờ
Pull request đã merge (30 ngày)
49

Mô tả

**Description**

In `OpenApiFactory`, the schema is not generated for the validation error (422):
https://github.com/api-platform/core/blob/e649fa1507963102fddb339458a82c426240553b/src/OpenApi/Factory/OpenApiFactory.php#L227

It would be nice to add it at least for Hydra.
Hydra normalizes the validation error like this:
https://github.com/api-platform/core/blob/e649fa1507963102fddb339458a82c426240553b/src/Core/Hydra/Serializer/ConstraintViolationListNormalizer.php#L46-L50

One way to implement it would be to add a new schema type, like `TYPE_VALIDATION_ERROR` here:
https://github.com/api-platform/core/blob/e649fa1507963102fddb339458a82c426240553b/src/Core/JsonSchema/Schema.php#L30-L31

And handle this new type in this method:
https://github.com/api-platform/core/blob/e649fa1507963102fddb339458a82c426240553b/src/Core/Hydra/JsonSchema/SchemaFactory.php#L73

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.