Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Inconsistent openapitools.json handling beetwen npm and docker version of openapi-generator-cli #664

Open
plblueraven opened this issue Sep 16, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@plblueraven
Copy link

🐛 Bug Report:

Describe the bug

I want to configure generation in CLI in some kind of config file. When using (npm) generator-cli readme says that you can configure it with openapitools.json file and later use openapi-generator-cli generate --generator-key YOUR_GENERATOR_KEY but on the other hand if you want to use (docker) generator-cli this kind of configuration is unexpected.

Steps to Reproduce

Given such a config (config/config.json) file:

{
  "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
  "spaces": 2,
  "generator-cli": {
    "version": "6.1.0",
    "generators": {
      "v3.0": {
        "generatorName": "spring",
        "output": "/local",
        "inputSpec": "https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml",
        "globalProperty": {
          "models": "Order,User",
        },
        "additionalProperties": {
          "apiPackage": "com.test",
          "modelPackage": "com.test.model",
          "supportingFilesToGenerate": "ApiUtil.java",
          "groupId": "com.test",
          "artifactId": "test",
          "artifactVersion": "0.0.0",
          "interfaceOnly": true
        }
      }
    }
  }
}

Command:

docker run --rm -v "${PWD}/tmp:/local" -v "${PWD}/config/config.json:/openapitools.json" openapitools/openapi-generator-cli:v6.1.0 generate --generator-key v3.0

Produces:

[error] Found unexpected parameters: [--generator-key, v3.0]

See 'openapi-generator-cli help' for usage.

Expected behavior

Consistent behavior for both npm generator-cli and docker generator-cli.

Operation System:

  • OS: Windows
  • Version 10

Package System:

No package system, just docker:

  • Docker version 20.10.17, build 100c701

Additional context

IMO it should be well documented (and consistent) how to configure all of configuration properties (global and additional) by CLI using some kind of config file for both npm and docker CLI as it is helpful in CI/CD tools.

@plblueraven plblueraven added the bug Something isn't working label Sep 16, 2022
@jayvdb
Copy link

jayvdb commented Oct 31, 2022

I also encountered this. Perhaps the docker image could include the npm package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants