Skip to content

Types compatible with Reason native (ie. sans BuckleScript) #5

Description

@mscharley

Feature Request

Is your feature request related to a problem? Please describe.
I'm trying to use graphql-to-reason to generate types from a schema SDL file which can be used by my server (ocaml-graphql based native project) and my frontend project (ReasonReact + reason-apollo).

Kudos for a light-weight way to get going. Generating types from the SDL file was simple to get going. However the currently generated types rely on BuckleScript, so I'm unable to use them on my backend project without manually patching them.

Describe the solution you'd like
A clear and concise description of what you want to happen. Add any considered drawbacks.

BuckleScript makes the most sense for frontend JS applications. For native though, you'd want to use record syntax rather than Js.t.

The simplest way I can think of to trigger between the two syntaxes is either to have a --native flag or a --syntax=[bs|native] option. The second option is more future proof, but presently I can't think of a possible third syntax option.

I'll report back with what changes I've needed to make to get a simple example server working when I get a simple example server working.

Describe alternatives you've considered
None, though bs-native seems like an interesting option. That was my first attempt when spinning up this project but esy + bs-native is much harder to get going than esy + pesy + dune from my personal experience with one project to the point where I gave up on it. It'd be nice to support non-bucklescript projects any way, in my opinion.

Teachability, Documentation, Adoption, Migration Strategy

This would be a secondary generation method which is completely opt-in. It would not affect current users.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions