Skip to content

fields.Constant with required=True flag raised load_default warning #2900

@nosnickid

Description

@nosnickid

I have a schema containing a Constant, with required=True set, as the schema is ultimately exported to an OpenAPI spec, and the field must be marked as required there.

The fix from #2894 now triggers the validation failure in

if required is True and load_default is not missing_:

My feeling on the fix is to undo the changes from #2894 and instead reproduce the allow_none flag initialization in Constant.__init__

Happy to create a PR if you'd be happy with this fix.

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