Description
I'd like to add some post generation functionality after a generator has created all the files.
Specifically, I'd like to call gofmt for the files being produced by the Go client generator. I have a working implementation but I'm currently overriding postProcessSupportingFileData with the following:
@Override
public Map<String, Object> postProcessSupportingFileData(Map<String, Object> objs) {
generateYAMLSpecFile(objs);
objs = super.postProcessSupportingFileData(objs);
gofmt();
return objs;
}
When I do this, gofmt gets called after the models and APIs but before the supporting files including client.go and README.md
It seems a new hook may be needed to execute some code in DefaultGenerator.generate after generateSupportingFiles and processOpenAPI.
This may also be useful for the "Additional tools" section of the roadmap:
- node.js build system(s) integration (grunt/gulp/webpack/etc)
- ruby gem
- others (which may require previously mentioned SaaS API)
openapi-generator version
3.1.0 / master
OpenAPI declaration file content or url
n/a
Command line used for generation
n/a
Steps to reproduce
n/a
Related issues/PRs
https://stackoverflow.com/questions/51215890/openapi-generator-swagger-codegen-how-to-add-a-function-after-all-files-have
Suggest a fix/enhancement
Add a hook like postProcessFinalize that runs after supporting files are run.
Description
I'd like to add some post generation functionality after a generator has created all the files.
Specifically, I'd like to call
gofmtfor the files being produced by the Go client generator. I have a working implementation but I'm currently overridingpostProcessSupportingFileDatawith the following:When I do this,
gofmtgets called after the models and APIs but before the supporting files includingclient.goandREADME.mdIt seems a new hook may be needed to execute some code in
DefaultGenerator.generateaftergenerateSupportingFilesandprocessOpenAPI.This may also be useful for the "Additional tools" section of the roadmap:
openapi-generator version
3.1.0 / master
OpenAPI declaration file content or url
n/a
Command line used for generation
n/a
Steps to reproduce
n/a
Related issues/PRs
https://stackoverflow.com/questions/51215890/openapi-generator-swagger-codegen-how-to-add-a-function-after-all-files-have
Suggest a fix/enhancement
Add a hook like
postProcessFinalizethat runs after supporting files are run.