Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow deprecation of input values (arguments and input fields) #110

Closed
simPod opened this issue Apr 11, 2017 · 6 comments · Fixed by #1382
Closed

Allow deprecation of input values (arguments and input fields) #110

simPod opened this issue Apr 11, 2017 · 6 comments · Fixed by #1382

Comments

@simPod
Copy link
Collaborator

simPod commented Apr 11, 2017

I haven't find anything about it in gql specs. Am I missing something?

private static function printInputObject(InputObjectType $type)
    {
        $fields = array_values($type->getFields());
        return self::printDescription($type) . 
            "input {$type->name} {\n" .
                implode("\n", array_map(function($f, $i) {
                    return self::printDescription($f, '  ', !$i) . '  ' . self::printInputValue($f);
                }, $fields, array_keys($fields))) . "\n" .
            "}";
    }

doesn't print deprecation reason vs

private static function printObject(ObjectType $type)
    {
        $interfaces = $type->getInterfaces();
        $implementedInterfaces = !empty($interfaces) ?
            ' implements ' . implode(', ', array_map(function($i) {
                return $i->name;
            }, $interfaces)) : '';
        return self::printDescription($type) .
            "type {$type->name}$implementedInterfaces {\n" .
                self::printFields($type) . "\n" .
            "}";
    }

private static function printFields($type)
    {
        $fields = array_values($type->getFields());
        return implode("\n", array_map(function($f, $i) {
                return self::printDescription($f, '  ', !$i) . '  ' .
                    $f->name . self::printArgs($f->args, '  ') . ': ' .
                    (string) $f->getType() . self::printDeprecated($f);
            }, $fields, array_keys($fields)));
    }

Thanks!

@vladar
Copy link
Member

vladar commented Apr 24, 2017

While it makes sense for me, but deprecation is not described for input object types in GraphQL specs (or reference implementation). So I guess this question should be first raised in spec repo.

I'll close it for now, but will track specs / reference implementation updates in this regard.

@vladar vladar closed this as completed Apr 24, 2017
@bginsburg
Copy link

bginsburg commented Nov 2, 2018

There is a PR that was created 9 days ago to handle deprecation of input fields.
Once it will be merged we can make the changes to this repo!
graphql/graphql-spec#197

@enumag
Copy link
Contributor

enumag commented Jan 11, 2021

@vladar I think this should be reopened now: graphql/graphql-spec#525

@spawnia spawnia changed the title Why there's no deprecationReason print for inputs? Allow deprecationReason for input values Jan 11, 2021
@spawnia spawnia reopened this Jan 11, 2021
@spawnia
Copy link
Collaborator

spawnia commented Jan 11, 2021

This should be a great first PR, a relatively straightforward port of graphql/graphql-js#2733. Any takers?

Progress on this seems to hang on graphql/graphql-spec#805 though. The specification now allows this.

@spawnia spawnia changed the title Allow deprecationReason for input values Allow deprecation of input values Jul 29, 2021
@spawnia spawnia changed the title Allow deprecation of input values Allow deprecation of input values (arguments and input fields) Feb 14, 2023
@TaProhm
Copy link
Contributor

TaProhm commented May 9, 2023

Hello, @spawnia
I've created a PR to resolve this issue: #1382

@spawnia
Copy link
Collaborator

spawnia commented May 11, 2023

Thank you @TaProhm, released with https://github.com/webonyx/graphql-php/releases/tag/v15.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants