File tree 5 files changed +66
-0
lines changed
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):
87
87
pytest .skip ("Computed fields are a pydantic v2 feature" )
88
88
run_test (tmpdir , "computed_fields" )
89
89
90
+ def test_extra_fields (tmpdir ):
91
+ run_test (tmpdir , "extra_fields" )
92
+
90
93
91
94
def test_relative_filepath (tmpdir ):
92
95
test_name = "single_module"
You can’t perform that action at this time.
0 commit comments