fix(ir): Add support for byte format in string validation
Fixes #1261
Overview
I've added a new Byte field to the String structure in the validate package.
This field is set to true when format: byte is specified in the string formats of OpenAPI.
When executing character length validation, if the Byte field is true, the length is verified using []byte instead of []rune.
[!NOTE] This change may not be necessary. According to the OpenAPI specification,
format: byteis specified for base64-encoded characters. If the characters used are those in base64 encoding, the length evaluation doesn't change during the[]byte -> string -> []runeconversion process. However, as mentioned in the issue, I suppose this change is necessary if we want to ensure validation behavior for more general bytes fields.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 73.93%. Comparing base (
12fe015) to head (63919c9). Report is 12 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #1296 +/- ##
==========================================
+ Coverage 73.92% 73.93% +0.01%
==========================================
Files 189 189
Lines 12855 12860 +5
==========================================
+ Hits 9503 9508 +5
Misses 2804 2804
Partials 548 548
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I think this should be opt-in.