Search code examples
swaggerswagger-codegen

Swagger codegen cannot find ignore file


I am trying to run the swagger codegen tool and get the error,

No .swagger-codegen-ignore file found.

I have created this file in the same directory from which I am running a command like,

java -jar swagger-codegen-cli-2.3.1.jar generate -l kotlin -i ./src/main/resources/backend_openapi.json -o ./src/main/resources/client

I have double checked the spelling of the ignore file but not sure why it cannot recognize it? Does it need to be in a different location?


Solution

  • According to Swagger Codegen docs (emphasis mine):

    The .swagger-codegen-ignore file must exist in the root of the output directory.

    In your example, it needs to be in the src/main/resources/client folder.

    If the ignore file is in another location, use the --ignore-file-override=/path/to/ignore_file CLI option.