Closed despairblue closed 5 years ago
Hi @despairblue,
Interesting with the benchmark π You're right that it's currently not possible to have a self-recursive Query type with ocaml-graphql-server
. The current approach solves some typing-related issues, and it hasn't really come up as an issue for any real-world use case yet. If you want to hack it, you can update the function schema
to accept a value of type ('ctx, unit option) typ
as the query type (you will need to raise if this value is not an object).
Hope it helps. Would be curious to see the results π
Thanks, the results are here: https://github.com/ruiaraujo/gbench/pull/1
I only run the benchmark for scalars, lists and the introspection one for now. You can check the server here if you have any suggestions, but it's in reason, I can convert it to ocaml though if you like.
I think rewriting the benchmark is actually the better option than making the implementation more complicated. I also don't see any real world use case for this. :smiley:
Thanks for sharing π I'll close this for now then.
Hey I'm trying to add an ocaml implementation to some benchmark. The benchmark wants the server to implement a schema like that:
Since
Schema.schema
only takes a list of fields I cannot use the query type when creating the fields. The closest I got was this:I then tried using the
query_name
parameter ofSchema.schema
to change the root query's name toQuery
, but that just short circuits the schema:I'm currently looking into the code of the schema function, but I think I would need to change the execute function as well :/
Am I missing something and that is actually possible without changing the code? I mean I could also change the benchmark of course ^^