Comments (7)
Thanks for noticing that. I'm in the process of writing Unit Tests and while I'm doing it, I came accross this irregularity. In my opinion, the name you put in the config should have precedence on the name in the Query, so you could overwrite it and even uses the same Query two times with different name. This is what I'm going to implement for Query, Mutation and Type. So everything works the same.
What you think?
from laravel-graphql.
Hey, thanks for your quick reply. I think the most important thing is that there is one single source of truth (because now both values are used). It doesn't matter that much to me which one gets the precedence but I do have a couple of questions about what you said.
1.
In my opinion, the name you put in the config should have precedence on the name in the Query, so you could overwrite it ...
.
If you want to override the value form the config that means that normally you don't specify the name in the config. But usually you specify the key all the time when you add a query.
'schema' => [
'usersQuery' => 'App\GraphQL\Query\UsersQuery',
]
so if you want to leave that out you might want to add a way to add queries in non-associative arrays and then have the name taken from the name prop of each query object.
'schema' => [
'App\GraphQL\Query\UsersQuery',
]
From the source code it didn't look like non-associative arrays are already implemented. So I think you should implement that or do it the other way around, namely use the name prop in the Object to override the key in the config(I think this is already implemented for types in the addType()
method). It could be done analogous to that. I hope I don;t sound too confusing :-) What do you think?
2.
... and even uses the same Query two times with different name.
I think using the same query with the different name is not necessary and leads to confusion since I believe the query name should be somewhat unique throughout the GraphQL Service. Or do you have a specific reason for that?
from laravel-graphql.
Hey @dmongeau do you have any more thoughts on my reply? Do you have a rough time frame when this fix will be available in the future?
from laravel-graphql.
Right now it is available on the v1 branch, I'm finishing the unit tests. You can test if the behavior is what you expected. Let me know.
Should be released in a week!
from laravel-graphql.
Ah cool I will check it out.
from laravel-graphql.
So I installed the version v1.x-dev
from composer and tried it out. Works, really well.
The only think I could add is that this you could add to the readme which name takes precedence but other than that the version looks really nice overall. Good work. 👍
from laravel-graphql.
I guess I can close this issue. Since the changes with be merged soon.
from laravel-graphql.
Related Issues (20)
- What does the parameters of resolve($root, $args, SelectFields $fields, ResolveInfo $info) method mean? HOT 1
- Create new release for laravel 5.7 to pin version HOT 2
- How to cache query result together with relations HOT 1
- Testing coverage with GraphQL is always return 0% HOT 2
- Could not publish configuration file HOT 14
- How to use GraphQL UnionType?? HOT 2
- Query Variables Empty HOT 3
- Laravel 5.7 support HOT 1
- how to set depth for each query HOT 1
- How to output paging data? HOT 2
- Help needed - resolve call to microservice(s) HOT 2
- passing some extra value from GraphQLController@query method to Folklore\GraphQL\Support\Mutation@resolve? HOT 8
- What is the format for config/graphql.php middleware array? HOT 1
- feature/relay branch add support to Laravel 5.7
- Create contracts Type to use in all Graph type
- default (abstract) queries and mutations "crud"
- How to pass meta data to the Type? HOT 1
- query and mutation executing twice HOT 2
- Not compatible with PHP 7.3 HOT 1
- GraphQL Error: Variable of type "String" used in position expecting type "String!" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-graphql.