-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Adding properties to entities named "<entity name>Id" cause issues when nesting relationship fields #18085
Comments
can you pls suggest the path or files in which i have to make changes ? |
Hello @cody-fjorge, Thank you for reporting this bug, however we are unable to reproduce the issue you described given the information we have on hand. Can you please create a fresh project that you are able to reproduce the issue in, provide clear steps to reproduce this issue, and either upload this fresh project to a new GitHub repo or compress it into a We would greatly appreciate your assistance with this, by working in a fresh project it will cut out any possible variables that might be unrelated. Thank you! |
Tryed to reproduce the issue but I got the output like I expected
|
Getting this issue too. My attribute is "formId" and the REST API only ever returns "1" for the value when it's retrieved through a relationship in a dynamic zone component. |
Mind giving me the content type like you use it with replication staps? |
This looks like you didn't setup the fields correctly from my reproduction steps since there is no field named Id (ex. shirtId if the entity is named shirt). |
I see now I am closing it since there is a tracking issue for this. #16222 |
I'm able to reproduce it on v4.20.4. Here is the content-type schema I used: {
"kind": "collectionType",
"collectionName": "shirts",
"info": {
"singularName": "shirt",
"pluralName": "shirts",
"displayName": "shirt",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"shirtId": {
"type": "string"
},
"variants": {
"type": "relation",
"relation": "oneToMany",
"target": "api::shirt.shirt",
"mappedBy": "variantOf"
},
"variantOf": {
"type": "relation",
"relation": "manyToOne",
"target": "api::shirt.shirt",
"inversedBy": "variants"
}
}
} You need two entries with the relation set on one of them: Here is the request you need to make: Response payload: |
Bug report
Required System information
Describe the bug
Adding a property to an entity with the name of "Id" that also has a relationship property to the same entity, when getting results from the api if you try to read the value of Id of the parent from inside the child the value will be the row ID of the child.
Steps to reproduce the behavior
When pulling results from the api:
Expected behavior
The Id field should be correct when looking at the parent data from the child
Additional context
If this shirtId property is changed to something like "shirtUid" the bug does not happen.
The text was updated successfully, but these errors were encountered: