Skip to content

Support references to non-object types #371

Closed
@p1-alexandrevaney

Description

@p1-alexandrevaney

Describe the bug
root component schemas do not get parsed correctly, resolved to None

To Reproduce
Steps to reproduce the behavior:
openapi-python-client generate --path path_to_test.yaml

Expected behavior
The generated model Link should have href: Union[Unset, str] = UNSET as attribute
instead we have href: Union[Unset, None] = UNSET

OpenAPI Spec File

openapi: 3.0.0

info:
  version: '1'
  title: 'test file'
  description: 'description'

paths: {}

components:
  schemas:
    Link:
      type: object
      properties:
        href:
          Uri:
            type: string

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Python Version: 3.8.5
  • openapi-python-client version: up to date with main

Additional context

I am trying to build a 5g stack with the open source 5g api. This file in particular contains a lot of components schemas that get resolved to None

https://github.com/jdegre/5GC_APIs/blob/master/TS29571_CommonData.yaml

For example the Uri components is translated to

@attr.s(auto_attribs=True)
class Uri:
    """  """

    additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)

which does not seem right as it is only a type:string component

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions