OpenAPITools / OpenAPITools/openapi-generator
[BUG][golang] NullableInt32 and AnyOfstringstring are not generated for golang
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
hi
I have this yaml file.
openapi: 3.0.0
info:
version: '1.0.0'
title: 'Types'
paths: {}
components:
schemas:
AdditionalQosFlowInfo:
anyOf:
- anyOf:
- type: string
enum:
- MORE_LIKELY
- type: string
- $ref: '#/components/schemas/NullValue'
Arp:
type: object
properties:
priorityLevel:
$ref: '#/components/schemas/ArpPriorityLevel'
required:
- priorityLevel
ArpPriorityLevel:
type: integer
nullable: true
NullValue:
enum:
- null
there is a nullable type in it and an anyof/anyof type.
When I genarte go models for this, the generator does not generate NullableInt32 and AnyOfstringstring models, but there are some reference in the generated models, which are using those
E.g.
type Arp struct {
// nullable true shall not be used for this attribute
PriorityLevel NullableInt32 `json:"priorityLevel"`
}
type AdditionalQosFlowInfo struct {
AnyOfstringstring *AnyOfstringstring
NullValue *NullValue
}
But there is no model for this NullableInt32 and for AnyOfstringstring, so it shows an error....
Can you tell me what I am doing wrong? Why this is not generated? Or am I misunderstand something?
thanks
Akos
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied OpenAPI 3 YAML and the Go model-generation entry point; inspect how nullable integer and nested anyOf schemas are discovered versus referenced. Compare the generated Arp and AdditionalQosFlowInfo declarations with the missing NullableInt32 and AnyOfstringstring definitions, then confirm the corrected output compiles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100