Coverage for src / rendercv / schema / models / base.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-03-25 13:49 +0000

1import pydantic 

2 

3 

4class BaseModelWithoutExtraKeys(pydantic.BaseModel): 

5 """Pydantic base model that rejects unrecognized fields. 

6 

7 Why: 

8 Most RenderCV models have fixed schemas. Forbidding extra keys 

9 catches typos and unsupported fields early during YAML validation, 

10 giving users clear error messages instead of silently ignoring 

11 misspelled options. 

12 """ 

13 

14 model_config = pydantic.ConfigDict(extra="forbid", validate_default=True) 

15 

16 

17class BaseModelWithExtraKeys(pydantic.BaseModel): 

18 """Pydantic base model that allows unrecognized fields. 

19 

20 Why: 

21 Entry models need to accept extra keys so that template-generated 

22 fields (like rendered date strings) can be attached as dynamic 

23 attributes during processing without validation errors. 

24 """ 

25 

26 model_config = pydantic.ConfigDict(extra="allow", validate_default=True)