art049 / art049/odmantic

Support `pydantic.BaseModel.Config.underscore_attrs_are_private`

Open
#145 2 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
Python
Stars
1.2k
Forks
97
PR merge metrics
No merged PRs in 30d

Description

# Feature request
Support using the `underscore_attrs_are_private` config in models.

### Context
I use pydantic's `underscore_attrs_are_private` feature to have field in my pydantic models that are are not public.

```python
from odmantic import Model

class Example(Model)
class Config:
underscore_attrs_are_private = True
```

`odmantic.config.py` raises `ValueError: 'Example': 'Config.underscore_attrs_are_private' is not supported`

### Solution

Be able to use `.Config.underscore_attrs_are_private` without an error being raised.

#### Alternative solutions

None.

### Additional context

None.

Contributor guide

Open the contributing guide

Research direction

Start by reading odmantic.config.py, where the ValueError for Config.underscore_attrs_are_private is raised, and trace how model configuration is validated. Done means an odmantic Model can set this Pydantic configuration option without the unsupported-configuration error.

Written by the indexing model from the issue text.

Assessment

Tech stack
mongodb, python
Domain
databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.