h-REA / holo-rea-proto

REA economic network coordination software implemented on top of the Holochain prototype (Go version).
GNU General Public License v3.0
17 stars 1 forks source link

Attain single source of truth between GraphQL schema and TypeScript types #5

Open pospi opened 5 years ago

pospi commented 5 years ago

It seems like there are ways to do this with pre-processing, which feel a bit weird, but which also seem to be workable. Allows us to get a single source of truth between frontend and backend types. There are potentially better options as TS and GraphQL are both continually evolving- more research needed.

If we do end up being able to compile the existing backend with AssemblyScript some day, it means we'll be able to share type information and base classes between the frontend and backend of the system, increasing code comprehension dramatically.

Even if we don't end up using any GFD code on the rusty-chain version, we can potentially get a head start on declaring the type system for integration with the Apollo / GraphQL view layer, which is an important aspect of authoring error-free UI code.

Either way, seems a win-win to attempt merging these two parts of the codebase.

pospi commented 5 years ago

FWIW the officially supported way of doing this is https://www.npmjs.com/package/apollo#code-generation