Skip to content
This repository has been archived by the owner on Sep 11, 2019. It is now read-only.

Compile-time code generation #61

Open
kbrandwijk opened this issue Dec 22, 2017 · 4 comments
Open

Compile-time code generation #61

kbrandwijk opened this issue Dec 22, 2017 · 4 comments

Comments

@kbrandwijk
Copy link
Member

I have recently started experimenting with compile-time code generation for the bindings that graphql-binding uses, and I thought that might also be applied to GrAMPS at some point.

Do you have any existing plans to incorporate compile-time code generation?

@jlengstorf
Copy link
Member

There aren't any existing plans, but I'd be interested to see what you're working on and whether or not it makes sense within the context of GrAMPS. I don't know much about it, so maybe you could hit me with an article or example so I can learn more about it?

@kbrandwijk
Copy link
Member Author

kbrandwijk commented Dec 22, 2017

You can have a look at https://github.com/supergraphql/graphql-server-static-ts. It contains two build scripts to process schema imports and to generate the bindings for the schemas. You can have a look at https://github.com/supergraphql/graphql-server-static-ts/blob/master/src/generated/bindings.ts#L201-L365 to see what that actually creates. (Disclaimer: alpha-stage, so the generated file contains some elements that need to be refactored out of there, for now the lines I linked are the relevant part). There is also a JS version.

I would imagine that it would be possible to do the same here. You specify a list of datasources that you want to use at design-time (config file? extension to .graphqlconfig.yml to allow GrAMPS sources?), and it would pre-generate the classes needed.

@jlengstorf
Copy link
Member

This looks super cool, and I'm into it, but I think I need to walk through building an example app to fully understand the benefits of this approach.

I think extending .graphqlconfig.yml to allow GrAMPS data sources would be really handy. (It's on my todo list to get a plugin for the CLI so we can start doing graphql gramps dev as well. #64)

@kbrandwijk
Copy link
Member Author

I'll have another look at the code too, to see how and where this would fit in.

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

No branches or pull requests

2 participants