api-platform / api-platform/core

[GraphQL] Add a `visibily` attribute in `ApiProperty` to hide fields depending on the context

オープン
#3,279 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
GraphQL
主要言語
PHP
スター
2.6k
フォーク
980
平均マージ
2日 4時間
マージ済み PR(30日)
49

説明

**Description**
The PR https://github.com/api-platform/core/pull/3227 has added a `security` attribute in `ApiProperty` for not using a property if it is not allowed.

If the user wants to hide the field completely from the GraphQL schema, we could introduce a `visibility` attribute like GraphQL Ruby does (https://graphql-ruby.org/authorization/visibility).

For REST, it could have the same effect as the `security` attribute.

**Example**
```php
class Offer
{
/**
* @var string The dummy secret property, only readable/writable by specific users
*
* @ApiProperty(visibility="is_granted('ROLE_ADMIN')")
*/
private $adminOnlyProperty;
}
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。