mathsgod/gql-scalar-email

graphql scalar email

Maintainers

Package info

github.com/mathsgod/gql-scalar-email

pkg:composer/mathsgod/gql-scalar-email

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.3 2019-10-31 08:23 UTC

This package is auto-updated.

Last update: 2026-03-01 00:13:33 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);