-
Notifications
You must be signed in to change notification settings - Fork 680
Improve OpenAPI description #10521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Improve OpenAPI description #10521
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,14 +4,36 @@ use utoipa::openapi::security::{ApiKey, ApiKeyValue, SecurityScheme}; | |
| use utoipa::{Modify, OpenApi}; | ||
| use utoipa_axum::router::OpenApiRouter; | ||
|
|
||
| const DESCRIPTION: &str = r#" | ||
| __Experimental API documentation for the [crates.io](https://crates.io/) | ||
| package registry.__ | ||
|
|
||
| This document describes the API used by the crates.io website, cargo | ||
| client, and other third-party tools to interact with the crates.io | ||
| registry. | ||
|
|
||
| __The API is under active development and may change at any time__, | ||
| though we will try to avoid breaking changes where possible. | ||
|
|
||
| Some parts of the API follow the "Registry Web API" spec documented | ||
| at <https://doc.rust-lang.org/cargo/reference/registry-web-api.html> | ||
| and can be considered stable. | ||
|
|
||
| Most parts of the API do not require authentication. The endpoints | ||
| that do require authentication are marked as such in the documentation, | ||
| with some requiring cookie authentication (useable only by the web UI) | ||
| and others requiring API token authentication (useable by cargo and | ||
| other clients). | ||
| "#; | ||
|
|
||
| #[derive(OpenApi)] | ||
| #[openapi( | ||
| info( | ||
| title = "crates.io", | ||
| description = "API documentation for the [crates.io](https://crates.io/) package registry", | ||
| description = DESCRIPTION, | ||
| terms_of_service = "https://crates.io/policies", | ||
| contact(name = "the crates.io team", email = "[email protected]"), | ||
| license(), | ||
| license(name = "MIT OR Apache-2.0", url = "https://github.com/rust-lang/crates.io/blob/main/README.md#%EF%B8%8F-license"), | ||
| version = "0.0.0", | ||
| ), | ||
| modifiers(&SecurityAddon), | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,9 +24,10 @@ expression: response.json() | |
| "email": "[email protected]", | ||
| "name": "the crates.io team" | ||
| }, | ||
| "description": "API documentation for the [crates.io](https://crates.io/) package registry", | ||
| "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 (useable only by the web UI)\nand others requiring API token authentication (useable by cargo and\nother clients).\n", | ||
Turbo87 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "license": { | ||
| "name": "" | ||
| "name": "MIT OR Apache-2.0", | ||
| "url": "https://github.com/rust-lang/crates.io/blob/main/README.md#%EF%B8%8F-license" | ||
| }, | ||
| "termsOfService": "https://crates.io/policies", | ||
| "title": "crates.io", | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.