Skip to content

Array input #550

Closed
Closed

Description

@drmax24

Do we have a simple way to define a simple array of scalars in the input handler?

Here is an example of laravel rebing/graphql query arguments.
I have an argument named ids that is an array of ids
I can easily define an array input without creating a custom input type.

    public function args(): array
    {
        return [
            'ids'                   => [
                'type' => Type::listOf(Type::int()),
            ],

Do we have anything similar?

Activity

  1. drmax24 commented on Jan 23, 2023

    @drmax24
    Author

    It kinda works. But how to make ids argument to be optional?

        /**
         * @param string[] $ids
         */
        #[Query(
            name: 'groups',
            outputType: '[CommunityGroup]',
        )]
        public function resolve(?array $ids = null, int $offset = 0, int $limit = 10): \Generator
    

    ids is not optional in graphql schema

  2. locked and limited conversation to collaborators on Jan 23, 2023
  3. converted this issue into a discussion #551 on Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions