Created by: frecco75
This PR fixes kotlin classes generation with inherited models in the source schema.
For example given this schema
openapi: "3.0.1"
info:
version: 1.0.0
title: Users
paths:
/users:
get:
responses:
200:
description: users
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
components:
schemas:
User:
type: object
required:
- name
properties:
name:
type: string
discriminator:
propertyName: type
Admin:
title: Admin
allOf:
- $ref: '#/components/schemas/User'
- type: object
required:
- role
properties:
role:
type: string
With the fix the generated code is valid and compiles correctly.
Moreover, it's better to use JsonTypeInfo.As.EXISTING_PROPERTY
to avoid duplicate name
in the JSON response