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

Provide a way to pass model_config (ConfigDict) to the generated schemas #174

Open
Tatsh opened this issue Aug 9, 2024 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@Tatsh
Copy link

Tatsh commented Aug 9, 2024

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
Copy link
Owner

@Tatsh It's a good idea. I will look at the implementation again and see how this can be achieved

@eadwinCode eadwinCode added the enhancement New feature or request label Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants