File tree 4 files changed +20
-8
lines changed
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 = {
75
75
"relative-json-pointer" : / ^ (?: 0 | [ 1 - 9 ] [ 0 - 9 ] * ) (?: # | (?: \/ (?: [ ^ ~ / ] | ~ 0 | ~ 1 ) * ) * ) $ / ,
76
76
// the following formats are used by the openapi specification: https://spec.openapis.org/oas/v3.0.0#data-types
77
77
// 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,
79
79
// signed 32 bit integer
80
80
int32 : { type : "number" , validate : validateInt32 } ,
81
81
// signed 64 bit integer
@@ -197,6 +197,13 @@ function uri(str: string): boolean {
197
197
return NOT_URI_FRAGMENT . test ( str ) && URI . test ( str )
198
198
}
199
199
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
+
200
207
const MIN_INT32 = - ( 2 ** 31 )
201
208
const MAX_INT32 = 2 ** 31 - 1
202
209
Original file line number Diff line number Diff line change 743
743
"data" : " VGhpcyBpcyBhIGJhc2U2NCBtdWx0aWxpbmUgc3RyaW5nIHRoYXQgc3BhbnMgbW9yZSB0aGFuIDc2\n IGNoYXJhY3RlcnMgdG8gdGVzdCBtdWx0aWxpbmUgY2FwYWJpbGl0aWVzCg==" ,
744
744
"valid" : true
745
745
},
746
+ {
747
+ "description" : " second round multiline base64" ,
748
+ "data" : " VGhpcyBpcyBhIGJhc2U2NCBtdWx0aWxpbmUgc3RyaW5nIHRoYXQgc3BhbnMgbW9yZSB0aGFuIDc2\n IGNoYXJhY3RlcnMgdG8gdGVzdCBtdWx0aWxpbmUgY2FwYWJpbGl0aWVzCg==" ,
749
+ "valid" : true
750
+ },
746
751
{
747
752
"description" : " Invalid base64" ,
748
753
"data" : " aGVsbG8gd29ybG=" ,
Original file line number Diff line number Diff line change 179
179
"valid" : false
180
180
},
181
181
{
182
- "description" : " same date, time before the minimum time is stillinvalid " ,
182
+ "description" : " same date, time before the minimum time is still invalid " ,
183
183
"data" : " 2015-08-17T10:33:55.000Z" ,
184
184
"valid" : false
185
185
},
Original file line number Diff line number Diff line change 4
4
"schema" : {"format" : " date-time" },
5
5
"tests" : [
6
6
{
7
- "description" : " valid positiive two digit" ,
7
+ "description" : " valid positive two digit" ,
8
8
"data" : " 2016-01-31T02:31:17+01" ,
9
9
"valid" : true
10
10
},
14
14
"valid" : true
15
15
},
16
16
{
17
- "description" : " valid positiive four digit no colon" ,
17
+ "description" : " valid positive four digit no colon" ,
18
18
"data" : " 2016-01-31T02:31:17+0130" ,
19
19
"valid" : true
20
20
},
24
24
"valid" : true
25
25
},
26
26
{
27
- "description" : " invalid positiive three digit no colon" ,
27
+ "description" : " invalid positive three digit no colon" ,
28
28
"data" : " 2016-01-31T02:31:17+013" ,
29
29
"valid" : false
30
30
},
40
40
"schema" : {"format" : " time" },
41
41
"tests" : [
42
42
{
43
- "description" : " valid positiive two digit" ,
43
+ "description" : " valid positive two digit" ,
44
44
"data" : " 02:31:17+01" ,
45
45
"valid" : true
46
46
},
50
50
"valid" : true
51
51
},
52
52
{
53
- "description" : " valid positiive four digit no colon" ,
53
+ "description" : " valid positive four digit no colon" ,
54
54
"data" : " 02:31:17+0130" ,
55
55
"valid" : true
56
56
},
60
60
"valid" : true
61
61
},
62
62
{
63
- "description" : " invalid positiive three digit no colon" ,
63
+ "description" : " invalid positive three digit no colon" ,
64
64
"data" : " 02:31:17+013" ,
65
65
"valid" : false
66
66
},
You can’t perform that action at this time.
0 commit comments