Skip to content

Commit f0a39cc

Browse files
committed
remove legacy ApiSpec struct
1 parent bcba13f commit f0a39cc

File tree

2 files changed

+42
-83
lines changed

2 files changed

+42
-83
lines changed

dev-tools/openapi-manager/src/apis.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,6 @@ pub struct ManagedApiConfig {
4747
pub extra_validation: Option<fn(&OpenAPI, ValidationContext<'_>)>,
4848
}
4949

50-
// XXX-dap-last-step rip this out and convert callers
51-
impl From<crate::spec::ApiSpec> for ManagedApiConfig {
52-
fn from(value: crate::spec::ApiSpec) -> Self {
53-
ManagedApiConfig {
54-
ident: value.file_stem,
55-
versions: value.versions,
56-
title: value.title,
57-
description: value.description,
58-
boundary: value.boundary,
59-
api_description: value.api_description,
60-
extra_validation: value.extra_validation,
61-
}
62-
}
63-
}
64-
6550
/// Used internally to describe an API managed by this tool
6651
#[derive(Debug)]
6752
pub struct ManagedApi {
@@ -309,7 +294,6 @@ pub enum Versions {
309294

310295
impl Versions {
311296
/// Constructor for a lockstep API
312-
#[allow(dead_code)] // XXX-dap-last-step
313297
pub fn new_lockstep(version: semver::Version) -> Versions {
314298
Versions::Lockstep { version }
315299
}

dev-tools/openapi-manager/src/spec.rs

Lines changed: 42 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -12,74 +12,74 @@ use openapiv3::OpenAPI;
1212

1313
/// All APIs managed by openapi-manager.
1414
// TODO The metadata here overlaps with metadata in api-manifest.toml.
15-
pub fn all_apis() -> Vec<ApiSpec> {
15+
pub fn all_apis() -> Vec<ManagedApiConfig> {
1616
vec![
17-
ApiSpec {
17+
ManagedApiConfig {
1818
title: "Bootstrap Agent API",
19-
versions: Versions::Lockstep { version: semver::Version::new(0,0,1) },
19+
versions: Versions::new_lockstep(semver::Version::new(0,0,1)),
2020
description: "Per-sled API for setup and teardown",
2121
boundary: ApiBoundary::Internal,
2222
api_description:
2323
bootstrap_agent_api::bootstrap_agent_api_mod::stub_api_description,
24-
file_stem: "bootstrap-agent",
24+
ident: "bootstrap-agent",
2525
extra_validation: None,
2626
},
27-
ApiSpec {
27+
ManagedApiConfig {
2828
title: "ClickHouse Cluster Admin Keeper API",
29-
versions: Versions::Lockstep { version: semver::Version::new(0,0,1) },
29+
versions: Versions::new_lockstep(semver::Version::new(0,0,1)),
3030
description: "API for interacting with the Oxide \
3131
control plane's ClickHouse cluster keepers",
3232
boundary: ApiBoundary::Internal,
3333
api_description:
3434
clickhouse_admin_api::clickhouse_admin_keeper_api_mod::stub_api_description,
35-
file_stem: "clickhouse-admin-keeper",
35+
ident: "clickhouse-admin-keeper",
3636
extra_validation: None,
3737
},
38-
ApiSpec {
38+
ManagedApiConfig {
3939
title: "ClickHouse Cluster Admin Server API",
40-
versions: Versions::Lockstep { version: semver::Version::new(0,0,1) },
40+
versions: Versions::new_lockstep(semver::Version::new(0,0,1)),
4141
description: "API for interacting with the Oxide \
4242
control plane's ClickHouse cluster replica servers",
4343
boundary: ApiBoundary::Internal,
4444
api_description:
4545
clickhouse_admin_api::clickhouse_admin_server_api_mod::stub_api_description,
46-
file_stem: "clickhouse-admin-server",
46+
ident: "clickhouse-admin-server",
4747
extra_validation: None,
4848
},
49-
ApiSpec {
49+
ManagedApiConfig {
5050
title: "ClickHouse Single-Node Admin Server API",
51-
versions: Versions::Lockstep { version: semver::Version::new(0,0,1) },
51+
versions: Versions::new_lockstep(semver::Version::new(0,0,1)),
5252
description: "API for interacting with the Oxide \
5353
control plane's single-node ClickHouse database",
5454
boundary: ApiBoundary::Internal,
5555
api_description:
5656
clickhouse_admin_api::clickhouse_admin_single_api_mod::stub_api_description,
57-
file_stem: "clickhouse-admin-single",
57+
ident: "clickhouse-admin-single",
5858
extra_validation: None,
5959
},
60-
ApiSpec {
60+
ManagedApiConfig {
6161
title: "CockroachDB Cluster Admin API",
62-
versions: Versions::Lockstep { version: semver::Version::new(0,0,1) },
62+
versions: Versions::new_lockstep(semver::Version::new(0,0,1)),
6363
description: "API for interacting with the Oxide \
6464
control plane's CockroachDB cluster",
6565
boundary: ApiBoundary::Internal,
6666
api_description:
6767
cockroach_admin_api::cockroach_admin_api_mod::stub_api_description,
68-
file_stem: "cockroach-admin",
68+
ident: "cockroach-admin",
6969
extra_validation: None,
7070
},
71-
ApiSpec {
71+
ManagedApiConfig {
7272
title: "Oxide Management Gateway Service API",
73-
versions: Versions::Lockstep { version: semver::Version::new(0,0,1) },
73+
versions: Versions::new_lockstep(semver::Version::new(0,0,1)),
7474
description: "API for interacting with the Oxide \
7575
control plane's gateway service",
7676
boundary: ApiBoundary::Internal,
7777
api_description:
7878
gateway_api::gateway_api_mod::stub_api_description,
79-
file_stem: "gateway",
79+
ident: "gateway",
8080
extra_validation: None,
8181
},
82-
ApiSpec {
82+
ManagedApiConfig {
8383
title: "Internal DNS",
8484
versions: Versions::new_versioned(
8585
dns_server_api::supported_versions()
@@ -88,103 +88,78 @@ pub fn all_apis() -> Vec<ApiSpec> {
8888
boundary: ApiBoundary::Internal,
8989
api_description:
9090
dns_server_api::dns_server_api_mod::stub_api_description,
91-
file_stem: "dns-server",
91+
ident: "dns-server",
9292
extra_validation: None,
9393
},
94-
ApiSpec {
94+
ManagedApiConfig {
9595
title: "Installinator API",
96-
versions: Versions::Lockstep { version: semver::Version::new(0,0,1) },
96+
versions: Versions::new_lockstep(semver::Version::new(0,0,1)),
9797
description: "API for installinator to fetch artifacts \
9898
and report progress",
9999
boundary: ApiBoundary::Internal,
100100
api_description:
101101
installinator_api::installinator_api_mod::stub_api_description,
102-
file_stem: "installinator",
102+
ident: "installinator",
103103
extra_validation: None,
104104
},
105-
ApiSpec {
105+
ManagedApiConfig {
106106
title: "Oxide Region API",
107-
versions: Versions::Lockstep { version: semver::Version::new(20250212,0,0) },
107+
versions: Versions::new_lockstep(semver::Version::new(20250212,0,0)),
108108
description: "API for interacting with the Oxide control plane",
109109
boundary: ApiBoundary::External,
110110
api_description:
111111
nexus_external_api::nexus_external_api_mod::stub_api_description,
112-
file_stem: "nexus",
112+
ident: "nexus",
113113
extra_validation: Some(nexus_external_api::validate_api),
114114
},
115-
ApiSpec {
115+
ManagedApiConfig {
116116
title: "Nexus internal API",
117-
versions: Versions::Lockstep { version: semver::Version::new(0,0,1) },
117+
versions: Versions::new_lockstep(semver::Version::new(0,0,1)),
118118
description: "Nexus internal API",
119119
boundary: ApiBoundary::Internal,
120120
api_description:
121121
nexus_internal_api::nexus_internal_api_mod::stub_api_description,
122-
file_stem: "nexus-internal",
122+
ident: "nexus-internal",
123123
extra_validation: None,
124124
},
125-
ApiSpec {
125+
ManagedApiConfig {
126126
title: "Oxide Oximeter API",
127-
versions: Versions::Lockstep { version: semver::Version::new(0,0,1) },
127+
versions: Versions::new_lockstep(semver::Version::new(0,0,1)),
128128
description: "API for interacting with oximeter",
129129
boundary: ApiBoundary::Internal,
130130
api_description:
131131
oximeter_api::oximeter_api_mod::stub_api_description,
132-
file_stem: "oximeter",
132+
ident: "oximeter",
133133
extra_validation: None,
134134
},
135-
ApiSpec {
135+
ManagedApiConfig {
136136
title: "Oxide TUF Repo Depot API",
137-
versions: Versions::Lockstep { version: semver::Version::new(0,0,1) },
137+
versions: Versions::new_lockstep(semver::Version::new(0,0,1)),
138138
description: "API for fetching update artifacts",
139139
boundary: ApiBoundary::Internal,
140140
api_description: repo_depot_api::repo_depot_api_mod::stub_api_description,
141-
file_stem: "repo-depot",
141+
ident: "repo-depot",
142142
extra_validation: None,
143143
},
144-
ApiSpec {
144+
ManagedApiConfig {
145145
title: "Oxide Sled Agent API",
146-
versions: Versions::Lockstep { version: semver::Version::new(0,0,1) },
146+
versions: Versions::new_lockstep(semver::Version::new(0,0,1)),
147147
description: "API for interacting with individual sleds",
148148
boundary: ApiBoundary::Internal,
149149
api_description:
150150
sled_agent_api::sled_agent_api_mod::stub_api_description,
151-
file_stem: "sled-agent",
151+
ident: "sled-agent",
152152
extra_validation: None,
153153
},
154-
ApiSpec {
154+
ManagedApiConfig {
155155
title: "Oxide Technician Port Control Service",
156-
versions: Versions::Lockstep { version: semver::Version::new(0,0,1) },
156+
versions: Versions::new_lockstep(semver::Version::new(0,0,1)),
157157
description: "API for use by the technician port TUI: wicket",
158158
boundary: ApiBoundary::Internal,
159159
api_description: wicketd_api::wicketd_api_mod::stub_api_description,
160-
file_stem: "wicketd",
160+
ident: "wicketd",
161161
extra_validation: None,
162162
},
163163
// Add your APIs here! Please keep this list sorted by filename.
164164
]
165165
}
166-
167-
pub struct ApiSpec {
168-
/// The title.
169-
pub title: &'static str,
170-
171-
/// Supported version(s) of this API
172-
pub(crate) versions: Versions,
173-
174-
/// The description string.
175-
pub description: &'static str,
176-
177-
/// Whether this API is internal or external.
178-
pub boundary: ApiBoundary,
179-
180-
/// The API description function, typically a reference to
181-
/// `stub_api_description`.
182-
pub api_description:
183-
fn() -> Result<ApiDescription<StubContext>, ApiDescriptionBuildErrors>,
184-
185-
/// The spec-specific part of the filename for API descriptions
186-
pub(crate) file_stem: &'static str,
187-
188-
/// Extra validation to perform on the OpenAPI spec, if any.
189-
pub extra_validation: Option<fn(&OpenAPI, ValidationContext<'_>)>,
190-
}

0 commit comments

Comments
 (0)