graphql-php

Custom map keys in GraphQL response

允我心安 提交于 2020-04-03 04:33:13
问题 I've been looking into GraphQL as a replacement for some REST APIs of mine, and while I think I've wrapped my head around the basics and like most of what I see so far, there's one important feature that seems to be missing. Let's say I've got a collection of items like this: { "id": "aaa", "name": "Item 1", ... } An application needs a map of all those objects, indexed by ID as such: { "allItems": { "aaa": { "name": "Item 1", ... }, "aab": { "name": "Item 2", ... } } } Every API I've ever

Custom map keys in GraphQL response

情到浓时终转凉″ 提交于 2020-04-03 04:31:41
问题 I've been looking into GraphQL as a replacement for some REST APIs of mine, and while I think I've wrapped my head around the basics and like most of what I see so far, there's one important feature that seems to be missing. Let's say I've got a collection of items like this: { "id": "aaa", "name": "Item 1", ... } An application needs a map of all those objects, indexed by ID as such: { "allItems": { "aaa": { "name": "Item 1", ... }, "aab": { "name": "Item 2", ... } } } Every API I've ever

Custom map keys in GraphQL response

為{幸葍}努か 提交于 2020-04-03 04:31:33
问题 I've been looking into GraphQL as a replacement for some REST APIs of mine, and while I think I've wrapped my head around the basics and like most of what I see so far, there's one important feature that seems to be missing. Let's say I've got a collection of items like this: { "id": "aaa", "name": "Item 1", ... } An application needs a map of all those objects, indexed by ID as such: { "allItems": { "aaa": { "name": "Item 1", ... }, "aab": { "name": "Item 2", ... } } } Every API I've ever

GraphQL GET response time is slow when comparing to RESTful

纵饮孤独 提交于 2020-03-14 11:09:06
问题 I wanted to test the response times of a GraphQL endpoint, and a RESTful endpoint as I haven't ever used GraphQL before, and I am about to use it in my next Laravel project. So I am using Lighthouse PHP package to serve a GraphQL endpoint from my Laravel app, and also I have created a RESTful endpoint. Both endpoints(GraphQL and RESTful) are intended to get all Users(250 users) from my local Database. So based on the test what I have noticed here is that, when I tested this both endpoints on

GraphQL GET response time is slow when comparing to RESTful

心已入冬 提交于 2020-03-14 11:08:57
问题 I wanted to test the response times of a GraphQL endpoint, and a RESTful endpoint as I haven't ever used GraphQL before, and I am about to use it in my next Laravel project. So I am using Lighthouse PHP package to serve a GraphQL endpoint from my Laravel app, and also I have created a RESTful endpoint. Both endpoints(GraphQL and RESTful) are intended to get all Users(250 users) from my local Database. So based on the test what I have noticed here is that, when I tested this both endpoints on

In Router.php line 366: Argument 1 passed to Illuminate\Routing\Router::group() must be of the type array,

懵懂的女人 提交于 2020-03-03 04:52:05
问题 I have update Laravel from v5.7 to v5.8 and now my application doesn't run. I updated it because of this issue: composer require rebing/graphql-laravel fails I solved the packages incompatibility but now Laravel crashes: $ php artisan serve In Router.php line 366: Argument 1 passed to Illuminate\Routing\Router::group() must be of the type array, string given, called in /var/www/masvino/Server-bak/vendor/laravel/framework/src/Illuminate/Support/Facades /Facade.php on line 239 I suspect that

How to query all the GraphQL type fields without writing a long query?

江枫思渺然 提交于 2019-12-29 11:31:52
问题 Assume you have a GraphQL type and it includes many fields. How to query all the fields without writing down a long query that includes the names of all the fields? For example, If I have these fields : public function fields() { return [ 'id' => [ 'type' => Type::nonNull(Type::string()), 'description' => 'The id of the user' ], 'username' => [ 'type' => Type::string(), 'description' => 'The email of user' ], 'count' => [ 'type' => Type::int(), 'description' => 'login count for the user' ] ];