Skip to content

Commit f9176c8

Browse files
committed
openapi: Add explicit servers declaration
1 parent 2f484cc commit f9176c8

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

src/openapi.rs

+14-8
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@ use utoipa::OpenApi;
22
use utoipa_axum::router::OpenApiRouter;
33

44
#[derive(OpenApi)]
5-
#[openapi(info(
6-
title = "crates.io",
7-
description = "API documentation for the [crates.io](https://crates.io/) package registry",
8-
terms_of_service = "https://crates.io/policies",
9-
contact(name = "the crates.io team", email = "[email protected]"),
10-
license(),
11-
version = "0.0.0",
12-
))]
5+
#[openapi(
6+
info(
7+
title = "crates.io",
8+
description = "API documentation for the [crates.io](https://crates.io/) package registry",
9+
terms_of_service = "https://crates.io/policies",
10+
contact(name = "the crates.io team", email = "[email protected]"),
11+
license(),
12+
version = "0.0.0",
13+
),
14+
servers(
15+
(url = "https://crates.io"),
16+
(url = "https://staging.crates.io"),
17+
),
18+
)]
1319
pub struct BaseOpenApi;
1420

1521
impl BaseOpenApi {

src/snapshots/crates_io__openapi__tests__openapi_snapshot.snap

+9-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,13 @@ snapshot_kind: text
1919
"version": "0.0.0"
2020
},
2121
"openapi": "3.1.0",
22-
"paths": {}
22+
"paths": {},
23+
"servers": [
24+
{
25+
"url": "https://crates.io"
26+
},
27+
{
28+
"url": "https://staging.crates.io"
29+
}
30+
]
2331
}

0 commit comments

Comments
 (0)