openapi-python-client icon indicating copy to clipboard operation
openapi-python-client copied to clipboard

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

Open eli-bl opened this issue 1 year ago • 0 comments

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

eli-bl avatar Nov 08 '24 22:11 eli-bl