Skip to content

Don't set a field as required if it's read-only #672

@zedrdave

Description

@zedrdave

This line shows that fields' required flag will only depend on whether they are nullable and have a default value:

kwargs["required"] = not column.nullable and not _has_default(column)

But we're running into cases where certain fields (eg relations for which we want to enforce loading through the foreign key, but still want dumping the whole nested schema) are marked as required even though they are also dump_only.

Any reason for not including not dump_only as a condition for marking as required?

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