Comments (9)
Hi @ptomasroos,
Could you link me to the c lib that facebook provides?
from graphql.
Hey @chris-ramon
This is the library I meant.
https://github.com/graphql/libgraphqlparser
from graphql.
Thanks @ptomasroos !
Definitely we could had figure-out how and depend on the c parser lib and ofc gain all the advantages that brings it.
I think having no dependencies it allow us to move faster, have light-weight lib, and do not have to deal with c-to-go, go-to-c trips.
And we have already a working parser passing all the tests from graphql-js
.
from graphql.
I think the sad part is that you will loose all the benefits facebook will make to that c library which will receive updates from nodejs, ruby, python and all of the other languages who are doing wrappers around it, plus its a enormous waste of time for you. Not trying to bash on you, its more that:
The moment you loose focus on this the entire community looses because now the entire community stands with a maintainability of something that might accelerate very fast on the source. I've seen this happen to a lot of projects when it comes to specially golang. Where ppl try to port wire formats and do it a "pure-way". CGO is seriously good and one of the biggest benefits i see with golang tbh. The ability to reuse.
What kind of features would ever be needed thats not supported out of the spec? And why wouldnt that be possible to be added on higher level?
There is nothing more reliable and lightweight than a c lib which does memory mgmt in the correct way. I can proove that the lib/pq is 4.000m after the wrapped c library which hasnt been updated for 6 years because there is no errors, no correct fault handling ect.
Its def up to you. But rewriting something will almost never ever make something better if its constrained by the source project anyhow. Just my cents. Not trying to sound like a douche.
CGO is no real problem to day.
from graphql.
@ptomasroos you realize that lib is only a parser, right? Parsers don't change much.
from graphql.
@ileitch Yes. "only" 6-8K ? lines of code covered with tests. I see that as a big value.
from graphql.
@ptomasroos brought up some valid points on the benefits of wrapping the c-lib parser.
Right now the implementation of the parser
is based on graphql-js
parser but it is basically a black-box. The implementation details of the parser
can be changed easily (e.g replace it with cgo impementation).
Give it a query string
, get an ast struct
in return. Simple as that.
I helped @chris-ramon to quickly complete his work on the parser, but I was more interested in writing tests to ensure that it meets the spec, at least in comparison to graphql-js
.
Optimizing the parser for memory management and performance could come later, in my mind.
I think right now this project has more parts to it than just the parser i.e, the validator, executor etc, (For me personally, to get a working Relay-compliant server in golang eventually.)
I think if anyone could contribute a PR replacing the parser with a CGO version, that would be awesome. 👍🏻 The tests are already there, so it'll be relatively easy to verify the implementation.
Cheers guys!
from graphql.
I'm def looking forward to a good implementation in golang, no questions asked! I just hope that someone can get there in a reasonable amount of time before loosing its urge :)
Good luck, guys. Will check back.
from graphql.
A related update to keep this discussion productive:
Someone just released a golang wrapper for libgraphqlparser
https://github.com/tecbot/c-graphqlparser
Seems legit.
Cheers!
from graphql.
Related Issues (20)
- New release?
- Potential goroutine leak in TestContextDeadline HOT 1
- Enums with trailing white space cause error.
- Playground
- make union input type ? it just have output union type
- With fiber HOT 1
- Printing GraphQL documents is slow HOT 1
- Bug with underscore and same name in keys from json response
- MongoDB _id field
- Printer returns invalid SDL if Block String comment contains double-quote
- When using custom scalar types, it's crucial to provide error feedback to users when issues arise with their submitted data. However, triggering exceptions within the ParseValue and ParseLiteral methods can lead to program crashes when using the graphql.Do method. This prevents the necessary error messages from being delivered to users.
- String type no longer recongised HOT 1
- Is it possible to go from `*graphql.Schema` to an ast node? HOT 1
- Error handling HOT 1
- Disabling Field Suggestions
- Is possible to typing typeConfig of graphql.Object after Object done.
- RootObjectFn request body always empty
- Unable to pass {{....}} as part of query or mutation string
- Redefining scalar ID
- How to support scalar JSON type? HOT 1
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 graphql.