-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Ideas for namespacing in schema #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm interested in sticking to the spec, which describes names as
|
Makes me think, maybe graphql-ruby should assert than any ObjectType's name matches the required pattern! |
I'm definitely in agreement with sticking to the spec, and I was actually surprised I was able to get it named with the "::" in the schema, so an assertion there would probably be useful. My thoughts were around modifying the GraphQLObjectType definition to be able to include an additional field allowing us to do a full class name. I think this was being discussed on the slack channel, I'll hop in there to continue discussion and close this when we reach a resolution. |
I've got the indexing of class names implemented (patterned after/reused the https://github.com/rosskevin/graphql-ruby/tree/namespaced-model-support |
PR #176 submitted passes tests and is verified working in the live environment. Usage for |
The solution given in issue #176 solves this problem. Closing issue. |
@bmcdaniel11 I'm looking for people that have experience wrapping Graphql In rails engines. can u contact me on [email protected]? thanks much! |
We run our integration of graphql out of a ruby engine, so the majority of our models are namespaced. We would like to continue the namespace pattern with queries/mutations but are finding it difficult.
For example, we have a model Person namespaced under engine Engine and would like to have the schema for the query type to match, ie name 'Engine::Person'. While the schema supports this syntax, any graphql request breaks when trying to pull a fragment to match the name. We have thought of multiple hacks to get around the issue, but were wondering if anyone had any ideas on how we could accomplish this cleanly. I added a bit of code below to illustrate the issue.
person.rb
person_type.rb
graphql request
This sets up the problem, as the fragment request breaks since it does not allow '::' in the syntax. We would like a clean way to have our schema represent our actual model structure and be able to query it as well. Any ideas would be great!
The text was updated successfully, but these errors were encountered: