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
Thus, this code is incorrect: there is no guarantee that this byte array is valid utf-8. In fact it is not, so I consistently get errors that the key is too short because it is counting utf-8 runes rather than counting bytes.
What did you expect to see?
I would expect validation of format: bytes fields to be done over bytes, not converting to utf-8 runes
What did you see instead?
I see consistently incorrect length validation for format: bytes fields
The text was updated successfully, but these errors were encountered:
What version of ogen are you using?
v1.2.1
Can this issue be reproduced with the latest version?
Yes
What did you do?
I have a field in an API object with format: bytes and a length requirement:
This is generating code that looks like this in oas_validators_gen.go
This converts the byte array to a string and uses the string validator, which counts runes for length, not bytes:
Thus, this code is incorrect: there is no guarantee that this byte array is valid utf-8. In fact it is not, so I consistently get errors that the key is too short because it is counting utf-8 runes rather than counting bytes.
What did you expect to see?
I would expect validation of format: bytes fields to be done over bytes, not converting to utf-8 runes
What did you see instead?
I see consistently incorrect length validation for format: bytes fields
The text was updated successfully, but these errors were encountered: