[BUG][Go] Golang client code is incorrect with presence of oneOf/allOF
See original GitHub issueDescription
We discovered that with presence of oneOf/allOf we have presence of UNKNOWN_BASE_TYPE instead of interface{} (or other know type)
OpenAPI Generator versions
Version tested :
- 5.0.1
- master
OpenAPI file
I tested a very simple openAPI v3 file :
openapi: 3.0.1
info:
description: test
title: test
version: 1.5.0
servers:
- url: v1
paths:
/pets:
patch:
requestBody:
content:
application/json:
schema:
discriminator:
propertyName: pet_type
oneOf:
- $ref: '#/components/schemas/Cat'
- $ref: '#/components/schemas/Dog'
responses:
"200":
description: Updated
components:
schemas:
Pet:
discriminator:
propertyName: pet_type
properties:
pet_type:
type: string
required:
- pet_type
type: object
Dog:
allOf:
- $ref: '#/components/schemas/Pet'
- $ref: '#/components/schemas/Dog_allOf'
Cat:
allOf:
- $ref: '#/components/schemas/Pet'
- $ref: '#/components/schemas/Cat_allOf'
Dog_allOf:
properties:
bark:
type: boolean
breed:
enum:
- Dingo
- Husky
- Retriever
- Shepherd
type: string
type: object
Cat_allOf:
properties:
hunts:
type: boolean
age:
type: integer
type: object
Actual behavior
- With both
go
andgo-deprecated
presence of UNKNOWN_BASE_TYPE which is not a known primitive type in golang
Expected behavior
- No compilation error
- At least a interface{} for oneOf
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:6 (1 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@wing328 , Thank you very much. I confirm it works well both in request and in response (tested with oneOf). We can close the ticket. Thanks !
Should be fixed in v6.0.0. Please give it another try.