File tree Expand file tree Collapse file tree 5 files changed +66
-0
lines changed Expand file tree Collapse file tree 5 files changed +66
-0
lines changed Original file line number Diff line number Diff line change 1+ from pydantic import BaseModel , Extra
2+
3+
4+ class ModelAllow (BaseModel , extra = Extra .allow ):
5+ a : str
6+
7+ class ModelDefault (BaseModel ):
8+ a : str
9+
Original file line number Diff line number Diff line change 1+ /* tslint:disable */
2+ /* eslint-disable */
3+ /**
4+ /* This file was automatically generated from pydantic models by running pydantic2ts.
5+ /* Do not modify it by hand - just update the pydantic models and then re-run the script
6+ */
7+
8+ export interface ModelAllow {
9+ a : string ;
10+ [ k : string ] : unknown ;
11+ }
12+ export interface ModelDefault {
13+ a : string ;
14+ }
Original file line number Diff line number Diff line change 1+ from pydantic import BaseModel , ConfigDict
2+
3+
4+ class ModelExtraAllow (BaseModel ):
5+ model_config = ConfigDict (extra = "allow" )
6+ a : str
7+
8+
9+ class ModelExtraForbid (BaseModel ):
10+ model_config = ConfigDict (extra = "forbid" )
11+ a : str
12+
13+
14+ class ModelExtraIgnore (BaseModel ):
15+ model_config = ConfigDict (extra = "ignore" )
16+ a : str
17+
18+
19+ class ModelExtraNone (BaseModel ):
20+ a : str
Original file line number Diff line number Diff line change 1+ /* tslint:disable */
2+ /* eslint-disable */
3+ /**
4+ /* This file was automatically generated from pydantic models by running pydantic2ts.
5+ /* Do not modify it by hand - just update the pydantic models and then re-run the script
6+ */
7+
8+ export interface ModelExtraAllow {
9+ a : string ;
10+ [ k : string ] : unknown ;
11+ }
12+ export interface ModelExtraForbid {
13+ a : string ;
14+ }
15+ export interface ModelExtraIgnore {
16+ a : string ;
17+ }
18+ export interface ModelExtraNone {
19+ a : string ;
20+ }
Original file line number Diff line number Diff line change @@ -87,6 +87,9 @@ def test_computed_fields(tmpdir):
8787 pytest .skip ("Computed fields are a pydantic v2 feature" )
8888 run_test (tmpdir , "computed_fields" )
8989
90+ def test_extra_fields (tmpdir ):
91+ run_test (tmpdir , "extra_fields" )
92+
9093
9194def test_relative_filepath (tmpdir ):
9295 test_name = "single_module"
You can’t perform that action at this time.
0 commit comments