Skip to content

Commit f876bf4

Browse files
wip
1 parent 75b561d commit f876bf4

File tree

4 files changed

+370
-366
lines changed

4 files changed

+370
-366
lines changed

server/schema.js

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.tripSchema = exports.matchSchema = exports.tableSchema = exports.nearestSchema = exports.routeSchema = void 0;
4+
const queryStringJsonSchemaGeneral = {
5+
type: 'object',
6+
properties: {
7+
bearings: {
8+
type: 'string',
9+
// TODO: pattern
10+
},
11+
radiuses: {
12+
type: 'string',
13+
// TODO: pattern
14+
},
15+
generate_hints: { type: 'boolean', default: true },
16+
hints: {
17+
type: 'string',
18+
// TODO: pattern
19+
},
20+
approaches: {
21+
type: 'string',
22+
// TODO: pattern
23+
},
24+
exclude: {
25+
type: 'string',
26+
// TODO: pattern
27+
},
28+
snapping: {
29+
enum: ['any', 'default'],
30+
default: 'default'
31+
},
32+
skip_waypoints: { type: 'boolean', default: false },
33+
}
34+
};
35+
const queryStringJsonSchemaRoute = {
36+
type: 'object',
37+
properties: {
38+
...queryStringJsonSchemaGeneral.properties,
39+
alternatives: { type: ['boolean', 'integer'], default: false },
40+
steps: { type: 'boolean', default: false },
41+
annotations: {
42+
type: 'string',
43+
// TODO: pattern
44+
},
45+
geometries: {
46+
enum: ['polyline', 'polyline6', 'geojson'],
47+
default: 'polyline'
48+
},
49+
overview: {
50+
enum: ['simplified', 'full', 'false'],
51+
default: 'simplified'
52+
},
53+
continue_straight: {
54+
type: 'string',
55+
// TODO:
56+
},
57+
waypoints: {
58+
type: 'string',
59+
// list of numbers separated by semicolon
60+
pattern: '^(\\d+(;\\d+)*)?$'
61+
}
62+
}
63+
};
64+
const queryStringJsonSchemaNearest = {
65+
type: 'object',
66+
properties: {
67+
...queryStringJsonSchemaGeneral.properties,
68+
alternatives: { type: ['integer'], default: 1 }
69+
}
70+
};
71+
const queryStringJsonSchemaTable = {
72+
type: 'object',
73+
properties: {
74+
...queryStringJsonSchemaGeneral.properties,
75+
// TODO: all
76+
sources: {
77+
type: 'string',
78+
// list of numbers separated by semicolon
79+
pattern: '^(\\d+(;\\d+)*)?$'
80+
},
81+
// TODO: all
82+
destinations: {
83+
type: 'string',
84+
// list of numbers separated by semicolon
85+
pattern: '^(\\d+(;\\d+)*)?$'
86+
},
87+
annotations: {
88+
type: 'string',
89+
// TODO: pattern
90+
},
91+
fallback_speed: {
92+
type: 'number',
93+
exclusiveMinimum: 0
94+
},
95+
fallback_coordinate: {
96+
enum: ['input', 'snapped'],
97+
default: 'input'
98+
},
99+
scale_factor: {
100+
type: 'number',
101+
exclusiveMinimum: 0
102+
}
103+
}
104+
};
105+
const queryStringJsonSchemaMatch = {
106+
type: 'object',
107+
properties: {
108+
...queryStringJsonSchemaGeneral.properties,
109+
steps: { type: 'boolean', default: false },
110+
geometries: {
111+
enum: ['polyline', 'polyline6', 'geojson'],
112+
default: 'polyline'
113+
},
114+
timestamps: {
115+
type: 'string',
116+
// list of numbers separated by semicolon
117+
pattern: '^(\\d+(;\\d+)*)?$'
118+
},
119+
overview: {
120+
enum: ['simplified', 'full', 'false'],
121+
default: 'simplified'
122+
},
123+
gaps: {
124+
enum: ['split', 'ignore'],
125+
default: 'split'
126+
},
127+
tidy: { type: 'boolean', default: false },
128+
waypoints: {
129+
type: 'string',
130+
// list of numbers separated by semicolon
131+
pattern: '^(\\d+(;\\d+)*)?$'
132+
},
133+
}
134+
};
135+
const queryStringJsonSchemaTrip = {
136+
type: 'object',
137+
properties: {
138+
...queryStringJsonSchemaGeneral.properties,
139+
roundtrip: { type: 'boolean', default: true },
140+
source: {
141+
enum: ['any', 'first'],
142+
default: 'any'
143+
},
144+
destination: {
145+
enum: ['any', 'last'],
146+
default: 'any'
147+
},
148+
annotations: {
149+
type: 'string',
150+
// TODO: pattern
151+
},
152+
geometries: {
153+
enum: ['polyline', 'polyline6', 'geojson'],
154+
default: 'polyline'
155+
},
156+
overview: {
157+
enum: ['simplified', 'full', 'false'],
158+
default: 'simplified'
159+
}
160+
}
161+
};
162+
exports.routeSchema = {
163+
querystring: queryStringJsonSchemaRoute,
164+
};
165+
exports.nearestSchema = {
166+
querystring: queryStringJsonSchemaNearest,
167+
};
168+
exports.tableSchema = {
169+
querystring: queryStringJsonSchemaTable,
170+
};
171+
exports.matchSchema = {
172+
querystring: queryStringJsonSchemaMatch,
173+
};
174+
exports.tripSchema = {
175+
querystring: queryStringJsonSchemaTrip,
176+
};

server/schema.ts

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
const queryStringJsonSchemaGeneral = {
2+
type: 'object',
3+
properties: {
4+
bearings: {
5+
type: 'string',
6+
// TODO: pattern
7+
},
8+
radiuses: {
9+
type: 'string',
10+
// TODO: pattern
11+
},
12+
generate_hints: { type: 'boolean', default: true },
13+
hints: {
14+
type: 'string',
15+
// TODO: pattern
16+
},
17+
approaches: {
18+
type: 'string',
19+
// TODO: pattern
20+
},
21+
exclude: {
22+
type: 'string',
23+
// TODO: pattern
24+
},
25+
snapping: {
26+
enum: ['any', 'default'],
27+
default: 'default'
28+
},
29+
skip_waypoints: { type: 'boolean', default: false },
30+
}
31+
};
32+
33+
const queryStringJsonSchemaRoute = {
34+
type: 'object',
35+
properties: {
36+
...queryStringJsonSchemaGeneral.properties,
37+
alternatives: { type: ['boolean', 'integer'], default: false },
38+
steps: { type: 'boolean', default: false },
39+
annotations: {
40+
type: 'string',
41+
// TODO: pattern
42+
},
43+
geometries: {
44+
enum: ['polyline', 'polyline6', 'geojson'],
45+
default: 'polyline'
46+
},
47+
overview: {
48+
enum: ['simplified', 'full', 'false'],
49+
default: 'simplified'
50+
},
51+
continue_straight: {
52+
type: 'string',
53+
// TODO:
54+
},
55+
waypoints: {
56+
type: 'string',
57+
// list of numbers separated by semicolon
58+
pattern: '^(\\d+(;\\d+)*)?$'
59+
}
60+
}
61+
}
62+
63+
const queryStringJsonSchemaNearest = {
64+
type: 'object',
65+
properties: {
66+
...queryStringJsonSchemaGeneral.properties,
67+
alternatives: { type: ['integer'], default: 1 }
68+
}
69+
}
70+
71+
const queryStringJsonSchemaTable = {
72+
type: 'object',
73+
properties: {
74+
...queryStringJsonSchemaGeneral.properties,
75+
// TODO: all
76+
sources: {
77+
type: 'string',
78+
// list of numbers separated by semicolon
79+
pattern: '^(\\d+(;\\d+)*)?$'
80+
},
81+
// TODO: all
82+
destinations: {
83+
type: 'string',
84+
// list of numbers separated by semicolon
85+
pattern: '^(\\d+(;\\d+)*)?$'
86+
},
87+
annotations: {
88+
type: 'string',
89+
// TODO: pattern
90+
},
91+
fallback_speed: {
92+
type: 'number',
93+
exclusiveMinimum: 0
94+
},
95+
fallback_coordinate: {
96+
enum: ['input', 'snapped'],
97+
default: 'input'
98+
},
99+
scale_factor: {
100+
type: 'number',
101+
exclusiveMinimum: 0
102+
}
103+
}
104+
}
105+
106+
107+
const queryStringJsonSchemaMatch = {
108+
type: 'object',
109+
properties: {
110+
...queryStringJsonSchemaGeneral.properties,
111+
112+
steps: { type: 'boolean', default: false },
113+
114+
geometries: {
115+
enum: ['polyline', 'polyline6', 'geojson'],
116+
default: 'polyline'
117+
},
118+
timestamps: {
119+
type: 'string',
120+
// list of numbers separated by semicolon
121+
pattern: '^(\\d+(;\\d+)*)?$'
122+
},
123+
overview: {
124+
enum: ['simplified', 'full', 'false'],
125+
default: 'simplified'
126+
},
127+
gaps: {
128+
enum: ['split', 'ignore'],
129+
default: 'split'
130+
},
131+
tidy: { type: 'boolean', default: false },
132+
waypoints: {
133+
type: 'string',
134+
// list of numbers separated by semicolon
135+
pattern: '^(\\d+(;\\d+)*)?$'
136+
},
137+
}
138+
}
139+
140+
const queryStringJsonSchemaTrip = {
141+
type: 'object',
142+
properties: {
143+
...queryStringJsonSchemaGeneral.properties,
144+
145+
roundtrip: { type: 'boolean', default: true },
146+
source: {
147+
enum: ['any', 'first'],
148+
default: 'any'
149+
},
150+
destination: {
151+
enum: ['any', 'last'],
152+
default: 'any'
153+
},
154+
annotations: {
155+
type: 'string',
156+
// TODO: pattern
157+
},
158+
geometries: {
159+
enum: ['polyline', 'polyline6', 'geojson'],
160+
default: 'polyline'
161+
},
162+
overview: {
163+
enum: ['simplified', 'full', 'false'],
164+
default: 'simplified'
165+
}
166+
}
167+
}
168+
169+
export const routeSchema = {
170+
querystring: queryStringJsonSchemaRoute,
171+
}
172+
173+
174+
export const nearestSchema = {
175+
querystring: queryStringJsonSchemaNearest,
176+
}
177+
178+
export const tableSchema = {
179+
querystring: queryStringJsonSchemaTable,
180+
}
181+
182+
export const matchSchema = {
183+
querystring: queryStringJsonSchemaMatch,
184+
}
185+
export const tripSchema = {
186+
querystring: queryStringJsonSchemaTrip,
187+
}

0 commit comments

Comments
 (0)