to_dict() of `model` should respect attribute_map
See original GitHub issueWhile running to_dict method on the model attribute_map is not respected.
attribute_map = {
'service_name': 'serviceName',
'service_port': 'servicePort'
}
This results in bad yaml
- host: example.com
http:
paths:
- backend:
service_name: example-service
service_port: 8080
path: /
related:
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Convert Django Model object to dict with all of the fields intact
If your query is Model.Objects.get() : get() will return single instance so you can direct use __dict__ from your instance.
Read more >pandas.DataFrame.to_dict — pandas 1.5.2 documentation
Mapping subclass used for all Mappings in the return value. Can be the actual class or an empty instance of the mapping type...
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 Free
Top 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
instead of
obj.to_dict()
, I have found thatApiClient().sanitize_for_serialization(obj)
does the job to remap the snake_case names to camelCase (also filtering the None fields)This is a openapi-generator bug / intended behavior. It should be fixed in the generator