Description
The generated go code for the yaml file, contains optional struck but missing optional import statement
openapi-generator version
3.2.0
same issue on master
OpenAPI declaration file content or url
auth.yaml
openapi: 3.0.0
info:
version: 1.0
title: AUTH API
paths:
/ue-authentications/{authCtxId}/eap-session:
post:
operationId: EapAkaPrime
parameters:
- name: authCtxId
in: path
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/EapSession'
responses:
'200':
description: Use to handle or close the EAP session
content:
application/json:
schema:
$ref: '#/components/schemas/EapSession'
application/3gppHal+json:
schema:
type: object
properties:
eapPayload:
$ref: '#/components/schemas/EapPayload'
required:
- eapPayload
- _links
components:
schemas:
EapSession:
type: object
properties:
eapPayload:
$ref: '#/components/schemas/EapPayload'
kSeaf:
$ref: '#/components/schemas/Kseaf'
required:
- eapPayload
AuthResult:
type: string
enum:
- AUTHENTICATION_SUCCESS
- AUTHENTICATION_FAILURE
- AUTHENTICATION_ONGOING
EapPayload:
type: string
format: base64
description: contains an EAP packet
Kseaf:
type: string
pattern: '[A-Fa-f0-9]{64}'
ResStar:
type: string
pattern: '[A-Fa-f0-9]{32}'
HxresStar:
type: string
pattern: '[A-Fa-f0-9]{32}'
AuthType:
type: string
enum:
- 5G_AKA
- EAP_AKA_PRIME
Command line used for generation
generate -g go -i auth.yaml -o generated/go
Steps to reproduce
Generated code using above yaml and it will generate go code with import missing
Suggest a fix/enhancement
In AbstractGoCodegen.java - it seems, import is added only for primitives
- // import "optionals" package if the parameter is primitive and optional
- if (!param.required && param.isPrimitiveType) {
- // import "optionals" package if the parameter is optional
- if (!param.required) {
Description
The generated go code for the yaml file, contains optional struck but missing optional import statement
openapi-generator version
3.2.0
same issue on master
OpenAPI declaration file content or url
auth.yaml
Command line used for generation
Steps to reproduce
Generated code using above yaml and it will generate go code with import missing
Suggest a fix/enhancement
In AbstractGoCodegen.java - it seems, import is added only for primitives