Skip to content

[BUG][typescript-angular] fails with java.lang.ClassCastException #3542

@LucaVazz

Description

@LucaVazz

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
    Occurs both for 4.0.3 and 4.1.0-20190802.113338-103
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
    expected: a client gets generated
    actual:
[main] WARN  o.o.c.ignore.CodegenIgnoreProcessor - Output directory does not exist, or is inaccessible. No file (.openapi-generator-ignore) will be evaluated. [main] INFO  o.o.codegen.DefaultGenerator - OpenAPI Generator: typescript-angular (client)
[main] INFO  o.o.codegen.DefaultGenerator - Generator 'typescript-angular' is considered stable.
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] INFO  o.o.c.l.AbstractTypeScriptClientCodegen - Hint: Environment variable 'TS_POST_PROCESS_FILE' (optional) not defined. E.g. to format the source code, please try 'export TS_POST_PROCESS_FILE="/usr/local/bin/prettier --write"' (Linux/Mac)
[main] INFO  o.o.c.l.AbstractTypeScriptClientCodegen - Note: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).
Exception in thread "main" java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String
        at org.openapitools.codegen.languages.TypeScriptAngularClientCodegen.processOpts(TypeScriptAngularClientCodegen.java:169)
        at org.openapitools.codegen.DefaultGenerator.configureGeneratorProperties(DefaultGenerator.java:194)
        at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:908)
        at org.openapitools.codegen.cmd.Generate.run(Generate.java:399)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:60)
Description

While generating a TypeScript-Angular client, the generate command fails with java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String

openapi-generator version

Occurs both for 4.0.3 and 4.1.0-20190802.113338-103

OpenAPI declaration file content or url

https://petstore.swagger.io/v2/swagger.json

Command line used for generation
java -jar openapi-generator-cli.jar generate \
    -i https://petstore.swagger.io/v2/swagger.json \
    -g typescript-angular -c swagger-codegen-config.json --skip-validate-spec \
    -o ./lib/client
Steps to reproduce

swagger-codegen-config.json

{
    "sortParamsByRequiredFlag": true,
    "ensureUniqueParams": true,
    "allowUnicodeIdentifiers": true,
    "modelPropertyNaming": "camelCase",
    "supportsES6": true,
    "withInterfaces": false,
    "taggedUnions": true,
    "providedInRoot": false,
    "fileNaming": "kebab-case",
    "ngVersion": "7.0.0"
}
Related issues/PRs

I was only able to find #2709 which has the same error but the solution doesn't seem to apply for this bug.

Suggest a fix

I'll look into it more in depth next week. If someone has an idea / suggestion how to fix it before, feel free to comment and point me in the right direction.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions