Skip to content

Is there any way to generate models with pydantic.PrivateAttr fields? #1055

Answered by koxudaxi
balu211221 asked this question in Q&A
Discussion options

You must be logged in to vote

@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?

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@koxudaxi
Comment options

@balu211221
Comment options

Answer selected by balu211221
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants