Skip to content

One liner shorthand for field definition? #47

@feihe-houzz

Description

@feihe-houzz

Currently for field (such as currency in below example), only array type definition is allowed (has to be an array within which defines a "type"). In other GraphQL implementations such as https://github.com/Youshido/GraphQL, a simpler shorthand like this is allowed:

Proposed
'currency' => Type::string()

Current

      $ProductType = new ObjectType([
            'name' => 'Product',
            'fields' => [
                'title'         => [
                    'type' => Type::string()
                ],
                'priceStr'      => [
                    'type' => Type::string()
                ],
                'currency'      => [
                    'type' => Type::string()
                ]
            ]
        ]);

I have a rough code change that can convert to a pull request, if more ppl find it handy.

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