You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: mutation must have unique named fields from objectbrick #894
Mutation is possible by calling the fields by either only their code e.g. foo or with the objec obrick as a prefix e.g. ObjectBrickFoo.foo
Actual behavior
gives an error because the label is picked and set in the scema.
Steps to reproduce
Create a Class (MyClass)
Create a object brick (ObjectBrickFoo), with a datatype table (code: foo, label: table)
Create another object brick (ObjectBrickBar), with a datatype table (code: bar, label: table)
link both the object bricks to the class.
open mutation schema and setup the fields of the class (ObjectBrickFoo.foo and ObjectBrickBar.bar)
fire a mutation and recieve error:
{
"errors": [
{
"message": "Schema must contain unique named types but contains multiple types named \"TableInput\" (see [Introduction - graphql-php](https://webonyx.github.io/graphql-php/type-definitions/#type-registry).) "
}
]
}
This problem is also present in "Image Gallery" and can be fixed analogically.
Basically, if you reuse the same "name" you should make sure to also use the exact same instance. Originally for each new field of type "Table" or "Image gallery" new instance of InputObjectType was created. And if different instances share the same "name", then: \GraphQL\Utils\TypeInfo::extractTypes throws an exception.
Thanks a lot for reporting the issue. We did not consider the issue as "Pimcore:Priority", "Pimcore:ToDo" or "Pimcore:Backlog", so we're not going to work on that anytime soon. Please create a pull request to fix the issue if this is a bug report. We'll then review it as quickly as possible. If you're interested in contributing a feature, please contact us first here before creating a pull request. We'll then decide whether we'd accept it or not. Thanks for your understanding.
Activity
br33f commentedon Oct 24, 2024
Does anyone have a workaround for this one?
br33f commentedon Oct 25, 2024
@LeonNoBears
Here is how I fixed this problem (at least temporarly):
In file
\Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectMutationFieldConfigGenerator\Table::getGraphQlMutationFieldConfigThis problem is also present in "Image Gallery" and can be fixed analogically.
Basically, if you reuse the same "name" you should make sure to also use the exact same instance. Originally for each new field of type "Table" or "Image gallery" new instance of InputObjectType was created. And if different instances share the same "name", then:
\GraphQL\Utils\TypeInfo::extractTypesthrows an exception.github-actions commentedon Nov 15, 2024
Thanks a lot for reporting the issue. We did not consider the issue as "Pimcore:Priority", "Pimcore:ToDo" or "Pimcore:Backlog", so we're not going to work on that anytime soon. Please create a pull request to fix the issue if this is a bug report. We'll then review it as quickly as possible. If you're interested in contributing a feature, please contact us first here before creating a pull request. We'll then decide whether we'd accept it or not. Thanks for your understanding.