-
-
Notifications
You must be signed in to change notification settings - Fork 933
GraphQL: Consider writable attribute for nested objects #5954
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
Conversation
#[ORM\Column(nullable: true)] | ||
public $nonWritableProp; | ||
|
||
#[ApiProperty(readableLink: true, writableLink: true)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aren't these true already? maybe you should specify serialization groups instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunatelly they are not true
by default. If not setting these attributes, there will be a skolem IRI in the JSON instead.
It would be a great behaviour for Embeddables to treat them more like properties than relations. Could you assist in working on that? But I would recommend to tackle this in a separate issue and PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
embeddables were hard to handle previously because if they're marked as a resource the behavior was different. Now I think it'd be possible to do this indeed. agree for another pr
054d90d
to
4215fde
Compare
the changes in the entity breaks an unrelated test, best would be to create a new entity for this test case (https://github.com/api-platform/core/blob/main/CONTRIBUTING.md#tests) |
a32443d
to
298f4ed
Compare
298f4ed
to
545db3e
Compare
Fixed it. The other failing tests seem to be already broken in the 3.2 source branch |
thanks! |
We use Doctrine Embeddables in our project. So we also have mutations that contain nested objects. To exclude some properties from beeing modified the
writable: false
option works fine. But this only worked on the rool level. For nested objects this got ignored. This PR is there to fix that and considerwritable: false
also for nested objects.I invested much in writing behat tests that provide a detailed understanding of the issue.