You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
how to force validation? I thought about something like this:
classAccountName(Annotated[str, ms.Meta(min_length=3, max_length=16, pattern="^([a-z]+)$")]):
def__init__(self, value: Any) ->None:
super().__init__(value)
msgspec.validate(self) # something like this
or
AccountNameImpl=Annotated[str, ms.Meta(min_length=3, max_length=16, pattern="^([a-z]+)$")]
defAccountName(value: str) ->AccountNameImpl:
result=AccountNameImpl(value)
msgspec.validate(result)
# msgspec.json.encode(result) # i don't want it to validate like thisreturnresult
But i can't find validate method and because of large amount of objects that are created in my project i don't want to encode to validate all the time. If dedicated method was exposed i can deal with this
The text was updated successfully, but these errors were encountered:
Question
I have example like this:
but this does not throw any error:
how to force validation? I thought about something like this:
or
But i can't find validate method and because of large amount of objects that are created in my project i don't want to encode to validate all the time. If dedicated method was exposed i can deal with this
The text was updated successfully, but these errors were encountered: