3
3
from pathlib import Path
4
4
from typing import Any , Dict , List , Optional , TypeVar , Union
5
5
6
- import pydantic
7
- from pydantic import Extra , Field
8
6
from typing_extensions import Literal
9
7
8
+ from samtranslator .compat import pydantic
10
9
from samtranslator .model .types import PassThrough
11
10
12
11
@@ -53,7 +52,7 @@ def passthrough_prop(sam_docs_stem: str, sam_docs_name: str, prop_path: List[str
53
52
for s in prop_path [1 :]:
54
53
path .extend (["properties" , s ])
55
54
docs = _DOCS ["properties" ][sam_docs_stem ][sam_docs_name ]
56
- return Field (
55
+ return pydantic . Field (
57
56
title = sam_docs_name ,
58
57
# We add a custom value to the schema containing the path to the pass-through
59
58
# documentation; the dict containing the value is replaced in the final schema
@@ -68,7 +67,7 @@ def passthrough_prop(sam_docs_stem: str, sam_docs_name: str, prop_path: List[str
68
67
69
68
def _get_prop (stem : str , name : str ) -> Any :
70
69
docs = _DOCS ["properties" ][stem ][name ]
71
- return Field (
70
+ return pydantic . Field (
72
71
title = name ,
73
72
# https://code.visualstudio.com/docs/languages/json#_use-rich-formatting-in-hovers
74
73
markdownDescription = docs ,
@@ -78,7 +77,7 @@ def _get_prop(stem: str, name: str) -> Any:
78
77
# By default strict: https://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally
79
78
class BaseModel (LenientBaseModel ):
80
79
class Config :
81
- extra = Extra .forbid
80
+ extra = pydantic . Extra .forbid
82
81
83
82
def __getattribute__ (self , __name : str ) -> Any :
84
83
"""Overloading get attribute operation to allow access PassThroughProp without using __root__"""
0 commit comments