Provide a way to pass model_config (ConfigDict) to the generated schemas
Tatsh opened this issue · 3 comments
Tatsh commented
I would like to pass model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True, from_attributes=True)
to every generated schema and pass by_alias=True
to every generated API view. This allows use of camelcase.
Currently in ninja-extra ModelConfig
there is no way to apply properties to the generated schemas. I think at fault here is actually django-ninja's create_schema()
function for not accepting a way to customise the Config
or model_config
options.
I think my latter point is fixed by adding create_route_info={'by_alias': True}
or similar to the ModelConfig()
arguments.
eadwinCode commented
@Tatsh It's a good idea. I will look at the implementation again and see how this can be achieved