Skip to content

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

Open
@alanpoulain

Description

@alanpoulain

Description
The PR #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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions