-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(python): Support wrapped aliases for Pydantic v2 #5115
feat(python): Support wrapped aliases for Pydantic v2 #5115
Conversation
module_path=("pydantic",), | ||
), | ||
), | ||
import_=Pydantic.PydanticImport(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this for easier reference in other codepaths
def _model_validator(self, pre: bool = False) -> AST.FunctionInvocation: | ||
return AST.FunctionInvocation( | ||
function_definition=AST.Reference( | ||
qualified_name_excluding_import=("model_validator",), | ||
import_=Pydantic.PydanticImport(), | ||
), | ||
kwargs=[("mode", AST.Expression(expression='"before"' if pre else '"after"'))], | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like having this as part of the class, but I also don't know where you store utility files in your repo. Feel free to move!
c0409db
into
fern-api:dsinghvi/v2-wrapped-aliases
RootModel
andmodel_validator
on their validatorsRootModel
does not supportextra
as a keyword nor does it supportfrozen
behavior well`, so we omit those from the model behavior here