return true
end
+local external_map_schema = ts.shape{
+ external = ts.equivalent(true), -- must be true
+ backend = ts.string, -- where to get data, required
+ method = ts.one_of{"body", "header", "query", "form"}, -- how to pass input
+ encode = ts.one_of{"json", "messagepack"}:is_optional(), -- how to encode input (if relevant)
+}
+local direct_map_schema = ts.shape{ -- complex object
+ name = ts.string:is_optional(),
+ description = ts.string:is_optional(),
+ timeout = ts.number,
+ data = ts.array_of(ts.string):is_optional(),
+ -- Tableshape has no options support for something like key1 or key2?
+ upstreams = ts.one_of{
+ ts.string,
+ ts.array_of(ts.string),
+ }:is_optional(),
+ url = ts.one_of{
+ ts.string,
+ ts.array_of(ts.string),
+ }:is_optional(),
+}
+
exports.map_schema = ts.one_of{
ts.string, -- 'http://some_map'
ts.array_of(ts.string), -- ['foo', 'bar']
- ts.shape{ -- complex object
- name = ts.string:is_optional(),
- description = ts.string:is_optional(),
- timeout = ts.number,
- data = ts.array_of(ts.string):is_optional(),
- -- Tableshape has no options support for something like key1 or key2?
- upstreams = ts.one_of{
- ts.string,
- ts.array_of(ts.string),
- }:is_optional(),
- url = ts.one_of{
- ts.string,
- ts.array_of(ts.string),
- }:is_optional(),
- }
+ ts.one_of{direct_map_schema, external_map_schema}
}
return exports