From 3364580756155ede3a31408184c2417a13da1a16 Mon Sep 17 00:00:00 2001 From: Patrick Mooney Date: Mon, 13 Nov 2023 15:52:04 -0600 Subject: [PATCH] Update dropshot and openapiv3 deps The json specification generated by the updated openapiv3 is ordered slightly differently, but not in a way that matters to anything but "brute force" diff checks like expectorate. This updates the dependency and applies the reordering to the recorded OpenAPI specs. --- Cargo.lock | 60 +++++++++++++--------- internal-dns/tests/output/test-server.json | 24 ++++----- nexus/src/bin/nexus.rs | 20 ++++++-- nexus/tests/output/cmd-nexus-noargs-stderr | 15 ++++-- openapi/bootstrap-agent.json | 24 ++++----- openapi/dns-server.json | 24 ++++----- openapi/gateway.json | 24 ++++----- openapi/installinator-artifactd.json | 24 ++++----- openapi/nexus-internal.json | 24 ++++----- openapi/nexus.json | 24 ++++----- openapi/oximeter.json | 24 ++++----- openapi/sled-agent.json | 24 ++++----- openapi/wicketd.json | 24 ++++----- workspace-hack/Cargo.toml | 10 ++-- 14 files changed, 186 insertions(+), 159 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 29122b8903..219e426197 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2007,7 +2007,7 @@ dependencies = [ "omicron-test-utils", "omicron-workspace-hack", "openapi-lint", - "openapiv3", + "openapiv3 1.0.3", "pretty-hex 0.3.0", "schemars", "serde", @@ -2111,7 +2111,7 @@ dependencies = [ [[package]] name = "dropshot" version = "0.9.1-dev" -source = "git+https://github.com/oxidecomputer/dropshot?branch=main#fa728d07970824fd5f3bd57a3d4dc0fdbea09bfd" +source = "git+https://github.com/oxidecomputer/dropshot?branch=main#ff87a0175a6c8ce4462cfe7486edd7000f01be6e" dependencies = [ "async-stream", "async-trait", @@ -2128,7 +2128,7 @@ dependencies = [ "hyper", "indexmap 2.1.0", "multer", - "openapiv3", + "openapiv3 2.0.0-rc.1", "paste", "percent-encoding", "proc-macro2", @@ -2147,7 +2147,7 @@ dependencies = [ "slog-term", "tokio", "tokio-rustls", - "toml 0.7.8", + "toml 0.8.8", "usdt", "uuid", "version_check", @@ -2157,7 +2157,7 @@ dependencies = [ [[package]] name = "dropshot_endpoint" version = "0.9.1-dev" -source = "git+https://github.com/oxidecomputer/dropshot?branch=main#fa728d07970824fd5f3bd57a3d4dc0fdbea09bfd" +source = "git+https://github.com/oxidecomputer/dropshot?branch=main#ff87a0175a6c8ce4462cfe7486edd7000f01be6e" dependencies = [ "proc-macro2", "quote", @@ -3527,7 +3527,7 @@ dependencies = [ "omicron-test-utils", "omicron-workspace-hack", "openapi-lint", - "openapiv3", + "openapiv3 1.0.3", "schemars", "serde", "serde_json", @@ -4392,7 +4392,7 @@ dependencies = [ "omicron-sled-agent", "omicron-test-utils", "omicron-workspace-hack", - "openapiv3", + "openapiv3 1.0.3", "openssl", "oso", "oximeter 0.1.0", @@ -4992,7 +4992,7 @@ dependencies = [ "omicron-workspace-hack", "once_cell", "openapi-lint", - "openapiv3", + "openapiv3 1.0.3", "schemars", "serde", "serde_json", @@ -5068,7 +5068,7 @@ dependencies = [ "omicron-workspace-hack", "once_cell", "openapi-lint", - "openapiv3", + "openapiv3 1.0.3", "openssl", "oxide-client", "oximeter 0.1.0", @@ -5278,7 +5278,7 @@ dependencies = [ "omicron-workspace-hack", "once_cell", "openapi-lint", - "openapiv3", + "openapiv3 1.0.3", "opte-ioctl", "oximeter 0.1.0", "oximeter-instruments", @@ -5409,7 +5409,6 @@ dependencies = [ "num-iter", "num-traits", "once_cell", - "openapiv3", "petgraph", "postgres-types", "ppv-lite86", @@ -5508,7 +5507,7 @@ dependencies = [ "heck 0.4.1", "indexmap 2.1.0", "lazy_static", - "openapiv3", + "openapiv3 1.0.3", "regex", ] @@ -5523,6 +5522,17 @@ dependencies = [ "serde_json", ] +[[package]] +name = "openapiv3" +version = "2.0.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25316406f0191559189c56d99731b63130775de7284d98df5e976ce67882ca8a" +dependencies = [ + "indexmap 2.1.0", + "serde", + "serde_json", +] + [[package]] name = "openssl" version = "0.10.57" @@ -5752,7 +5762,7 @@ dependencies = [ "omicron-test-utils", "omicron-workspace-hack", "openapi-lint", - "openapiv3", + "openapiv3 1.0.3", "oximeter 0.1.0", "oximeter-client", "oximeter-db", @@ -6551,9 +6561,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.67" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -6592,7 +6602,7 @@ dependencies = [ "heck 0.4.1", "http", "indexmap 2.1.0", - "openapiv3", + "openapiv3 1.0.3", "proc-macro2", "quote", "regex", @@ -6610,7 +6620,7 @@ name = "progenitor-macro" version = "0.3.0" source = "git+https://github.com/oxidecomputer/progenitor?branch=main#5c941c0b41b0235031f3ade33a9c119945f1fd51" dependencies = [ - "openapiv3", + "openapiv3 1.0.3", "proc-macro2", "progenitor-impl", "quote", @@ -7774,9 +7784,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.188" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] @@ -7821,9 +7831,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", @@ -8003,9 +8013,9 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if 1.0.0", "cpufeatures", @@ -9550,7 +9560,7 @@ version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 0.1.10", "rand 0.8.5", "static_assertions", ] @@ -10205,7 +10215,7 @@ dependencies = [ "omicron-test-utils", "omicron-workspace-hack", "openapi-lint", - "openapiv3", + "openapiv3 1.0.3", "rand 0.8.5", "reqwest", "schemars", diff --git a/internal-dns/tests/output/test-server.json b/internal-dns/tests/output/test-server.json index 5f4d6d155e..5720dec19f 100644 --- a/internal-dns/tests/output/test-server.json +++ b/internal-dns/tests/output/test-server.json @@ -33,18 +33,6 @@ } }, "components": { - "responses": { - "Error": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - }, "schemas": { "Error": { "description": "Error information from a response.", @@ -65,6 +53,18 @@ "request_id" ] } + }, + "responses": { + "Error": { + "description": "Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } } } } \ No newline at end of file diff --git a/nexus/src/bin/nexus.rs b/nexus/src/bin/nexus.rs index 24fef5c8d2..b67085db2c 100644 --- a/nexus/src/bin/nexus.rs +++ b/nexus/src/bin/nexus.rs @@ -27,6 +27,7 @@ struct Args { short = 'O', long = "openapi", help = "Print the external OpenAPI Spec document and exit", + conflicts_with = "openapi_internal", action )] openapi: bool, @@ -40,7 +41,7 @@ struct Args { openapi_internal: bool, #[clap(name = "CONFIG_FILE_PATH", action)] - config_file_path: PathBuf, + config_file_path: Option, } #[tokio::main] @@ -53,14 +54,25 @@ async fn main() { async fn do_run() -> Result<(), CmdError> { let args = Args::parse(); - let config = Config::from_file(args.config_file_path) - .map_err(|e| CmdError::Failure(anyhow!(e)))?; - if args.openapi { run_openapi_external().map_err(|err| CmdError::Failure(anyhow!(err))) } else if args.openapi_internal { run_openapi_internal().map_err(|err| CmdError::Failure(anyhow!(err))) } else { + let config_path = match args.config_file_path { + Some(path) => path, + None => { + use clap::CommandFactory; + + eprintln!("{}", Args::command().render_help()); + return Err(CmdError::Usage( + "CONFIG_FILE_PATH is required".to_string(), + )); + } + }; + let config = Config::from_file(config_path) + .map_err(|e| CmdError::Failure(anyhow!(e)))?; + run_server(&config).await.map_err(|err| CmdError::Failure(anyhow!(err))) } } diff --git a/nexus/tests/output/cmd-nexus-noargs-stderr b/nexus/tests/output/cmd-nexus-noargs-stderr index f371553325..8dff679340 100644 --- a/nexus/tests/output/cmd-nexus-noargs-stderr +++ b/nexus/tests/output/cmd-nexus-noargs-stderr @@ -1,6 +1,13 @@ -error: the following required arguments were not provided: - +See README.adoc for more information -Usage: nexus +Usage: nexus [OPTIONS] [CONFIG_FILE_PATH] -For more information, try '--help'. +Arguments: + [CONFIG_FILE_PATH] + +Options: + -O, --openapi Print the external OpenAPI Spec document and exit + -I, --openapi-internal Print the internal OpenAPI Spec document and exit + -h, --help Print help + +nexus: CONFIG_FILE_PATH is required diff --git a/openapi/bootstrap-agent.json b/openapi/bootstrap-agent.json index 362a7e91d8..2c7ffbc337 100644 --- a/openapi/bootstrap-agent.json +++ b/openapi/bootstrap-agent.json @@ -160,18 +160,6 @@ } }, "components": { - "responses": { - "Error": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - }, "schemas": { "Baseboard": { "description": "Describes properties that should uniquely identify a Gimlet.", @@ -977,6 +965,18 @@ "description": "Names must begin with a lower case ASCII letter, be composed exclusively of lowercase ASCII, uppercase ASCII, numbers, and '-', and may not end with a '-'. Names cannot be a UUID though they may contain a UUID.", "type": "string" } + }, + "responses": { + "Error": { + "description": "Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } } } } \ No newline at end of file diff --git a/openapi/dns-server.json b/openapi/dns-server.json index 7ffd21eb24..41b351d4c1 100644 --- a/openapi/dns-server.json +++ b/openapi/dns-server.json @@ -54,18 +54,6 @@ } }, "components": { - "responses": { - "Error": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - }, "schemas": { "DnsConfig": { "type": "object", @@ -251,6 +239,18 @@ "weight" ] } + }, + "responses": { + "Error": { + "description": "Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } } } } \ No newline at end of file diff --git a/openapi/gateway.json b/openapi/gateway.json index 97cb7994aa..9eacbe122d 100644 --- a/openapi/gateway.json +++ b/openapi/gateway.json @@ -1393,18 +1393,6 @@ } }, "components": { - "responses": { - "Error": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - }, "schemas": { "Duration": { "type": "object", @@ -3109,6 +3097,18 @@ "power_reset" ] } + }, + "responses": { + "Error": { + "description": "Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } } } } \ No newline at end of file diff --git a/openapi/installinator-artifactd.json b/openapi/installinator-artifactd.json index 3132af6ff6..136e60a8c4 100644 --- a/openapi/installinator-artifactd.json +++ b/openapi/installinator-artifactd.json @@ -95,18 +95,6 @@ } }, "components": { - "responses": { - "Error": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - }, "schemas": { "Duration": { "type": "object", @@ -2323,6 +2311,18 @@ "slots_written" ] } + }, + "responses": { + "Error": { + "description": "Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } } } } \ No newline at end of file diff --git a/openapi/nexus-internal.json b/openapi/nexus-internal.json index 633058d485..f83cf68a8a 100644 --- a/openapi/nexus-internal.json +++ b/openapi/nexus-internal.json @@ -679,18 +679,6 @@ } }, "components": { - "responses": { - "Error": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - }, "schemas": { "ActivationReason": { "description": "Describes why a background task was activated\n\nThis is only used for debugging. This is deliberately not made available to the background task itself. See \"Design notes\" in the module-level documentation for details.", @@ -5410,6 +5398,18 @@ } ] } + }, + "responses": { + "Error": { + "description": "Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } } } } \ No newline at end of file diff --git a/openapi/nexus.json b/openapi/nexus.json index f1bfa4351f..d2df2691e0 100644 --- a/openapi/nexus.json +++ b/openapi/nexus.json @@ -7838,18 +7838,6 @@ } }, "components": { - "responses": { - "Error": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - }, "schemas": { "Address": { "description": "An address tied to an address lot.", @@ -16058,6 +16046,18 @@ } ] } + }, + "responses": { + "Error": { + "description": "Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } } }, "tags": [ diff --git a/openapi/oximeter.json b/openapi/oximeter.json index ebc7957c2e..529d20e921 100644 --- a/openapi/oximeter.json +++ b/openapi/oximeter.json @@ -134,18 +134,6 @@ } }, "components": { - "responses": { - "Error": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - }, "schemas": { "CollectorInfo": { "type": "object", @@ -244,6 +232,18 @@ "items" ] } + }, + "responses": { + "Error": { + "description": "Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } } } } \ No newline at end of file diff --git a/openapi/sled-agent.json b/openapi/sled-agent.json index 3d36922296..ed202ddbdb 100644 --- a/openapi/sled-agent.json +++ b/openapi/sled-agent.json @@ -991,18 +991,6 @@ } }, "components": { - "responses": { - "Error": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - }, "schemas": { "AddSledRequest": { "description": "A request to Add a given sled after rack initialization has occurred", @@ -6480,6 +6468,18 @@ "type": "string", "pattern": "^ox[ip]_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" } + }, + "responses": { + "Error": { + "description": "Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } } } } \ No newline at end of file diff --git a/openapi/wicketd.json b/openapi/wicketd.json index a98e7302d9..60ad9a42df 100644 --- a/openapi/wicketd.json +++ b/openapi/wicketd.json @@ -677,18 +677,6 @@ } }, "components": { - "responses": { - "Error": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - }, "schemas": { "AbortUpdateOptions": { "type": "object", @@ -4706,6 +4694,18 @@ "power_reset" ] } + }, + "responses": { + "Error": { + "description": "Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } } } } \ No newline at end of file diff --git a/workspace-hack/Cargo.toml b/workspace-hack/Cargo.toml index 3161a67eed..be9ebd7847 100644 --- a/workspace-hack/Cargo.toml +++ b/workspace-hack/Cargo.toml @@ -66,12 +66,11 @@ num-bigint = { version = "0.4.4", features = ["rand"] } num-integer = { version = "0.1.45", features = ["i128"] } num-iter = { version = "0.1.43", default-features = false, features = ["i128"] } num-traits = { version = "0.2.16", features = ["i128", "libm"] } -openapiv3 = { version = "1.0.3", default-features = false, features = ["skip_serializing_defaults"] } petgraph = { version = "0.6.4", features = ["serde-1"] } postgres-types = { version = "0.2.6", default-features = false, features = ["with-chrono-0_4", "with-serde_json-1", "with-uuid-1"] } ppv-lite86 = { version = "0.2.17", default-features = false, features = ["simd", "std"] } predicates = { version = "3.0.4" } -proc-macro2 = { version = "1.0.67" } +proc-macro2 = { version = "1.0.69" } rand = { version = "0.8.5", features = ["min_const_gen", "small_rng"] } rand_chacha = { version = "0.3.1" } regex = { version = "1.10.2" } @@ -81,7 +80,7 @@ reqwest = { version = "0.11.20", features = ["blocking", "json", "rustls-tls", " ring = { version = "0.16.20", features = ["std"] } schemars = { version = "0.8.13", features = ["bytes", "chrono", "uuid1"] } semver = { version = "1.0.20", features = ["serde"] } -serde = { version = "1.0.188", features = ["alloc", "derive", "rc"] } +serde = { version = "1.0.192", features = ["alloc", "derive", "rc"] } serde_json = { version = "1.0.108", features = ["raw_value"] } sha2 = { version = "0.10.8", features = ["oid"] } signature = { version = "2.1.0", default-features = false, features = ["digest", "rand_core", "std"] } @@ -162,12 +161,11 @@ num-bigint = { version = "0.4.4", features = ["rand"] } num-integer = { version = "0.1.45", features = ["i128"] } num-iter = { version = "0.1.43", default-features = false, features = ["i128"] } num-traits = { version = "0.2.16", features = ["i128", "libm"] } -openapiv3 = { version = "1.0.3", default-features = false, features = ["skip_serializing_defaults"] } petgraph = { version = "0.6.4", features = ["serde-1"] } postgres-types = { version = "0.2.6", default-features = false, features = ["with-chrono-0_4", "with-serde_json-1", "with-uuid-1"] } ppv-lite86 = { version = "0.2.17", default-features = false, features = ["simd", "std"] } predicates = { version = "3.0.4" } -proc-macro2 = { version = "1.0.67" } +proc-macro2 = { version = "1.0.69" } rand = { version = "0.8.5", features = ["min_const_gen", "small_rng"] } rand_chacha = { version = "0.3.1" } regex = { version = "1.10.2" } @@ -178,7 +176,7 @@ reqwest = { version = "0.11.20", features = ["blocking", "json", "rustls-tls", " ring = { version = "0.16.20", features = ["std"] } schemars = { version = "0.8.13", features = ["bytes", "chrono", "uuid1"] } semver = { version = "1.0.20", features = ["serde"] } -serde = { version = "1.0.188", features = ["alloc", "derive", "rc"] } +serde = { version = "1.0.192", features = ["alloc", "derive", "rc"] } serde_json = { version = "1.0.108", features = ["raw_value"] } sha2 = { version = "0.10.8", features = ["oid"] } signature = { version = "2.1.0", default-features = false, features = ["digest", "rand_core", "std"] }