Allow adding custom types to _native_to_marshmallow
See original GitHub issueFollow up to #15, this is to suggest exposting _native_to_marshmallow
publicly or, better yet, allow registring custom types to the list for more flexibility on the types that could be user-defined and which fields these types should translate to.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Quickstart — marshmallow 3.19.0 documentation
Want to create your own field type? See the Custom Fields page. Need to add schema-level validation, post-processing, or error handling behavior? See...
Read more >Object validation and conversion with Marshmallow in Python
Marshmallow is a Python library that converts complex data types to and from Python data types. It is a powerful tool for both...
Read more >How to use marshmallow to serialize a custom sqlalchemy field?
The ModelConverter class has a SQLA_TYPE_MAPPING attribute you can override in a subclass to add your custom GUID field to the types detected...
Read more >Make typing easier for custom types defined by marshmallow ...
I've been giving it a look, but I'm a bit puzzled about which types are required and which are not. For example, Email...
Read more >marshmallow - Read the Docs
To create a custom field class, create a subclass of marshmallow.fields. ... Serialize an object to native Python data types according to this...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There was an idea introduced in another issue (#23) That I think could work very well here:
The idea is to have a NewType implementation that works the same as typing.NewType, but also stores all the field metadata that we would normally store on a dataclass field, like validation functions and marshmallow_field selections.
Thoughts?
I would also find this valuable… a mapping you can can pass to
class_schema
that gets merged with_native_to_marshmallow
.