Open jemgold opened 6 years ago
I wrote quicktype to do this and mentioned it to @dfield. I'll look into it for this use case.
Also you can have a look on my Figma API extract (written in Haxe), not completed yet, but it could be helpful :) https://github.com/neelts/figma-api-hx/blob/master/src/figma/FigmaAPIExtract.hx
It generates this JSON: https://gist.github.com/neelts/c9a4284b3f1d545070b21d713c2965bc from this JS file: https://www.figma.com/figbuild/symlinks/developers.1c90a7f2b28cad9058ead2a9750af639.min.js
FYI, I used your TypeScript types to generate a JSON schema, from which I'm generating types and JSON marshaling in C#, Go, Rust, C++, Objective-C, Java, JavaScript, Flow, Swift, Elm, and Ruby:
https://github.com/quicktype/figma-types
For Flow, TypeScript, and JavaScript, I also generate runtime typechecks that compare the Figma JSON to the TypeScript types:
https://github.com/quicktype/figma-types/blob/master/typescript/figma.ts#L2150-L2152
I haven't tried any of it yet, though 😝
I wrote all the types out by hand which was some pretty intense type 2 fun.
Would be excellent if someone (at Figma?) could figure out how to generate them automatically.