Skip to content

Commit 4ed592b

Browse files
committed
test: add valibot numberTypeToValibotSchema tests
1 parent f2e124a commit 4ed592b

File tree

7 files changed

+2836
-0
lines changed

7 files changed

+2836
-0
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
{
2+
"openapi": "3.1.0",
3+
"info": {
4+
"title": "Number Type Const Values Test API",
5+
"version": "1.0.0"
6+
},
7+
"paths": {},
8+
"components": {
9+
"schemas": {
10+
"NumberNoFormat": {
11+
"type": "number",
12+
"const": 42.5
13+
},
14+
"IntegerNoFormat": {
15+
"type": "integer",
16+
"const": -1
17+
},
18+
"NumberInt8": {
19+
"type": "number",
20+
"format": "int8",
21+
"const": 100
22+
},
23+
"NumberInt16": {
24+
"type": "number",
25+
"format": "int16",
26+
"const": 1000
27+
},
28+
"NumberInt32": {
29+
"type": "number",
30+
"format": "int32",
31+
"const": 100000
32+
},
33+
"NumberInt64": {
34+
"type": "number",
35+
"format": "int64",
36+
"const": 1000000000000
37+
},
38+
"NumberUint8": {
39+
"type": "number",
40+
"format": "uint8",
41+
"const": 200
42+
},
43+
"NumberUint16": {
44+
"type": "number",
45+
"format": "uint16",
46+
"const": 50000
47+
},
48+
"NumberUint32": {
49+
"type": "number",
50+
"format": "uint32",
51+
"const": 3000000000
52+
},
53+
"NumberUint64": {
54+
"type": "number",
55+
"format": "uint64",
56+
"const": 18000000000000000000
57+
},
58+
"IntegerInt8": {
59+
"type": "integer",
60+
"format": "int8",
61+
"const": -100
62+
},
63+
"IntegerInt16": {
64+
"type": "integer",
65+
"format": "int16",
66+
"const": -1000
67+
},
68+
"IntegerInt32": {
69+
"type": "integer",
70+
"format": "int32",
71+
"const": -100000
72+
},
73+
"IntegerInt64": {
74+
"type": "integer",
75+
"format": "int64",
76+
"const": -1000000000000
77+
},
78+
"IntegerUint8": {
79+
"type": "integer",
80+
"format": "uint8",
81+
"const": 255
82+
},
83+
"IntegerUint16": {
84+
"type": "integer",
85+
"format": "uint16",
86+
"const": 65535
87+
},
88+
"IntegerUint32": {
89+
"type": "integer",
90+
"format": "uint32",
91+
"const": 4294967295
92+
},
93+
"IntegerUint64": {
94+
"type": "integer",
95+
"format": "uint64",
96+
"const": 1000000000000
97+
},
98+
"StringInt64": {
99+
"type": "string",
100+
"format": "int64",
101+
"const": "-9223372036854775808"
102+
},
103+
"StringUint64": {
104+
"type": "string",
105+
"format": "uint64",
106+
"const": "18446744073709551615"
107+
},
108+
"StringInt64n": {
109+
"type": "string",
110+
"format": "int64",
111+
"const": "-9223372036854775808n"
112+
},
113+
"StringUint64n": {
114+
"type": "string",
115+
"format": "uint64",
116+
"const": "18446744073709551615n"
117+
}
118+
}
119+
}
120+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
{
2+
"openapi": "3.1.0",
3+
"info": {
4+
"title": "Integer Formats Test",
5+
"version": "1.0.0"
6+
},
7+
"components": {
8+
"schemas": {
9+
"NumberNoFormat": {
10+
"type": "number"
11+
},
12+
"NumberInt8": {
13+
"type": "number",
14+
"format": "int8"
15+
},
16+
"NumberInt16": {
17+
"type": "number",
18+
"format": "int16"
19+
},
20+
"NumberInt32": {
21+
"type": "number",
22+
"format": "int32"
23+
},
24+
"NumberInt64": {
25+
"type": "number",
26+
"format": "int64"
27+
},
28+
"NumberUint8": {
29+
"type": "number",
30+
"format": "uint8"
31+
},
32+
"NumberUint16": {
33+
"type": "number",
34+
"format": "uint16"
35+
},
36+
"NumberUint32": {
37+
"type": "number",
38+
"format": "uint32"
39+
},
40+
"NumberUint64": {
41+
"type": "number",
42+
"format": "uint64"
43+
},
44+
"IntegerNoFormat": {
45+
"type": "integer"
46+
},
47+
"IntegerInt8": {
48+
"type": "integer",
49+
"format": "int8"
50+
},
51+
"IntegerInt16": {
52+
"type": "integer",
53+
"format": "int16"
54+
},
55+
"IntegerInt32": {
56+
"type": "integer",
57+
"format": "int32"
58+
},
59+
"IntegerInt64": {
60+
"type": "integer",
61+
"format": "int64"
62+
},
63+
"IntegerUint8": {
64+
"type": "integer",
65+
"format": "uint8"
66+
},
67+
"IntegerUint16": {
68+
"type": "integer",
69+
"format": "uint16"
70+
},
71+
"IntegerUint32": {
72+
"type": "integer",
73+
"format": "uint32"
74+
},
75+
"IntegerUint64": {
76+
"type": "integer",
77+
"format": "uint64"
78+
},
79+
"StringInt64": {
80+
"type": "string",
81+
"format": "int64"
82+
},
83+
"StringUint64": {
84+
"type": "string",
85+
"format": "uint64"
86+
}
87+
}
88+
}
89+
}
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
{
2+
"openapi": "3.1.0",
3+
"info": {
4+
"title": "Number Type Min/Max Constraints Test API",
5+
"version": "1.0.0"
6+
},
7+
"paths": {},
8+
"components": {
9+
"schemas": {
10+
"NumberWithMinimum": {
11+
"type": "number",
12+
"minimum": 10
13+
},
14+
"NumberWithMaximum": {
15+
"type": "number",
16+
"maximum": 100
17+
},
18+
"NumberWithMinMax": {
19+
"type": "number",
20+
"minimum": 0,
21+
"maximum": 100
22+
},
23+
"IntegerWithMinimum": {
24+
"type": "integer",
25+
"minimum": 5
26+
},
27+
"IntegerWithMaximum": {
28+
"type": "integer",
29+
"maximum": 999
30+
},
31+
"IntegerWithMinMax": {
32+
"type": "integer",
33+
"minimum": 1,
34+
"maximum": 999
35+
},
36+
"NumberWithExclusiveMin": {
37+
"type": "number",
38+
"exclusiveMinimum": 0
39+
},
40+
"NumberWithExclusiveMax": {
41+
"type": "number",
42+
"exclusiveMaximum": 100
43+
},
44+
"NumberWithExclusiveMinMax": {
45+
"type": "number",
46+
"exclusiveMinimum": 0,
47+
"exclusiveMaximum": 1
48+
},
49+
"IntegerWithExclusiveMin": {
50+
"type": "integer",
51+
"exclusiveMinimum": 10
52+
},
53+
"IntegerWithExclusiveMax": {
54+
"type": "integer",
55+
"exclusiveMaximum": 50
56+
},
57+
"IntegerWithExclusiveMinMax": {
58+
"type": "integer",
59+
"exclusiveMinimum": 5,
60+
"exclusiveMaximum": 15
61+
},
62+
"NumberWithExclusiveMinInclusiveMax": {
63+
"type": "number",
64+
"exclusiveMinimum": 10,
65+
"maximum": 90
66+
},
67+
"NumberWithInclusiveMinExclusiveMax": {
68+
"type": "number",
69+
"minimum": 20,
70+
"exclusiveMaximum": 80
71+
},
72+
"IntegerWithExclusiveMinInclusiveMax": {
73+
"type": "integer",
74+
"exclusiveMinimum": 5,
75+
"maximum": 50
76+
},
77+
"IntegerWithInclusiveMinExclusiveMax": {
78+
"type": "integer",
79+
"minimum": 10,
80+
"exclusiveMaximum": 100
81+
},
82+
"Int64WithMinimum": {
83+
"type": "integer",
84+
"format": "int64",
85+
"minimum": -5000000000000
86+
},
87+
"Int64WithMaximum": {
88+
"type": "integer",
89+
"format": "int64",
90+
"maximum": 5000000000000
91+
},
92+
"Int64WithMinMax": {
93+
"type": "integer",
94+
"format": "int64",
95+
"minimum": -4000000000000,
96+
"maximum": 4000000000000
97+
},
98+
"Int64WithExclusiveMin": {
99+
"type": "integer",
100+
"format": "int64",
101+
"exclusiveMinimum": -3000000000000
102+
},
103+
"Int64WithExclusiveMax": {
104+
"type": "integer",
105+
"format": "int64",
106+
"exclusiveMaximum": 3000000000000
107+
},
108+
"Int64WithExclusiveMinMax": {
109+
"type": "integer",
110+
"format": "int64",
111+
"exclusiveMinimum": -2000000000000,
112+
"exclusiveMaximum": 2000000000000
113+
},
114+
"Int64WithExclusiveMinInclusiveMax": {
115+
"type": "integer",
116+
"format": "int64",
117+
"exclusiveMinimum": -6000000000000,
118+
"maximum": 6000000000000
119+
},
120+
"Int64WithInclusiveMinExclusiveMax": {
121+
"type": "integer",
122+
"format": "int64",
123+
"minimum": -7000000000000,
124+
"exclusiveMaximum": 7000000000000
125+
},
126+
"UInt64WithMinimum": {
127+
"type": "integer",
128+
"format": "uint64",
129+
"minimum": 5000000000000
130+
},
131+
"UInt64WithMaximum": {
132+
"type": "integer",
133+
"format": "uint64",
134+
"maximum": 15000000000000
135+
},
136+
"UInt64WithMinMax": {
137+
"type": "integer",
138+
"format": "uint64",
139+
"minimum": 1000000000000,
140+
"maximum": 10000000000000
141+
},
142+
"UInt64WithExclusiveMin": {
143+
"type": "integer",
144+
"format": "uint64",
145+
"exclusiveMinimum": 8000000000000
146+
},
147+
"UInt64WithExclusiveMax": {
148+
"type": "integer",
149+
"format": "uint64",
150+
"exclusiveMaximum": 12000000000000
151+
},
152+
"UInt64WithExclusiveMinMax": {
153+
"type": "integer",
154+
"format": "uint64",
155+
"exclusiveMinimum": 2000000000000,
156+
"exclusiveMaximum": 8000000000000
157+
},
158+
"UInt64WithExclusiveMinInclusiveMax": {
159+
"type": "integer",
160+
"format": "uint64",
161+
"exclusiveMinimum": 3000000000000,
162+
"maximum": 13000000000000
163+
},
164+
"UInt64WithInclusiveMinExclusiveMax": {
165+
"type": "integer",
166+
"format": "uint64",
167+
"minimum": 4000000000000,
168+
"exclusiveMaximum": 14000000000000
169+
},
170+
"PrecedenceTest": {
171+
"type": "number",
172+
"minimum": 10,
173+
"maximum": 90,
174+
"exclusiveMinimum": 5,
175+
"exclusiveMaximum": 95
176+
}
177+
}
178+
}
179+
}

0 commit comments

Comments
 (0)