| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
Customized templates are painful when updating the generator. Each template has to be compared with upstream and adapted accordingly.
We use custom generators for introducing workarounds and fixes to not further customize our templates.
Custom generators live in this directory. For each language with a custom generator there should be a <lang>Generator.java file. Each fix/workaround should live in its own class and be called from the <lang>Generator.java file. This allows easy removal of such fixes, when they are no longer needed.
Fixes, applicable to multiple languages, should be implemented in the shared package.
We try to only use the JDK and no external libraries besides the openapi-generator itself to keep a simple build step.
Each language with a custom generator, needs an adapted <lang>.sh script. Before building each service the custom generator has to be built:
# compile custom generator
cd ${ROOT_DIR}
mkdir -p custom
javac -cp "${GENERATOR_JAR_PATH}" -d custom $(find ./scripts/generators -type f -name '*.java' | grep -v overrides)This compiles all java files into the custom directory. Here we also exclude java files in the overrides directory. These are resources and should not be compiled in this step.
The generator call itself has to be adapted:
java -Dlog.level="${GENERATOR_LOG_LEVEL}" -cp "custom:${GENERATOR_JAR_PATH}:scripts/generators" \
org.openapitools.codegen.OpenAPIGenerator generate \
--generator-name JavaGenerator \
--enable-post-process-file \
# more paramsWe have to:
How to configure an override:
| Back | FazBrowse Home | New Git URL |