Skip to content

V2 - Add config for DictAble and option to auto strip string - #49

Open
gowthamvbhat wants to merge 2 commits into
mainfrom
add/v2_config_with_strip
Open

V2 - Add config for DictAble and option to auto strip string#49
gowthamvbhat wants to merge 2 commits into
mainfrom
add/v2_config_with_strip

Conversation

@gowthamvbhat

Copy link
Copy Markdown
Collaborator

Inspired from ConfigDict -> str_strip_whitespace from Pydantic - https://docs.pydantic.dev/latest/api/config/#pydantic.config.ConfigDict.str_strip_whitespace

@gowthamvbhat
gowthamvbhat requested a review from pskd73 as a code owner August 10, 2024 17:07
@gowthamvbhat

Copy link
Copy Markdown
Collaborator Author

V1 implementation - #48

Comment thread pydictable/core.py
fields[attr[0]] = attr[1]
for name, th in get_type_hints(cls).items():
if name not in fields:
if name not in fields and th not in _IGNORE_TYPES:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we call it ignore keys or ignore attributes?

Comment thread pydictable/core.py
value = d.get(self.get_field_key(attr))
if not field.required and value is None:
continue
field.config = self._config

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of assigning it, can we pass it while running the field? To from_dict or to_dicts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants