Skip to content

[BUG] R generator throws: Cannot read field "isArray" because "codegenProperty" is null #15915

@tschaffter

Description

@tschaffter

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
    • The main branch does not compile successfully (package lombok does not exist)
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

I want to generate an API client for R from this OpenAPI description, but the generation fails with the following error:

$ openapi-generator-cli generate

...
[[api-client-r] #{cwd}/../api-description/build/openapi.yaml] Exception in thread "main" java.lang.RuntimeException: Could not generate api file for 'Challenge'
[[api-client-r] #{cwd}/../api-description/build/openapi.yaml]   at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:717)
[[api-client-r] #{cwd}/../api-description/build/openapi.yaml]   at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:949)
[[api-client-r] #{cwd}/../api-description/build/openapi.yaml]   at org.openapitools.codegen.cmd.Generate.execute(Generate.java:487)
[[api-client-r] #{cwd}/../api-description/build/openapi.yaml]   at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
[[api-client-r] #{cwd}/../api-description/build/openapi.yaml]   at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
[[api-client-r] #{cwd}/../api-description/build/openapi.yaml] Caused by: java.lang.NullPointerException: Cannot read field "isArray" because "codegenProperty" is null
[[api-client-r] #{cwd}/../api-description/build/openapi.yaml]   at org.openapitools.codegen.languages.RClientCodegen.constructExampleCode(RClientCodegen.java:950)
[[api-client-r] #{cwd}/../api-description/build/openapi.yaml]   at org.openapitools.codegen.languages.RClientCodegen.constructExampleCode(RClientCodegen.java:932)
[[api-client-r] #{cwd}/../api-description/build/openapi.yaml]   at org.openapitools.codegen.languages.RClientCodegen.postProcessOperationsWithModels(RClientCodegen.java:903)
[[api-client-r] #{cwd}/../api-description/build/openapi.yaml]   at org.openapitools.codegen.DefaultGenerator.processOperations(DefaultGenerator.java:1271)
[[api-client-r] #{cwd}/../api-description/build/openapi.yaml]   at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:605)
[[api-client-r] #{cwd}/../api-description/build/openapi.yaml]   ... 4 more
[[api-client-r] #{cwd}/../api-description/build/openapi.yaml] java -jar "/workspaces/sage-monorepo/node_modules/@openapitools/openapi-generator-cli/versions/6.6.0.jar" generate --input-spec="/workspaces/sage-monorepo/libs/openchallenges/api-client-r/../api-description/build/openapi.yaml" --generator-name="r" --output="/workspaces/sage-monorepo/libs/openchallenges/api-client-r/src/lib/" exited with code 1
[api-client-r] #{cwd}/../api-description/build/openapi.yaml
  java -jar "/workspaces/sage-monorepo/node_modules/@openapitools/openapi-generator-cli/versions/6.6.0.jar" generate --input-spec="/workspaces/sage-monorepo/libs/openchallenges/api-client-r/../api-description/build/openapi.yaml" --generator-name="r" --output="/workspaces/sage-monorepo/libs/openchallenges/api-client-r/src/lib/"

The generator configuration is available here.

openapi-generator version

6.6.0

OpenAPI declaration file content or url

openapi.yaml

Generation Details

See above for the command used, the generator config file and openapi file.

Steps to reproduce
  1. Install the openapi-generator-cli (see the README of this repo)
  2. Create the folder api-client-r
  3. Add the following files to this folder
  4. From inside the folder api-client-r, generate the API client for R with openapi-generator-cli generate
Related issues/PRs
Suggest a fix

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