feat(openapi): the OpenAPI document, and the paperwork the crate shipped without
`Cargo.toml` has declared `license = "MIT"` since the first release and the published crate carried no license text, so anyone vendoring the source had the claim without the grant. `LICENSE` is that text. `DCO` is the certificate the README has been requiring a sign-off against without shipping, and `CONTRIBUTING.md` says how — including that GitHub is a mirror of `main` and tags, so a pull request there is carried upstream by a maintainer rather than merged, which would put the two forges out of sync. `CHANGELOG.md` reconstructs 26.7.0 and 26.8.0-beta.0 from their tags. The CLI ships on its own version line, so the header says what that does and does not mean about the core version a scaffold is pinned to, and each entry says when that pin moved. `matcha openapi` prints core's structural OpenAPI 3.1 for the route table — `--title`, `--api-version`, `--out`. It reuses the entry resolution and the generated-script runner that `graph` and `explain` already had, so it is the same `app.ready()` that resolves the graph without booting providers. Structural is the honest word: paths, methods and parameters come from the decorators, and nothing invents a response schema. The loose end from the capability table is closed. `cli.rs` still carried its own copies of the `create` kinds and the `add` capabilities, so adding either meant editing two files that could disagree — a value the parser accepts and the dispatcher rejects. Both now read the list from the module that owns it, and the three `create` piece kinds became rows in a table rather than near-identical match arms, which also retires a `too_many_arguments` allow. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
12 files changed
+542
-47
No files matched your search
+24
-1
@@ -13,7 +13,30 @@ fn help_lists_all_subcommands() {
|
||||
.stdout(contains("create"))
|
||||
.stdout(contains("add"))
|
||||
.stdout(contains("graph"))
|
||||
.stdout(contains("explain"));
|
||||
.stdout(contains("explain"))
|
||||
.stdout(contains("openapi"))
|
||||
.stdout(contains("doctor"));
|
||||
}
|
||||
|
||||
/// clap's accepted values and the values `run` dispatches on come from one list
|
||||
/// per command now. This is what proves the wiring reached clap — a regression
|
||||
/// would take the parser and the dispatcher out of step, which shows up as a
|
||||
/// value the CLI accepts and then refuses.
|
||||
#[test]
|
||||
fn create_and_add_advertise_every_value_they_accept() {
|
||||
for (command, values) in [
|
||||
("create", vec!["module", "controller", "step", "provider"]),
|
||||
("add", vec!["sse", "stream", "buffer", "ws", "upload"]),
|
||||
] {
|
||||
let mut assertion = Command::cargo_bin("matcha")
|
||||
.unwrap()
|
||||
.args([command, "--help"])
|
||||
.assert()
|
||||
.success();
|
||||
for value in values {
|
||||
assertion = assertion.stdout(contains(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -58,3 +58,18 @@ fn graph_rejects_an_unknown_format() {
|
||||
.assert()
|
||||
.failure();
|
||||
}
|
||||
|
||||
/// openapi shares graph's entry resolution, so it shares its failure modes —
|
||||
/// including the one that has to name the fix.
|
||||
#[test]
|
||||
fn openapi_without_an_entry_says_what_is_missing() {
|
||||
let d = tempdir().unwrap();
|
||||
std::fs::write(d.path().join("package.json"), "{}").unwrap();
|
||||
Command::cargo_bin("matcha")
|
||||
.unwrap()
|
||||
.current_dir(d.path())
|
||||
.arg("openapi")
|
||||
.assert()
|
||||
.failure()
|
||||
.stderr(contains("--entry"));
|
||||
}
|
||||
Reference in new issue
Block a user