You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
In go generator, empty Struct generated for top-level "additionalProperties" when "generateAliasAsModel=true".
openapi-generator version
tested 5.3.1, 6.4.0
OpenAPI declaration file content or url
swagger: '2.0'info:
title: Harbor APIdescription: These APIs provide services for manipulating Harbor project.version: '2.0'host: localhostschemes:
- http
- httpsbasePath: /api/v2.0produces:
- application/jsonconsumes:
- application/jsonsecurityDefinitions:
basic:
type: basicsecurity:
- basic: []
- {}paths:
/health:
get:
summary: Check the status of Harbor componentsdescription: Check the status of Harbor componentstags:
- healthoperationId: getHealthparameters:
responses:
'200':
description: The health status of Harbor componentsschema:
$ref: '#/definitions/Annotations'definitions:
Annotations:
type: objectadditionalProperties:
type: string
Generation Details
swagger yaml contains a top level object with additionalProperties(in this case, Annotations). For generation argument, generateAliasAsModel is set to true to make it an individual model.
Expected to get the model with a map field for the additionalProperties. However, an empty struct is generated.
example code generated:
/*Harbor APIThese APIs provide services for manipulating Harbor project.API version: 2.0*/// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.package openapi
import (
"encoding/json"
)
// checks if the Annotations type satisfies the MappedNullable interface at compile timevar_MappedNullable=&Annotations{}
// Annotations struct for AnnotationstypeAnnotationsstruct {
}
// Code below has been omitted// ...
Steps to reproduce
openapi-generator-cli generate -i ./swagger_tmp.yaml -g go --generate-alias-as-model -o ./tmp_client
Uh oh!
There was an error while loading. Please reload this page.
Bug Report Checklist
Description
In go generator, empty Struct generated for top-level "additionalProperties" when "generateAliasAsModel=true".
openapi-generator version
tested 5.3.1, 6.4.0
OpenAPI declaration file content or url
Generation Details
swagger yaml contains a top level object with
additionalProperties
(in this case,Annotations
). For generation argument,generateAliasAsModel
is set to true to make it an individual model.Expected to get the model with a map field for the
additionalProperties
. However, an empty struct is generated.example code generated:
Steps to reproduce
Related issues/PRs
#391, #1296, #1729
Suggest a fix
The text was updated successfully, but these errors were encountered: