jsontypedef / json-typedef-codegen

A CLI tool that generates code from JSON Typedef schemas
https://jsontypedef.com/docs/tools/jtd-codegen
MIT License
160 stars 31 forks source link

Rearchitected approach to code generation #6

Closed ucarion closed 3 years ago

ucarion commented 4 years ago

This PR implements a rearchitected approach to code generation, and includes specific documentation on the prioritized requirements of a software like jtd-codegen.

In the end, there's considerable complexity involved in generating good names for classes/structs/types, when dealing with the possibility of naming collisions and other issues.

I believe this code is a push in the right direction, but I am beginning to suspect that a better architecture may be to have a centralized code generation "planner", and then have each target support a common interface for emitting certain sub-structures (like a single struct or enum, or a list of a given type). I believe adding support for a few more languages and variants, like Gson for Java, Golang, and C# would help here.