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] [Golang][Client] java.lang.NullPointerException: Cannot read field "name" because "codegenModel" is null #12357

Closed
4 of 6 tasks
okhowang opened this issue May 13, 2022 · 0 comments

Comments

@okhowang
Copy link
Contributor

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?
  • 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

run generator got exception with yaml

Exception in thread "main" java.lang.RuntimeException: Could not generate api file for 'Default'
	at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:668)
	at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:895)
	at org.openapitools.codegen.cmd.Generate.execute(Generate.java:449)
	at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
	at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Caused by: java.lang.NullPointerException: Cannot read field "name" because "codegenModel" is null
	at org.openapitools.codegen.languages.GoClientCodegen.constructExampleCode(GoClientCodegen.java:660)
	at org.openapitools.codegen.languages.GoClientCodegen.constructExampleCode(GoClientCodegen.java:683)
	at org.openapitools.codegen.languages.GoClientCodegen.constructExampleCode(GoClientCodegen.java:639)
	at org.openapitools.codegen.languages.GoClientCodegen.constructExampleCode(GoClientCodegen.java:595)
	at org.openapitools.codegen.languages.GoClientCodegen.constructExampleCode(GoClientCodegen.java:693)
	at org.openapitools.codegen.languages.GoClientCodegen.constructExampleCode(GoClientCodegen.java:565)
	at org.openapitools.codegen.languages.GoClientCodegen.postProcessOperationsWithModels(GoClientCodegen.java:487)
	at org.openapitools.codegen.DefaultGenerator.processOperations(DefaultGenerator.java:1215)
	at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:572)
	... 4 more

Process finished with exit code 1
openapi-generator version

v5.4.0
master[02f1626]

OpenAPI declaration file content or url
openapi: 3.0.3
info:
  version: 0.0.1
  title: example
paths:
  /:
    post:
      summary: demo
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Model'
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                type: string

components:
  schemas:
    Item:
      oneOf:
        - type: string
        - type: integer
    Model:
      type: object
      required:
        - Items
      properties:
        Items:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/Item'
Generation Details
generate -g go -i test\openapi.yaml -o test\go
Steps to reproduce
Related issues/PRs
Suggest a fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants