-
-
Notifications
You must be signed in to change notification settings - Fork 262
Closed
Labels
🍭 OpenAPI ComplianceSupporting a new bit of the OpenAPI specSupporting a new bit of the OpenAPI spec
Description
Describe the bug
If swagger.json contains a reference like:
"SchemaA": {
"$ref": "#/components/schemas/SchemaB"
},
python client unable to generate a proper model for this definition
To Reproduce
Steps to reproduce the behavior:
- Define a swagger.json that contains a reference to another model
- Generate a client
openapi-python-client generate --path swagger.json
Expected behavior
Client should contain generated endpoint and contain a model
OpenAPI Spec File
{
"components": {
"examples": {},
"headers": {},
"parameters": {},
"requestBodies": {},
"responses": {},
"schemas": {
"SchemaB_string_": {
"properties": {
"foo": {
"type": "string"
}
},
"required": [
"foo"
],
"type": "object",
"additionalProperties": true
},
"SchemaA": {
"$ref": "#/components/schemas/SchemaB_string_"
}
},
"securitySchemes": {}
},
"info": {
"title": "bar-service",
"version": "1.0.0",
"description": "bar service",
"license": {
"name": "ISC"
}
},
"openapi": "3.0.0",
"paths": {
"/foo": {
"post": {
"operationId": "Foo",
"responses": {
"200": {
"description": "Ok",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SchemaA"
}
}
}
}
},
"tags": [
"foobar"
],
"security": [],
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SchemaA"
}
}
}
}
}
}
},
"servers": [
{
"url": "/"
}
]
}
Desktop (please complete the following information):
- OS: macOS
- Python Version: 3.9.9
- openapi-python-client version: 0.13.1
Additional context
Stdout:
Generating bar-service-client
Warning(s) encountered while generating. Client was generated, but some pieces may be missing
WARNING parsing POST /foo within foobar. Endpoint will not be generated.
Could not find reference in parsed models or enums
Reference(ref='#/components/schemas/SchemaA')
Unable to parse this part of your OpenAPI document:
Reference schemas are not supported.
Reference(ref='#/components/schemas/SchemaB_string_')
maxkomarychev, MalteEbner, fwille, joaonc, ronenmiller and 8 more
Metadata
Metadata
Assignees
Labels
🍭 OpenAPI ComplianceSupporting a new bit of the OpenAPI specSupporting a new bit of the OpenAPI spec