[BUG] [Golang][Client] java.lang.NullPointerException: Cannot read field "name" because "codegenModel" is null
Created by: okhowang
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[02f16267]
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