Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
eli-bl opened this issue Nov 8, 2024 · 0 comments

Comments

@eli-bl
Copy link
Collaborator

eli-bl commented Nov 8, 2024

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 eli-bl changed the title Minor schema validation error: doesn't complain about non-null default for null type Minor schema validation error: doesn't complain about invalid default for null and file types Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant