openapi-generators/openapi-python-client

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

eli-bl opened this issue · 0 comments

eli-bl commented

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