marshmallow-sqlalchemy
marshmallow-sqlalchemy copied to clipboard
Don't set a field as required if it's read-only
This line shows that fields' required flag will only depend on whether they are nullable and have a default value:
https://github.com/marshmallow-code/marshmallow-sqlalchemy/blob/3754933b49554e6b7aa0ce282b43befb730dd7b2/src/marshmallow_sqlalchemy/convert.py#L427
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?