aboutsummaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/api')
-rw-r--r--src/api/schema.d.ts2
-rw-r--r--src/api/schema.js11
-rw-r--r--src/api/schema.peechy2
-rw-r--r--src/api/schema.zig6
4 files changed, 7 insertions, 14 deletions
diff --git a/src/api/schema.d.ts b/src/api/schema.d.ts
index 36b9a6fcd..89f9af7b9 100644
--- a/src/api/schema.d.ts
+++ b/src/api/schema.d.ts
@@ -300,7 +300,7 @@ type uint32 = number;
}
export interface Router {
- routes: string[];
+ routes: StringMap;
route: int32;
params: StringMap;
}
diff --git a/src/api/schema.js b/src/api/schema.js
index 029a3378d..f733ce2cb 100644
--- a/src/api/schema.js
+++ b/src/api/schema.js
@@ -416,9 +416,7 @@ function encodeProblems(message, bb) {
function decodeRouter(bb) {
var result = {};
- var length = bb.readVarUint();
- var values = result["routes"] = Array(length);
- for (var i = 0; i < length; i++) values[i] = bb.readString();
+ result["routes"] = decodeStringMap(bb);
result["route"] = bb.readInt32();
result["params"] = decodeStringMap(bb);
return result;
@@ -428,12 +426,7 @@ function encodeRouter(message, bb) {
var value = message["routes"];
if (value != null) {
- var values = value, n = values.length;
- bb.writeVarUint(n);
- for (var i = 0; i < n; i++) {
- value = values[i];
- bb.writeString(value);
- }
+ encodeStringMap(value, bb);
} else {
throw new Error("Missing required field \"routes\"");
}
diff --git a/src/api/schema.peechy b/src/api/schema.peechy
index 15bb279f4..2cc78504a 100644
--- a/src/api/schema.peechy
+++ b/src/api/schema.peechy
@@ -84,7 +84,7 @@ struct Problems {
}
struct Router {
- string[] routes;
+ StringMap routes;
int32 route;
StringMap params;
}
diff --git a/src/api/schema.zig b/src/api/schema.zig
index e34131dd2..7b60bf346 100644
--- a/src/api/schema.zig
+++ b/src/api/schema.zig
@@ -647,7 +647,7 @@ pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
pub const Router = struct {
/// routes
-routes: []const []const u8,
+routes: StringMap,
/// route
route: i32 = 0,
@@ -659,14 +659,14 @@ params: StringMap,
pub fn decode(reader: anytype) anyerror!Router {
var this = std.mem.zeroes(Router);
- this.routes = try reader.readArray([]const u8);
+ this.routes = try reader.readValue(StringMap);
this.route = try reader.readValue(i32);
this.params = try reader.readValue(StringMap);
return this;
}
pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeArray([]const u8, this.routes);
+ try writer.writeValue(this.routes);
try writer.writeInt(this.route);
try writer.writeValue(this.params);
}