-
-
Notifications
You must be signed in to change notification settings - Fork 935
Description
API Platform version(s) affected: 2.5.5
Description
I'm creating this ticket to give more visibility and context to #3381. Current behavior of API Platform is to ignore the fact that a field is required if it is not writtable.
While this makes sense for write operations, it prevents having strong generated types on clients, as, for instance, a generated ID may be required (in a sense that it is not nullable nor indefinable) but not expected on a POST operation.
I consequently believe that the right way to handle this situation is to handle serialization groups by indicating that the ID should not be POSTed, but is however required (= defined) for GET operations.
How to reproduce
Create an entity with a backend generated ID, inspect OpenAPI generated types, the field is not marked as required as it would be expected.
Possible Solution
See #3381.