-
Notifications
You must be signed in to change notification settings - Fork 645
Add POST /api/v1/crates/{name}/{version}/rebuild_docs
API endpoint
#11169
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
Open
syphar
wants to merge
26
commits into
rust-lang:main
Choose a base branch
from
syphar:docs-rs-trigger
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+659
−0
Open
Changes from 18 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
4f3a33c
wip
syphar 4e27fd9
progress
syphar 38af5b6
disable token auth, move docs.rs call to async job
syphar 2c3658a
improve error handling
syphar ec8fd74
fix intra-doc link
syphar 98ce51f
move docs_rs client into separate crate, add tests with mockito
syphar f646e86
return job enqueueing errors to client
syphar cf823be
add user agent
syphar 94f8d77
fix clippy error
syphar 7025859
remove unused dependency
syphar 6e52274
use claims library for nicer assertions
syphar de87b00
add DocsRsClient to App&Worker Context, add API tests, make config ma…
syphar 2f48060
update to edition 2024
syphar 47f9f7a
rename config for hostname / url
syphar 157deb9
cargo fmt
syphar 19ebf47
update openapi snapshot
syphar 5e74b3e
drop docs.rs client from App & global Config, keep it in background e…
syphar f32f6a9
add `post` to `RequestHelper` and use it
syphar 642bc0d
broken: use `.map` instead of `if let Some()`
syphar 84d7ca1
fix compile errors with `as _`
syphar 0e07715
only allow triggering rebuilds for crate maintainers
syphar 0110d5f
docs.rs: Simplify `base_url` argument
Turbo87 962a741
docs.rs: Extract `DEFAULT_BASE_URL` constant
Turbo87 fc4338c
bin/background-worker: Simplify `RealDocsRsClient` construction
Turbo87 1016bb6
controllers/version/docs: Simplify return type
Turbo87 49b0be2
controllers/version/docs: Simplify error handling
Turbo87 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[package] | ||
name = "crates_io_docs_rs" | ||
version = "0.0.0" | ||
license = "MIT OR Apache-2.0" | ||
edition = "2024" | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[features] | ||
mock = ["dep:mockall"] | ||
|
||
[dependencies] | ||
anyhow = "=1.0.98" | ||
async-trait = "=0.1.88" | ||
crates_io_env_vars = { path = "../crates_io_env_vars" } | ||
http = "=1.3.1" | ||
mockall = { version = "=0.13.1", optional = true } | ||
reqwest = { version = "=0.12.15", features = ["json"] } | ||
serde = { version = "=1.0.219", features = ["derive"] } | ||
thiserror = "=2.0.12" | ||
tracing = "=0.1.41" | ||
url = "=2.5.4" | ||
|
||
[dev-dependencies] | ||
claims = "=0.8.0" | ||
serde_json = "=1.0.140" | ||
mockito = "=1.7.0" | ||
test-case = "=3.3.1" | ||
tokio = { version = "=1.45.0", features = ["macros", "rt-multi-thread"] } | ||
tracing-subscriber = "=0.3.19" |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# crates_io_docs_rs | ||
|
||
This package implements functionality for interacting with the docs.rs API. | ||
|
||
It contains a `DocsRsClient` trait that defines the supported operations, that | ||
the crates.io codebase needs to interact with docs.rs. The `RealDocsRsClient` | ||
struct is an implementation of this trait that uses the `reqwest` crate to | ||
perform the actual HTTP requests. | ||
|
||
If the `mock` feature is enabled, a `MockDocsRsClient` struct is available, | ||
which can be used for testing purposes. This struct is generated automatically | ||
by the [`mockall`](https://docs.rs/mockall) crate. |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use anyhow::{Result, anyhow}; | ||
use crates_io_docs_rs::{DocsRsClient, RealDocsRsClient}; | ||
use std::env; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<()> { | ||
tracing_subscriber::fmt::init(); | ||
|
||
let access_token = env::args() | ||
.nth(1) | ||
.ok_or_else(|| anyhow!("Missing access token"))?; | ||
|
||
let docs_rs = RealDocsRsClient::new("https://docs.rs", access_token)?; | ||
|
||
docs_rs.rebuild_docs("empty-library", "1.0.0").await?; | ||
|
||
Ok(()) | ||
} |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
frondeus/test-case#148
I noticed it too when I ran the tests locally 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't notice 😅
reason enough to drop it?