Skip to content

Commit ffb9354

Browse files
authored
Merge pull request #10521 from Turbo87/openapi
Improve OpenAPI description
2 parents dcb1107 + 6c877d2 commit ffb9354

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

src/openapi.rs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,36 @@ use utoipa::openapi::security::{ApiKey, ApiKeyValue, SecurityScheme};
44
use utoipa::{Modify, OpenApi};
55
use utoipa_axum::router::OpenApiRouter;
66

7+
const DESCRIPTION: &str = r#"
8+
__Experimental API documentation for the [crates.io](https://crates.io/)
9+
package registry.__
10+
11+
This document describes the API used by the crates.io website, cargo
12+
client, and other third-party tools to interact with the crates.io
13+
registry.
14+
15+
__The API is under active development and may change at any time__,
16+
though we will try to avoid breaking changes where possible.
17+
18+
Some parts of the API follow the "Registry Web API" spec documented
19+
at <https://doc.rust-lang.org/cargo/reference/registry-web-api.html>
20+
and can be considered stable.
21+
22+
Most parts of the API do not require authentication. The endpoints
23+
that do require authentication are marked as such in the documentation,
24+
with some requiring cookie authentication (usable only by the web UI)
25+
and others requiring API token authentication (usable by cargo and
26+
other clients).
27+
"#;
28+
729
#[derive(OpenApi)]
830
#[openapi(
931
info(
1032
title = "crates.io",
11-
description = "API documentation for the [crates.io](https://crates.io/) package registry",
33+
description = DESCRIPTION,
1234
terms_of_service = "https://crates.io/policies",
1335
contact(name = "the crates.io team", email = "[email protected]"),
14-
license(),
36+
license(name = "MIT OR Apache-2.0", url = "https://github.com/rust-lang/crates.io/blob/main/README.md#%EF%B8%8F-license"),
1537
version = "0.0.0",
1638
),
1739
modifiers(&SecurityAddon),

src/snapshots/crates_io__openapi__tests__openapi_snapshot.snap

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ expression: response.json()
2424
"email": "[email protected]",
2525
"name": "the crates.io team"
2626
},
27-
"description": "API documentation for the [crates.io](https://crates.io/) package registry",
27+
"description": "\n__Experimental API documentation for the [crates.io](https://crates.io/)\npackage registry.__\n\nThis document describes the API used by the crates.io website, cargo\nclient, and other third-party tools to interact with the crates.io\nregistry.\n\n__The API is under active development and may change at any time__,\nthough we will try to avoid breaking changes where possible.\n\nSome parts of the API follow the \"Registry Web API\" spec documented\nat <https://doc.rust-lang.org/cargo/reference/registry-web-api.html>\nand can be considered stable.\n\nMost parts of the API do not require authentication. The endpoints\nthat do require authentication are marked as such in the documentation,\nwith some requiring cookie authentication (usable only by the web UI)\nand others requiring API token authentication (usable by cargo and\nother clients).\n",
2828
"license": {
29-
"name": ""
29+
"name": "MIT OR Apache-2.0",
30+
"url": "https://github.com/rust-lang/crates.io/blob/main/README.md#%EF%B8%8F-license"
3031
},
3132
"termsOfService": "https://crates.io/policies",
3233
"title": "crates.io",

0 commit comments

Comments
 (0)