Skip to content

Commit

Permalink
[6/6] [nexus] convert external API to trait (#6373)
Browse files Browse the repository at this point in the history
At long last, here's the last OpenAPI document converted into a trait: the
Nexus external API. This is a fairly large change, but with all the
prerequisites in place the conversion is overall pretty mechanical. I did need
to move some types around, but the bulk of the PR is just adding the very large
external API trait.

This PR also adds a `.git-blame-ignore-revs` entry corresponding to #6372, so that the indent doesn't ruin blame in the GitHub web view. (You can configure this locally as well with `git config blame.ignoreRevsFile .git-blame-ignore-revs`.)

In a subsequent PR I'll remove the old instructions.

Depends on:

* #6355
* #6364 
* #6369
* #6370
* #6372

Co-authored-by: David Crespo <[email protected]>
  • Loading branch information
sunshowers and david-crespo authored Aug 28, 2024
1 parent 648507d commit aff73fc
Show file tree
Hide file tree
Showing 25 changed files with 3,525 additions and 2,298 deletions.
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Whitespace-only changes
d01ba56c2127789d85723793380a7378394583f1
22 changes: 21 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ members = [
"nexus/db-model",
"nexus/db-queries",
"nexus/defaults",
"nexus/external-api",
"nexus/internal-api",
"nexus/inventory",
"nexus/macros-common",
Expand Down Expand Up @@ -186,6 +187,7 @@ default-members = [
"nexus/db-model",
"nexus/db-queries",
"nexus/defaults",
"nexus/external-api",
"nexus/internal-api",
"nexus/inventory",
"nexus/macros-common",
Expand Down Expand Up @@ -425,6 +427,7 @@ nexus-db-fixed-data = { path = "nexus/db-fixed-data" }
nexus-db-model = { path = "nexus/db-model" }
nexus-db-queries = { path = "nexus/db-queries" }
nexus-defaults = { path = "nexus/defaults" }
nexus-external-api = { path = "nexus/external-api" }
nexus-inventory = { path = "nexus/inventory" }
nexus-internal-api = { path = "nexus/internal-api" }
nexus-macros-common = { path = "nexus/macros-common" }
Expand Down
1 change: 1 addition & 0 deletions dev-tools/openapi-manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ fs-err.workspace = true
gateway-api.workspace = true
indent_write.workspace = true
installinator-api.workspace = true
nexus-external-api.workspace = true
nexus-internal-api.workspace = true
omicron-workspace-hack.workspace = true
openapiv3.workspace = true
Expand Down
10 changes: 10 additions & 0 deletions dev-tools/openapi-manager/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ pub fn all_apis() -> Vec<ApiSpec> {
filename: "installinator.json",
extra_validation: None,
},
ApiSpec {
title: "Oxide Region API",
version: "20240821.0",
description: "API for interacting with the Oxide control plane",
boundary: ApiBoundary::External,
api_description:
nexus_external_api::nexus_external_api_mod::stub_api_description,
filename: "nexus.json",
extra_validation: Some(nexus_external_api::validate_api),
},
ApiSpec {
title: "Nexus internal API",
version: "0.0.1",
Expand Down
1 change: 1 addition & 0 deletions nexus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ macaddr.workspace = true
# integration tests.
nexus-client.workspace = true
nexus-config.workspace = true
nexus-external-api.workspace = true
nexus-internal-api.workspace = true
nexus-networking.workspace = true
nexus-saga-recovery.workspace = true
Expand Down
22 changes: 22 additions & 0 deletions nexus/external-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "nexus-external-api"
version = "0.1.0"
edition = "2021"
license = "MPL-2.0"

[lints]
workspace = true

[dependencies]
anyhow.workspace = true
dropshot.workspace = true
http.workspace = true
hyper.workspace = true
ipnetwork.workspace = true
nexus-types.workspace = true
omicron-common.workspace = true
omicron-workspace-hack.workspace = true
openapiv3.workspace = true
openapi-manager-types.workspace = true
oximeter-types.workspace = true
oxql-types.workspace = true
File renamed without changes.
Loading

0 comments on commit aff73fc

Please sign in to comment.