Closed
Description
Hi, thanks for creating GraphQLite!
I have an issue when creating an Input Type - if we use introspection to inspect it the fields are always null
.
I have tried creating an Input Type using the @Factory
annotation, like so:
use TheCodingMachine\GraphQLite\Annotations\Factory;
class AddressInputType
{
/**
* @Factory(name="AddressInput", default=true)
*
* @param string $line1
* @param string $postcode
*
* @return Address
*/
public function createAddress(string $line1, string $postcode): Address
{
$address = new Address();
$address->setLine1($line1);
$address->setPostcode($postcode);
return $address;
}
}
And also using the @Input
annotation from @devmaslov's PR (#269), like so:
use TheCodingMachine\GraphQLite\Annotations\Field;
use TheCodingMachine\GraphQLite\Annotations\Input;
/**
* @Input(name="AddressInput", update=true)
*/
class AddressInputType
{
/**
* @Field()
*
* @var string
*/
public string $line1;
/**
* @Field()
*
* @var string
*/
public string $postcode;
}
But, when POSTing the following introspection query:
query {
__type(name: "AddressInput") {
name,
fields {
name,
type {
name
kind
}
}
}
}
The response is:
{
"data": {
"__type": {
"name": "AddressInput",
"fields": null
}
}
}
Is this is a bug, or am I doing something incorrectly here?
I can see the fields are being detected and added to the Input Type in InputTypeGenerator.php
at line ~66 (mapInput()
) but it looks like somewhere down the call-stack the fields are being set to null.
Any advice would be highly appreciated!
Metadata
Metadata
Assignees
Labels
No labels