Custom TYPE_MAPPING
See original GitHub issueI am extending the Schema
class from marshmallow for my schemas and extending the TYPE_MAPPING
attribute, but because of these lines here, the ModelConverter
doesn’t pick up my changes, because it hardcodes marshmallow’s Schema
class.
from datetime import datetime
from marshmallow import Schema
[...]
class BaseSchema(Schema):
TYPE_MAPPING = Schema.TYPE_MAPPING.copy()
TYPE_MAPPING.update({
datetime: APIDateTime,
})
def __init__(self, *args, **kwargs):
if 'strict' not in kwargs:
kwargs['strict'] = True
super(BaseSchema, self).__init__(*args, **kwargs)
How do I override the mapping in marshmallow-sqlalchemy for datetime => my own custom field?
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
bug: Kotlin type in custom type mapping can not be a ... - GitHub
bug: Kotlin type in custom type mapping can not be a Kotlin type #704 ... language = "kotlin" typeMapping = mutableMapOf("JSON" to "kotlin....
Read more >Entity Framework 6 Code First - Custom Type Mapping
Now I'm wondering if it's possible to define custom type mappings in Entity Framework. Pseudo: public class PhysicalAddressMap : ComplexType<PhysicalAddress>() ...
Read more >"Custom type mapping for is not specified or is invalid(Need ...
I am configuration "OracleCustomTypeMappingAttribute" attribute though by web.conifg. ... "Custom type mapping for 'QR.iPromansys.Common.UDT.
Read more >Schema and data type mapping in copy activity - Microsoft Learn
Learn about how copy activity in Azure Data Factory and Azure Synapse Analytics pipelines map schemas and data types from source data to ......
Read more >Create type mapping - ADM Help Centers - Micro Focus
Create value maps; Supported field type mappings; Mapping multiple types to a single type; Additional type mapping guidelines; Mapping custom ...
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
Hmm, not sure if I am misunderstanding your issue or not, but you could also do something like this if you wanted something resembling a custom
TYPE_MAPPING
in yourBaseSchema
:The only downside is that you need to remember to have your
Meta
classes extendBaseSchema.Meta
if you want to customize it further.Awesome, @sloria! Thank you.