Skip to content

Use Any for schemas with no type #389

Closed
@forest-benchling

Description

@forest-benchling

Describe the bug
When there's a model property with no type field, it causes a NoneProperty to be generated. I believe that according to JSONSchema, if there is no type specified, it should accept any type (though I'm not 100% sure; see conflicting answers in this thread https://stackoverflow.com/questions/29230349/is-type-optional-in-json-schema). It does seem more logical to compile to Any rather than None, since there's already type: null in JSONSchema.

To Reproduce
Add a model with a property with no type, such as:

    Field:
      type: object
      properties:
        value:
		  description: Field value

Expected behavior
Expected the generated field.py model to have value: Any.

OpenAPI Spec File
See above

Desktop (please complete the following information):

  • OS: [e.g. macOS 10.15.1]
  • Python Version: [e.g. 3.8.0]
  • openapi-python-client version [e.g. 0.1.0]

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