Skip to content

Schema #22

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

Closed
schloerke opened this issue Dec 10, 2015 · 11 comments · Fixed by #45
Closed

Schema #22

schloerke opened this issue Dec 10, 2015 · 11 comments · Fixed by #45

Comments

@schloerke
Copy link
Contributor

Great package! Allows me to parse queries very quickly and easily!

Will schema parsing be added to this repo (written in c or cpp)? I can see graphql.js has a schema parser here: http://graphql.org/docs/api-reference-schema-language/

My motivation is to do something similar to https://github.com/matthewmueller/graph.ql but with another language.

Thank you,
Barret

@aarvay
Copy link
Contributor

aarvay commented Dec 10, 2015

Defining and parsing schema is an implementation's job as each implementation will have its own better way of doing it, mostly based on what the language the implementation is written in, offers.

However, there're actually quite a lot of the language spec that needs to be implemented here.
For a start, this test needs to get passed.

@schloerke
Copy link
Contributor Author

Fair.

You're correct. It doesn't like the kitchen sink. :-(
So what you're saying is that I should look elsewhere for an query parser, as this one is not complete? I really enjoy the json output that you provide.

@swolchok
Copy link
Contributor

swolchok commented Jan 4, 2016

It doesn't like the kitchen sink. :-(

Hmm, that's strange. I missed this bug report because this issue is marked as being about schema parsing and I was busy with end-of-year stuff. I'll look into why the kitchen sink test is failing.

@swolchok
Copy link
Contributor

swolchok commented Jan 4, 2016

Found the problem: graphql/graphql-js@3f1f9f5 broke us. Working on a fix.

@swolchok
Copy link
Contributor

swolchok commented Jan 4, 2016

8feed9c fixes parsing of kitchen-sink.graphql.

As to the original question about adding schema parsing to this project, I would take a patch that added schema parsing so long as it could be disabled at build time (and, probably, was disabled by default), but I probably won't add it myself.

Here's my underlying philosophy on why it should be optional: The main reason to do a C++ implementation of anything, in my opinion, is performance, and the main environment where I expect high-performance GraphQL parsing to matter is server-side. Servers probably don't need to parse the schema language, at least not after startup, and they very probably should not accept schema definitions as part of incoming queries.

@swolchok swolchok closed this as completed Jan 4, 2016
@swolchok
Copy link
Contributor

swolchok commented Jan 4, 2016

By the way, if you find more spec-compliance bugs in libgraphqlparser, please report them and I will fix them quickly! I consider them to be very serious; this one just slipped through the cracks. :(

@schloerke
Copy link
Contributor Author

Thank you for the fix!

(small) Rebuttal for the schema... It is fairly easy for me to call C++ that returns JSON and parse the JSON output. It is MUCH more difficult to create / maintain a text parser to parse the schema in a language that hates strings. Yes, parsing the schema's would only be done once, but it'd be done with the same mechanism (or something similar) as the queries.

Unfortunately, my C++ skills are not up to this level... so we'll leave it as it. ;-)

@swolchok
Copy link
Contributor

swolchok commented Jan 4, 2016

Hmm, that is a good point. I will have to think more about implementing schema parsing; reopening to track.

@swolchok swolchok reopened this Jan 4, 2016
@aarvay
Copy link
Contributor

aarvay commented Jan 5, 2016

Thanks for the fix. And I concur with @swolchok, regarding supporting schema parsing. Schema definitions can take its own form. It needn't be "strings"! :)

@rivanov2
Copy link

rivanov2 commented Dec 16, 2016

@swolchok Hi,

First of all, thank you for making this fantastic library.

I'm currently in a position that necessitates me to write a schema parser, or a whole ODB wrapper.
My intention was to use ODB -> postgraphql -> schema parser (custom) -> libgraphql -> restbed to implement a graphql-server.

Any ideas whether or not you'll be implementing a schema-parser? I'd love to contribute my implementation to this project when it's complete.

Cheers!

@swolchok swolchok mentioned this issue Dec 24, 2016
6 tasks
@swolchok
Copy link
Contributor

#45 seems to be working, but I'm waiting for the holiday season to end before merging it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants