Replies: 1 comment
-
|
You can check that field is if isinstance(val, (SecretStr, SecretBytest)):
...But I agree with you, it will be logical to merge common functionally of secret classes into one class. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I discovered the very useful
SecretStrandSecretBytesfield types to store sensible informations.I can see that both field types are separate concrete instances https://github.com/samuelcolvin/pydantic/blob/4a54f393ad20ee91b51cd7a49ec46771ba4f8a18/pydantic/types.py#L740 and don't have a common class.
I reckon that a common class will be useful to identify if a field is secret without checking the presence of the
get_secret_value()method but I'm not sure if this architectural decision has been made for other reasons (i.e. performance).What are your thoughts about this?
Beta Was this translation helpful? Give feedback.
All reactions