OpenAPITools / OpenAPITools/openapi-generator

[BUG][angular typescript] latest docker image not reading configuration file

Open
#11,287 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

we are using the latest docker image in our code generation for typescript angular. As we updated yesterday, the generator now errors out whenever we pass in a configuration file:

docker pull openapitools/openapi-generator-cli:latest

docker run --rm -v ${PWD}:/local -v $(pwd)/codegen_scripts/:/tmp/cfg openapitools/openapi-generator-cli:latest generate \
    -i http://ourpath-to-openapi.json \
    -g typescript-angular \
    **-c /tmp/cfg/config.json \** 
    -o /local/typescript-angular

where we have in codegen_scripts/config.json

{
  "additionalProperties": {
    "useHttpClient": true,
    "useNgPackagr": true,
    "basePath": "",
    "enumPropertyNaming": "UPPERCASE",
    "stringEnums": true
  },
  "ngVersion": "13.1.1",
  "npmName": "@activia/cm-api",
  "npmVersion": "52.4.5",
  "npmRepository": "https://ourepo/repository/npm-internal/",
  "supportsES6": true
}
openapi-generator version

openapitools/openapi-generator-cli@sha256:5cf9a2bd60dbd7a517ff462824fb8792168c074fe13e8dd4708718127f819939

Generation Details
Steps to reproduce

run the bash above against a valid openapi.json
-> expected: works and generates

-> actual:

Exception in thread "main" java.lang.NullPointerException
        at java.base/java.lang.String.concat(Unknown Source)
        at org.openapitools.codegen.CodegenConfigLoader.forName(CodegenConfigLoader.java:48)
        at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:94)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:272)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)

removing the -c option works but generated httpclient.delete calls contain an extra parameter, we lost package.json info. As well using the latest-release image has the same extra parameter in the delete as well and thus the generated code won't compile.

https://github.com/OpenAPITools/openapi-generator/issues/11276

Contributor guide

Open the contributing guide

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.

Research direction

Reproduce the Docker command with the provided config.json and inspect CodegenConfigLoader.java, especially forName, followed by CodegenConfigurator.fromFile and Generate.execute in the stack trace. Compare behavior with and without -c and review issue 11276. Done means the configuration file loads successfully and typescript-angular output retains the package metadata without the extra delete parameter.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, docker, java, typescript
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.