api-platform / api-platform/core
[GraphQL] ID field is added although not specified
- 主要語言
- PHP
- 星號
- 2.6k
- 分支
- 980
- 平均合併
- 2 天 5 小時
- 30 天內合併 PR
- 48
描述
**API Platform version(s) affected**: 3.1.2
**Description**
When defining a new type, an ID field is automatically added to the generate schema. This should not be the case.
**How to reproduce**
Take the following entity as example:
**Entity**
```php
#[
API\ApiResource(
graphQlOperations: [
new Query(
args: [],
),
]
)
]
class Service
{
#[
API\ApiProperty(identifier: true),
Assert\NotNull,
]
private string $name = "abc-123";
#[
Assert\NotNull,
]
private string $version = "0.1.0";
#[
Assert\NotNull,
]
private string $schema = "";
// .. getter/setter
}
```
This generates the following schema

As you can see, the ID is in the schema but it is not defined. An external service is checking this schema, and does not allow this field to be there.
**Possible Solution**
A new type can be configure to not implement the `Node` interface. That is where the `id` fiel is coming from.
**Additional Context**
-
貢獻指南
評估
這個 Issue 還沒有評估資料。