feat: allow collections without routes
This commit is contained in:
parent
37f4d6b607
commit
e44a69e93b
3 changed files with 3 additions and 3 deletions
|
@ -63,7 +63,7 @@ impl PrintableResult for ListResult {
|
|||
println!(" + {key}={}", crate::ext::stringify_toml(&value));
|
||||
}
|
||||
|
||||
for (name, endpoint) in collection.route {
|
||||
for (name, endpoint) in collection.route.unwrap_or_default() {
|
||||
let url = endpoint.url(collection.client.as_ref().and_then(|x| x.base.as_deref()))
|
||||
.split('?')
|
||||
.next()
|
||||
|
|
|
@ -150,7 +150,7 @@ async fn run_collection_endpoints(
|
|||
let client = std::sync::Arc::new(collection.client.unwrap_or_default());
|
||||
let env = std::sync::Arc::new(collection.env.unwrap_or_default());
|
||||
|
||||
for (name, mut endpoint) in collection.route {
|
||||
for (name, mut endpoint) in collection.route.unwrap_or_default() {
|
||||
if pattern.find(&name).is_none() { continue };
|
||||
|
||||
if debug { endpoint.extract = Some(ext::StringOr::T(model::ExtractorConfig::Debug)) };
|
||||
|
|
|
@ -12,5 +12,5 @@ pub struct PostWomanCollection {
|
|||
pub env: Option<toml::Table>,
|
||||
pub include: Option<Vec<String>>,
|
||||
// it's weird to name it singular but makes more sense in config
|
||||
pub route: indexmap::IndexMap<String, EndpointConfig>,
|
||||
pub route: Option<indexmap::IndexMap<String, EndpointConfig>>,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue