-
Hi, my query look like:
I expected for
Thanks for your help |
Beta Was this translation helpful? Give feedback.
Answered by
matasarei
Apr 27, 2023
Replies: 1 comment 1 reply
-
Its long time but anyway here is possible solution: class KeyValue extends ObjectType
{
public function __construct()
{
parent::__construct([
'name' => 'KeyValue',
'fields' => [
'key' => [
'type' => Type::nonNull(Type::string()),
'resolve' => static fn($rootValue) => $rootValue['key'],
],
'value' => [
'type' => Type::nonNull(Type::string()),
'resolve' => static fn($rootValue) => $rootValue['value'],
],
],
]);
}
} In your type add a new field: 'fields' => [
'list' => [
'type' => Type::listOf(new KeyValue()),
'resolve' => static function() {
return [
[
'key' => 'foo',
'value' => 'bar'
]
];
}
]
],
... will result:
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
spawnia
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Its long time but anyway here is possible solution:
In your type add a new field: