File tree Expand file tree Collapse file tree 4 files changed +20
-8
lines changed Expand file tree Collapse file tree 4 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ export const fullFormats: DefinedFormats = {
7575 "relative-json-pointer" : / ^ (?: 0 | [ 1 - 9 ] [ 0 - 9 ] * ) (?: # | (?: \/ (?: [ ^ ~ / ] | ~ 0 | ~ 1 ) * ) * ) $ / ,
7676 // the following formats are used by the openapi specification: https://spec.openapis.org/oas/v3.0.0#data-types
7777 // byte: https://github.com/miguelmota/is-base64
78- byte : / ^ (?: [ A - Z a - z 0 - 9 + / ] { 4 } ) * (?: [ A - Z a - z 0 - 9 + / ] { 2 } = = | [ A - Z a - z 0 - 9 + / ] { 3 } = ) ? $ / gm ,
78+ byte,
7979 // signed 32 bit integer
8080 int32 : { type : "number" , validate : validateInt32 } ,
8181 // signed 64 bit integer
@@ -197,6 +197,13 @@ function uri(str: string): boolean {
197197 return NOT_URI_FRAGMENT . test ( str ) && URI . test ( str )
198198}
199199
200+ const BYTE = / ^ (?: [ A - Z a - z 0 - 9 + / ] { 4 } ) * (?: [ A - Z a - z 0 - 9 + / ] { 2 } = = | [ A - Z a - z 0 - 9 + / ] { 3 } = ) ? $ / gm
201+
202+ function byte ( str : string ) : boolean {
203+ BYTE . lastIndex = 0
204+ return BYTE . test ( str )
205+ }
206+
200207const MIN_INT32 = - ( 2 ** 31 )
201208const MAX_INT32 = 2 ** 31 - 1
202209
Original file line number Diff line number Diff line change 743743 "data" : " VGhpcyBpcyBhIGJhc2U2NCBtdWx0aWxpbmUgc3RyaW5nIHRoYXQgc3BhbnMgbW9yZSB0aGFuIDc2\n IGNoYXJhY3RlcnMgdG8gdGVzdCBtdWx0aWxpbmUgY2FwYWJpbGl0aWVzCg==" ,
744744 "valid" : true
745745 },
746+ {
747+ "description" : " second round multiline base64" ,
748+ "data" : " VGhpcyBpcyBhIGJhc2U2NCBtdWx0aWxpbmUgc3RyaW5nIHRoYXQgc3BhbnMgbW9yZSB0aGFuIDc2\n IGNoYXJhY3RlcnMgdG8gdGVzdCBtdWx0aWxpbmUgY2FwYWJpbGl0aWVzCg==" ,
749+ "valid" : true
750+ },
746751 {
747752 "description" : " Invalid base64" ,
748753 "data" : " aGVsbG8gd29ybG=" ,
Original file line number Diff line number Diff line change 179179 "valid" : false
180180 },
181181 {
182- "description" : " same date, time before the minimum time is stillinvalid " ,
182+ "description" : " same date, time before the minimum time is still invalid " ,
183183 "data" : " 2015-08-17T10:33:55.000Z" ,
184184 "valid" : false
185185 },
Original file line number Diff line number Diff line change 44 "schema" : {"format" : " date-time" },
55 "tests" : [
66 {
7- "description" : " valid positiive two digit" ,
7+ "description" : " valid positive two digit" ,
88 "data" : " 2016-01-31T02:31:17+01" ,
99 "valid" : true
1010 },
1414 "valid" : true
1515 },
1616 {
17- "description" : " valid positiive four digit no colon" ,
17+ "description" : " valid positive four digit no colon" ,
1818 "data" : " 2016-01-31T02:31:17+0130" ,
1919 "valid" : true
2020 },
2424 "valid" : true
2525 },
2626 {
27- "description" : " invalid positiive three digit no colon" ,
27+ "description" : " invalid positive three digit no colon" ,
2828 "data" : " 2016-01-31T02:31:17+013" ,
2929 "valid" : false
3030 },
4040 "schema" : {"format" : " time" },
4141 "tests" : [
4242 {
43- "description" : " valid positiive two digit" ,
43+ "description" : " valid positive two digit" ,
4444 "data" : " 02:31:17+01" ,
4545 "valid" : true
4646 },
5050 "valid" : true
5151 },
5252 {
53- "description" : " valid positiive four digit no colon" ,
53+ "description" : " valid positive four digit no colon" ,
5454 "data" : " 02:31:17+0130" ,
5555 "valid" : true
5656 },
6060 "valid" : true
6161 },
6262 {
63- "description" : " invalid positiive three digit no colon" ,
63+ "description" : " invalid positive three digit no colon" ,
6464 "data" : " 02:31:17+013" ,
6565 "valid" : false
6666 },
You can’t perform that action at this time.
0 commit comments