Custom generator
#12360
Replies: 1 comment
-
I'm not sure this will be of much help but here is a repository that defines a new generator and has some tooling for invoking that generator: https://github.com/PhilanthropyDataCommons/sdk/ |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all,
I want to create a generator of the server stub for Dart Frog framework. So, I'm trying to figure out how the codegen works. I've realized the
CodegenConfig
descendant only defines minor parameters of the generated code such as package names, location of output files, template names etc. But it doesn't define overall logic of generated package. For example Dart Frog routing is based of file structure - each path has it's own controller named and located exactly as in URL.I've found out that such details - going through paths - are implemented in
DefaultGenerator
class. So, my understanding is that I have to implement my own implementation ofGenerator
interface, most likely - descendant ofDefaultGenerator
. Is it right approach?Now, I've got to a question how I inject my generator to the codegen command line. And here I've found out the codegen CLI (at least the
Generate
command) doesn't care about another generators as it just instantiatesDefaultGenerator
:So what would be the right approach here? Just run my own implementation of
Generator
? Or create another command in CLI command scheme that would do that?Wouldn't it make sense for the
Generate
command to load not onlyCodegenConfig
class for a given language but also try to load the customGenerator
implementation?Beta Was this translation helpful? Give feedback.
All reactions