Skip to content

Add support for recursively defined schemas #338

Closed
@sp-schoen

Description

@sp-schoen

Describe the bug
I tried to create a python client from an OpenApi-Spec with the command openapi-python-client generate --path secret_server_openapi3.json. Then I got multple warnings:

  • invalid data in items of array settings
  • Could not find reference in parsed models or enums
  • Cannot parse response for status code 200, response will be ommitted from generated client
    I searched the schemas, which are responsible for the errors and they all had in common, that they either reference another schema which is recursively defined or reference themself.
    For example one of the problematic schemas:
{
  "SecretDependencySetting": {
        "type": "object",
        "properties": {
          "active": {
            "type": "boolean",
            "description": "Indicates the setting is active."
          },
          "childSettings": {
            "type": "array",
            "description": "The Child Settings that would be used  for list of options.",
            "items": {
              "$ref": "#/components/schemas/SecretDependencySetting"
            }
          }
        },
        "description": "Secret Dependency Settings - Mostly used internally"
      }
}

To Reproduce
Define a schema recursively and then try to create a client from it.

Expected behavior
The software can also parse a recursively defined schema.

OpenAPI Spec File
It's 66000 Lines, so I'm not sure if this will help you, or github will allow me to post it 😄
Just ask if you need specific parts of the spec, aside from what I already provided above.

Desktop (please complete the following information):

  • OS: Linux Manjaro
  • Python Version: 3.9.1
  • openapi-python-client version 0.7.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions