api-platform / api-platform/core

Error: "Type with id \"createAuthorNestedInput\" is not present in the types container",

未關閉
#8,068 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
GraphQL
主要語言
PHP
星號
2.6k
分支
980
平均合併
2 天 4 小時
30 天內合併 PR
49

描述

**API Platform version(s) affected**: 3.0.9

**Description**
Graphql nested mutation throws error. I am following the docs about nested mutations https://api-platform.com/docs/main/core/graphql/#embedded-relation-input-creation-of-relation-in-mutation

The example **works** on my entities, but when I want to create a function for the mutation and pass the required types for my nested input as arguments, I get the graphql response:

`"Type with id \"createAuthorNestedInput\" is not present in the types container",`

The Book->Author Relation is a OneToMany relation:
#[ORM\OneToMany(mappedBy: 'book', targetEntity: Author::class, cascade: ['persist'])]
#[Groups(['book:create'])]
private Collection $authors;

My mutation looks like this:
`mutation createBook($title: String!, $authors: [createAuthorNestedInput!]!) {
createBook(input: {title: $title, authors: $authors}) {
book {
title
authors {
edges {
node {
name
}
}
}
}
}
}`

and my variables:
`{
"title": "test",
"authors": [
{
"name": "test"
}
]
}`

**How to reproduce**
You can clone this github:
https://github.com/Basti271/api-platform-bug-mutation

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。