2

I successfully did generate a REST Client in java from a Swagger/OpenApi v2.0 using OpenApi Generator CLI 3.3.2-SNAPSHOT

But I already have a REST Client, so I just want to generate some models from the spec.

I get success when I run:

java -Dmodels -DmodelDocs=false \
     -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
     -i swagger.json \
     -g java \
     -o /temp/my_models

But when I want to generate just specific models with

java -Dmodels=Body,Header -DmodelDocs=false \
     -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
     -i swagger.json \
     -g java 
     -o /temp/my_selected_models

I'm getting this ERROR:

[main] INFO o.o.c.languages.AbstractJavaCodegen - Environment variable JAVA_POST_PROCESS_FILE not defined so the Java code may not be properly formatted. To define it, try 'export JAVA_POST_PROCESS_FILE="/usr/local/bin/clang-format -i"' (Linux/Mac)

What is this JAVA_POST_PROCESS_FILE and how can I specify a valid format to generate the models?

Why the code generation success with all models but fails with a subset?

1 Answer 1

4

That message is just informational. It aims to inform you that there's a way to auto-format the auto-generated Java code by specifying an environment variable with the auto code formatter (clang_format in this case):

export JAVA_POST_PROCESS_FILE="/usr/local/bin/clang-format -i"

In other words, it does not affect the code generation process if the environment variable is not specified.

Sign up to request clarification or add additional context in comments.

2 Comments

Oh! let me explain the situation: I know the message is informational, but it doesn't generate the files. That's the real problem, and that's the only message I'm getting, no errors, no files.
Please open an issue with details via github.com/OpenAPITools/openapi-generator/issues/new if you've not done so.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.