Closed medved72 closed 2 years ago
I have default example from https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/ :
{ "openapi": "3.0.1", "info": { "title": "OOG Reports API", "version": "v1" }, "paths": { "/pets": { "patch": { "requestBody": { "content": { "application/json": { "schema": { "oneOf": [ { "$ref": "#/components/schemas/Cat" }, { "$ref": "#/components/schemas/Dog" } ], "discriminator": { "propertyName": "pet_type" } } } } }, "responses": { "200": { "description": "Updated" } } } } }, "components": { "schemas": { "Pet": { "type": "object", "properties": { "pet_type": { "type": "string" } }, "discriminator": { "propertyName": "pet_type" } }, "Dog": { "allOf": [ { "$ref": "#/components/schemas/Pet" }, { "type": "object", "properties": { "bark": { "type": "boolean" }, "breed": { "type": "string", "enum": [ "Dingo", "Husky", "Retriever", "Shepherd" ] } } } ] }, "Cat": { "allOf": [ { "$ref": "#/components/schemas/Pet" }, { "type": "object", "properties": { "hunts": { "type": "boolean" }, "age": { "type": "integer" } } } ] } } } }
When i try generate from this json scheme then i get empty interfaces:
export interface Pet { /** */ pet_type?: string; } export interface Dog {} export interface Cat {}
@arkraft @will7200 can you help him?
codegen doesn't account for top level entities for allOf or oneOf. If you assign the allOf to a property of a model it works as intended.
I have default example from https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/ :
When i try generate from this json scheme then i get empty interfaces: