Closed
Description
Is your feature request related to a problem? Please describe.
References to schemas that have not been processed yet are not supported now. See the example.
Describe the solution you'd like
I suggest to add models that are referenced without properties. And fill in the properties later. This adds the ability to refer to schemas that have not been processed yet.
Describe alternatives you've considered
Also it may also be easier to create all models without properties first, then add properties with second pass.
Additional context
Example OpenAPI:
openapi: 3.0.3
info:
title: 'Example'
version: 0.1.0
servers:
- url: 'http://example.com'
paths:
'/foo':
delete:
responses:
'200':
description: OK
components:
schemas:
Brother:
type: object
properties:
sister:
$ref: '#/components/schemas/Sister'
Sister:
type: object
properties:
brother:
$ref: '#/components/schemas/Brother'
Generator produces warnings and models package is empty.
Could not find reference in parsed models or enums
Reference(ref='#/components/schemas/Sister')
Could not find reference in parsed models or enums
Reference(ref='#/components/schemas/Brother')
I expect the generated models for Brother
and Sister
. Something like:
# models/brother.py
class Brother:
sister: Union[Unset, Sister] = UNSET
# models/sister.py
class Sister:
brother: Union[Unset, Brother] = UNSET