OpenAPITools / OpenAPITools/openapi-generator

[BUG] Go client generate Wrong object name when using free form object

Open
#17,924 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
Description

when using free form object, the go client generator generates the wrong object name with "{}"

when using - $ref: '#/components/schemas/EmptyObject', it will generate MapmapOfStringinterface{}

openapi-generator version

v7.3.0

OpenAPI declaration file content or url
    RiskPolicyAction:
      type: object
      description: The data for risk condition.
      properties:
        type:
          $ref: '#/components/schemas/RiskPolicyActionType'
        content:
          description: 'Structured action data, JSON encoded'
          oneOf:
            - $ref: '#/components/schemas/RiskQuorumActionContent'
            - $ref: '#/components/schemas/RiskWorkflowActionContent'
            - $ref: '#/components/schemas/EmptyObject'
            
    EmptyObject:
      type: object
      description: The data for empty object.

  -->

##### Generation Details

`// RiskPolicyActionContent - Structured action data, JSON encoded
type RiskPolicyActionContent struct {
	RiskQuorumActionContent *RiskQuorumActionContent
	RiskWorkflowActionContent *RiskWorkflowActionContent
	MapmapOfStringinterface{} *map[string]interface{}
}
`
##### Steps to reproduce


##### Related issues/PRs


##### Suggest a fix

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Go client generator and the OpenAPI declaration in this issue, then reproduce the output using the v7.3.0 example with the EmptyObject free-form schema. Compare the generated RiskPolicyActionContent member name with the intended model naming, and verify that regeneration produces a valid, correctly named field.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.