mathsgod/gql-scalar-email

graphql scalar email

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

pkg:composer/mathsgod/gql-scalar-email

1.0.3 2019-10-31 08:23 UTC

This package is auto-updated.

Last update: 2025-09-29 02:28:36 UTC


README

    
    $gql = "
scalar Email
type Query{
    test(email:Email):Email
}      
";

   $typeConfigDecorator = function ($typeConfig) {
        $name = $typeConfig['name'];

        if ($name === 'Email') {
            $email = new Scalar\Email();

            $typeConfig["serialize"] = [$email, "serialize"];
            $typeConfig["parseLiteral"] = [$email, "parseLiteral"];
        }
        return $typeConfig;
    };

    $schema = BuildSchema::build($gql, $typeConfigDecorator);