Arguments description in schema
downace opened this issue · comments
Currently description is not supported for fields arguments.
I've tried to implement my own parameter middleware which takes description from the DocBlock:
// snip
if ($mappedParameter instanceof InputTypeParameter) {
$paramTag = \Arr::first(
$docBlock->getTagsByName('param'),
fn(Param $paramTag) => $paramTag->getVariableName() === $parameter->getName(),
);
$desc = (string) $paramTag?->getDescription();
$mappedParameter->setDescription($desc);
}
// snip
Expected result example
class ProductController {
/**
* @param ID $id The product id
*/
#[Query]
public function product(ID $id): Product {
// ...
}
}
type Query {
product(
"The product id"
id: ID!
): Product!
}
But it's not working. I found that parameter description is ignored when creating QueryField from Descriptor, here:
graphqlite/src/InputTypeUtils.php
Lines 115 to 124 in 8d6a292
@downace a PR would be welcomed for support. Does this include output type fields? An implementation should cover all fields, not just input type fields.
@downace a PR would be welcomed for support
Sure, working on it.
Does this include output type fields? An implementation should cover all fields, not just input type fields.
AFAIK, descriptions are currently supported everywhere (via DocBlocks or annotation's description
parameter) except fields arguments.
AFAIK, descriptions are currently supported everywhere (via DocBlocks or annotation's
description
parameter) except fields arguments.
Yes, but fields can have arguments for input and output types, and those are two different types, which have different type mappers IIRC.