mirror of
https://github.com/ModernRelay/omnigraph.git
synced 2026-06-24 02:38:06 +02:00
feat(cli): no-default-graph errors list candidate graphs (RFC-011 D7) (#245)
When a server/cluster scope resolves with no --graph and no default_graph, the CLI auto-uses a sole graph (cluster) or errors listing the candidate graph ids (cluster catalog; multi-graph server via best-effort GET /graphs), never a silent pick. GraphClient::resolve becomes async; flat/single-graph servers and happy paths are unaffected.
This commit is contained in:
parent
b395757e21
commit
1bc0ea6b51
10 changed files with 262 additions and 62 deletions
|
|
@ -1136,5 +1136,27 @@ auth:
|
|||
.collect();
|
||||
assert_eq!(ids, vec!["alpha"]);
|
||||
|
||||
// RFC-011 D7: addressing the multi-graph server via `--server <url>` with no
|
||||
// `--graph` errors and lists the candidate graphs (the resolver probes
|
||||
// GET /graphs; the default-env token authorizes it).
|
||||
let no_graph = cli()
|
||||
.env("OMNIGRAPH_BEARER_TOKEN", "admin-token")
|
||||
.arg("query")
|
||||
.arg("--server")
|
||||
.arg(&server.base_url)
|
||||
.arg("-e")
|
||||
.arg("query q { match { $p: Person { name: \"x\" } } return { $p.name } }")
|
||||
.output()
|
||||
.unwrap();
|
||||
assert!(
|
||||
!no_graph.status.success(),
|
||||
"multi-graph server with no --graph must error"
|
||||
);
|
||||
let stderr = String::from_utf8_lossy(&no_graph.stderr);
|
||||
assert!(
|
||||
stderr.contains("alpha") && stderr.contains("--graph <id>"),
|
||||
"expected a candidate-listing error naming alpha; got: {stderr}"
|
||||
);
|
||||
|
||||
drop(server);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue