OpenAPITools / OpenAPITools/openapi-generator-cli

[BUG] docker version of openapi-generator-cli doesn't recognize `openapitools.json`

Open
#905 0 comments 0 reactions 1 assignee View on GitHub

@kay-schecker is already working on this.

Since Mar 24, 2025.

bug
Dominant language
TypeScript
Stars
2k
Forks
208
Avg merge
7h 12m
Merged PRs (30d)
6

Description

🐛 Bug Report:

docker version of openapi-generator-cli doesn't work with configuration files.

Steps to Reproduce

https://github.com/OpenAPITools/openapi-generator-cli/blob/11a2df547ef2f54d714a37da9b3f4dcb29c69c46/apps/generator-cli/src/README.md?plain=1#L161-L162

despite the documentation, following doesn't work:

openapitools.json:

{
  "$schema": "https://raw.githubusercontent.com/OpenAPITools/openapi-generator-cli/refs/heads/master/apps/generator-cli/src/config.schema.json",
  "spaces": 2,
  "generator-cli": {
    "version": "7.12.0",
    "generators": {
      "v3.0": {
        "inputSpec": "https://touhoudb.com/swagger/v1/swagger.json",
        "generatorName": "typescript-fetch",
        "output": "#{cwd}/client"
      }
    }
  }
}
podman run --rm -v $PWD:/local:z openapitools/openapi-generator-cli generate
[error] Required option '-i' is missing

even if i explicitly pass in config file, it doesn't read config file despite "generatorName": "typescript-fetch",

podman run --rm -v $PWD:/local:z openapitools/openapi-generator-cli generate --config /local/openapitools.json
Exception in thread "main" java.lang.NullPointerException: generator name must be specified
        at java.base/java.util.Objects.requireNonNull(Unknown Source)
        at org.apache.commons.lang3.Validate.notEmpty(Validate.java:388)
        at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:643)
        at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:744)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:527)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Expected behavior

docker version works the same like the npm version.

Screenshots

If applicable, add screenshots to help explain your problem.

Operation System (please complete the following information):
  • OS: Fedora Linux
  • Version 41
Package System (please complete the following information):
  • Version rpm 4.20.0
Additional context

Add any other context about the problem here.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.