Skip to content

Minor schema validation error: doesn't complain about invalid default for null and file types #1162

Open
@eli-bl

Description

@eli-bl

Describe the bug
NoneProperty.build and FileProperty.build do have logic to detect if a default other than None was provided for a null property, or if any default was provided for a binary string—and we do have unit tests for those. However, in reality NoneProperty.build and FileProperty.build do not actually get called, because property_from_data just calls the initializers directly instead. Therefore if you do something like this, the default is simply ignored.

OpenAPI Spec File

components:
  schemas:
    MyModel:
      properties:
        myNullProperty:
          type: "null"
          default: "definitely not null"
        myBinaryString:
          type: string
          format: binary
          default: "???"

Desktop (please complete the following information):

  • OS: any
  • Python Version: any
  • openapi-python-client version: 0.21.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions