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?

Armando
  • 310
  • 5
  • 18

1 Answers1

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.

William Cheng
  • 10,137
  • 5
  • 54
  • 79
  • 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. – Armando Oct 24 '18 at 21:01
  • 1
    Please open an issue with details via https://github.com/OpenAPITools/openapi-generator/issues/new if you've not done so. – William Cheng Nov 14 '18 at 03:34