graphql-php
graphql-php copied to clipboard
Allow deprecation of input values
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!
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.
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! https://github.com/facebook/graphql/issues/197
@vladar I think this should be reopened now: https://github.com/graphql/graphql-spec/pull/525
This should be a great first PR, a relatively straightforward port of https://github.com/graphql/graphql-js/pull/2733. Any takers?
~Progress on this seems to hang on https://github.com/graphql/graphql-spec/pull/805 though.~ The specification now allows this.
Hello, @spawnia I've created a PR to resolve this issue: #1382
Thank you @TaProhm, released with https://github.com/webonyx/graphql-php/releases/tag/v15.4.0.