Is there any way to generate models with pydantic.PrivateAttr fields? #1055
Answered
by
koxudaxi
balu211221
asked this question in
Q&A
-
Is there any option to generate a field as pydantic.PrivateAttr Ref: https://docs.pydantic.dev/usage/models/#private-model-attributes |
Beta Was this translation helpful? Give feedback.
Answered by
koxudaxi
Jan 26, 2023
Replies: 1 comment 2 replies
-
@balu211221 |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
balu211221
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@balu211221
We can't define fields with PrivateAttr.
But, we can generate field name with
_
prefix.Pydantic supports
Config.underscore_attrs_are_private
for_
prefix field.Can this way cover your use-case?