Skip to content

Commit b5f2efb

Browse files
committed
api_versions! should make public Semver consts
they were private, so it was impossible to use version constants defined in a separate API crate. this is the relationship between the DNS server and DNS API types, as one example, so move that explicit `Semver` declaration to one from the `dns-server-api` crate.
1 parent 3e68262 commit b5f2efb

File tree

6 files changed

+12
-7
lines changed

6 files changed

+12
-7
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev-tools/ls-apis/api-manifest.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,10 @@ observability APIs in the future.
249249
client_package_name = "dns-service-client"
250250
label = "DNS Server"
251251
server_package_name = "dns-server-api"
252-
versioned_how = "server"
252+
versioned_how = "client"
253+
versioned_how_reason = """
254+
DNS servers and clients of their HTTP API (e.g. Nexus) are deployed separately.
255+
"""
253256

254257
[[apis]]
255258
client_package_name = "dpd-client"

dev-tools/openapi-manager/types/src/versions.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ impl SupportedVersions {
106106
/// these, equivalent to:
107107
///
108108
/// ```
109-
/// const VERSION_ADD_FOOBAR_OPERATION: semver::Version =
109+
/// pub const VERSION_ADD_FOOBAR_OPERATION: semver::Version =
110110
/// semver::Version::new(2, 0, 0);
111-
/// const VERSION_INITIAL: semver::Version =
111+
/// pub const VERSION_INITIAL: semver::Version =
112112
/// semver::Version::new(1, 0, 0);
113113
/// ```
114114
///
@@ -147,7 +147,7 @@ macro_rules! api_versions {
147147
) ),* $(,)? ] ) => {
148148
openapi_manager_types::paste! {
149149
$(
150-
const [<VERSION_ $name>]: semver::Version =
150+
pub const [<VERSION_ $name>]: semver::Version =
151151
semver::Version::new($major, 0, 0);
152152
)*
153153

@@ -178,7 +178,7 @@ macro_rules! api_versions_picky {
178178
) ),* $(,)? ] ) => {
179179
openapi_manager_types::paste! {
180180
$(
181-
const [<VERSION_ $name>]: semver::Version =
181+
pub const [<VERSION_ $name>]: semver::Version =
182182
semver::Version::new($major, $minor, $patch);
183183
)*
184184

dns-server/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ pub async fn start_servers(
100100
"api-version"
101101
.parse::<http::header::HeaderName>()
102102
.expect("api-version is a valid header name"),
103-
semver::Version::new(2, 0, 0),
103+
dns_server_api::VERSION_SOA_AND_NS,
104104
),
105105
)))
106106
.start()

internal-dns/resolver/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ anyhow.workspace = true
2323
assert_matches.workspace = true
2424
dropshot.workspace = true
2525
dns-server.workspace = true
26+
dns-server-api.workspace = true
2627
dns-service-client.workspace = true
2728
expectorate.workspace = true
2829
omicron-test-utils.workspace = true

internal-dns/resolver/src/resolver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ mod test {
831831
"api-version"
832832
.parse::<reqwest::header::HeaderName>()
833833
.expect("api-version is a valid header name"),
834-
semver::Version::new(2, 0, 0),
834+
dns_server_api::VERSION_SOA_AND_NS,
835835
),
836836
)))
837837
.start()

0 commit comments

Comments
 (0)