Wrong behaviour with allow_population_by_field_name
See original GitHub issuefrom typing import Dict, Any
from pydantic import BaseConfig, BaseModel, Extra, Field
BaseConfig.extra = Extra.forbid
BaseConfig.allow_population_by_field_name = True
class ItemChannelLinkDefinition(BaseModel):
item_name: str = Field(alias='itemName')
configuration: Dict[str, Any] = {}
ItemChannelLinkDefinition(item_name='asdf')
The Config switch allow_population_by_field_name
means that it’s allowed to use the field name in the constructor.
Unfortunately the plugin shows an error.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
allow_population_by_field_name expected behavior? #920
This seems no longer the case (see example below) since allow_population_by_field_name seems to allow population only by field name.
Read more >Is it possible to change the output alias in pydantic?
I only need this alias to correctly map the incoming data but when returning a response, I want to use actual field names....
Read more >COMMON ERRORS IN KRONOS AND HOW TO FIX THEM
Employee Error Details. Entering work hours before they have actually been worked. Employees are not allowed to record their work time until they...
Read more >How to Report Errors in Forms: 10 Design Guidelines
Help users recover from errors by clearly identifying the problems and allowing users to access and correct erroneous fields easily.
Read more >Preferred Terms for Select Population Groups & Communities
Using preferred terms for select population groups and communities is an important part of respectful communication. This section provides some recommended ...
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
Use a shared custom base model with its own config.
Thank you for your answer. I close this issue.