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] setting cli arguments causes config file to be ignored #371

Open
myrddraall opened this issue Jun 2, 2021 · 5 comments
Open

[BUG] setting cli arguments causes config file to be ignored #371

myrddraall opened this issue Jun 2, 2021 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@myrddraall
Copy link

myrddraall commented Jun 2, 2021

⚠️ Important Notice

Please differentiate the bug

This repository is not responsible for the actual code generation. If you have problems with the code generation, please open the bug at OpenAPITools/openapi-generator.

Please also check if the bug is already known before you open a new bug.


🐛 Bug Report:

Describe the bug

you cant seem to mix a config file with some of the cli options.
In this case I'm trying to set --server-variables=major=2 as the version is determined via script

Steps to Reproduce

Steps to reproduce the behavior:

Config File:

{
  "$schema": "../../node_modules/@openapitools/openapi-generator-cli/config.schema.json",
  "spaces": 2,
  "generator-cli": {
    "version": "5.1.1",
    "generators": {
      "server": {
        "generatorName": "aspnetcore",
        "output": "#{cwd}/../.generated",
        "glob": "src/*.{json,yaml,yml}",
        "modelNameSuffix": "",
        "apiNameSuffix": "Base",
        "additionalProperties": {
          "aspnetCoreVersion": "5.0",
          "classModifier": "abstract",
          "buildTarget": "library",
          "isLibrary": true,
          "packageName": "OpenApi.Generated",
          "operationIsAsync": true,
          "operationResultTask": true,
          "operationModifier": "abstract",
          "swashbuckleVersion": "5.0.0"
        }
      }
    }
  }
}

running openapi-generator-cli generate woks as expected

running openapi-generator-cli generate --server-variables=major=2 errors with:
[error] Required option '-i' is missing

running openapi-generator-cli generate --server-variables=major=2 --config=openapitools.json errors with:

Exception in thread "main" java.lang.NullPointerException: generator name must be specified
        at org.apache.commons.lang3.Validate.notEmpty(Validate.java:395)
        at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:482)
        at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:573)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:433)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)

Expected behavior

The cli should use the settings in the config file, with any cli arguments added/overriding the values in the file

Operation System (please complete the following information):

  • OS: Ubuntu
  • Version 20

Package System (please complete the following information):

  • npm 6.14.13
@myrddraall myrddraall added the bug Something isn't working label Jun 2, 2021
@myrddraall myrddraall changed the title [BUG] setting cli flags causes config file to be ignored [BUG] setting cli arguments causes config file to be ignored Jun 2, 2021
@LeonBlade
Copy link

I'm having this issue as well. I'd like to be able to override the JSON with my own parameters.

@catadnl
Copy link

catadnl commented May 6, 2022

Facing the same issue. Did anyone fin a workaround for this?

@chancesmith
Copy link

same here

@kareem-abdul
Copy link

kareem-abdul commented Jan 24, 2023

same here. any updates for this? @kay-schecker

@hannanstd
Copy link

same issue

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

7 participants