Skip to content
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

Ability to configure custom Nested field class #238

Open
npalmius opened this issue Mar 31, 2023 · 0 comments
Open

Ability to configure custom Nested field class #238

npalmius opened this issue Mar 31, 2023 · 0 comments

Comments

@npalmius
Copy link

I have been using marshmallow-dataclass to improve the typing of Python input and output, and overall this has been excellent.

However, it would be great to have some way to configure a custom subclass of the marshmallow Nested field to use for nested dataclass properties when converted to a Schema.

For most other types, I have been able to customise the field type using the TYPE_MAPPING property in the base_schema, but this doesn't seem to be possible for Nested schema fields created from object properties in the dataclass as it looks to me like it's hard-coded in field_for_schema, and anyway the call signature for Nested fields is different to other fields because it takes the schema as a positional argument.

Ideally, I'd like to be able to configure this as a property on the base_schema (similar to TYPE_MAPPING) so that it propagates automatically.

I'd be happy to submit a pull request if it would help.

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