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
This enables optionally passing a route as `{pattern: string, zone_id: string}`. There are scenarios where we need to explicitly pass a zone_id to the api, so this enables that.
Some nuance: our toml parser unfortunately doesn't let you have mixed types in arrays, so if you have a single route with this special shape, then you'll have to do it for all of them. We can replace it with something more recent, but I'll do that in a subsequent PR.
Further nuance: The errors from the api aren't super useful when invalid values are passed, but that's something to further work on.
This also fixes some types in our cli parsing.
Fixes#774
This enables optionally passing a route as `{pattern: string, zone_id: string}`. There are scenarios where we need to explicitly pass a zone_id to the api, so this enables that.
8
+
9
+
Some nuance: The errors from the api aren't super useful when invalid values are passed, but that's something to further work on.
- Expected \\"route\\" to be of type string but got 888.
659
-
- Expected \\"routes\\" to be of type string array but got [666,777].
677
+
- Expected \\"route\\" to be either a string or an object with shape {pattern: string, zone_id: string}, but got 888.
678
+
- Expected \\"routes\\" to be an array of either strings or objects with the shape {pattern: string, zone_id: string}, but these weren't valid: [666,777,{\\"pattern\\":123,\\"zone_id\\":\\"zone_id_1\\"},{\\"pattern\\":\\"route_2\\",\\"zone_id\\":123},{\\"pattern\\":\\"route_3\\"},{\\"zone_id\\":\\"zone_id_4\\"},{},{\\"pattern\\":\\"route_5\\",\\"zone_id\\":\\"zone_id_5\\",\\"some_other_key\\":123}].
660
679
- Expected exactly one of the following fields [\\"routes\\",\\"route\\"].
661
680
- Expected \\"workers_dev\\" to be of type boolean but got \\"BAD\\".
662
681
- Expected \\"build.command\\" to be of type string but got 1444.
- Expected \\"route\\" to be of type string but got 888.
1801
-
- Expected \\"routes\\" to be of type string array but got [666,777].
1819
+
- Expected \\"route\\" to be either a string or an object with shape {pattern: string, zone_id: string}, but got 888.
1820
+
- Expected \\"routes\\" to be an array of either strings or objects with the shape {pattern: string, zone_id: string}, but these weren't valid: [666,777].
1802
1821
- Expected exactly one of the following fields [\\"routes\\",\\"route\\"].
1803
1822
- Expected \\"workers_dev\\" to be of type boolean but got \\"BAD\\".
1804
1823
- Expected \\"build.command\\" to be of type string but got 1444.
`Expected "${field}" to be an array but got ${JSON.stringify(value)}.`
506
+
);
507
+
returnfalse;
508
+
}
509
+
constinvalidRoutes=[];
510
+
for(constitemofvalue){
511
+
if(!isValidRouteValue(item)){
512
+
invalidRoutes.push(item);
513
+
}
514
+
}
515
+
if(invalidRoutes.length>0){
516
+
diagnostics.errors.push(
517
+
`Expected "${field}" to be an array of either strings or objects with the shape {pattern: string, zone_id: string}, but these weren't valid: ${JSON.stringify(
0 commit comments