bolt icon indicating copy to clipboard operation
bolt copied to clipboard

Feature Request: produce typescript interfaces from the bolt file

Open schwer opened this issue 8 years ago • 4 comments

The bolt syntax could produce something fit for consumption as typescript interface, if we ignore the path and complex validations. It's no fun creating separate schema/interface code for the same objects.

schwer avatar Jun 10 '16 00:06 schwer

I've actually released a library which aims to do just that: https://github.com/fny/firebase-bolt-transpiler

Please give it a spin, and let me know if you run into any issues.

fny avatar Jul 06 '16 09:07 fny

Awesome!

brewsoftware avatar Jul 06 '16 23:07 brewsoftware

Is this still the best reference?

pspeter3 avatar Nov 29 '16 00:11 pspeter3

I would propose that either bolt support the already existing JSON schema standard or for there to be a way to transpile from JSON schema to bolt types. There is already a library for converting JSON schema to TypeScript interfaces so adding JSON schema support in bolt or converting from JSON schema to bolt would bridge the gap.

It would ensure that data at the database is validated, that we have editor / compiler support in TypeScript, and developers could use the JSON schema validation outside of the context of TypeScript or Firebase.

adamduren avatar Aug 11 '17 13:08 adamduren