fix(daemon): ship the OpenRPC document inside the crate

docs/openrpc.json lived at the repository root, outside the soulseek-rs
package, so the include_str! in proto compiled from a checkout but not
from the published tarball - cargo publish failed verification and the
v13.0.0 release stopped after publishing the lib. The document moves
into the crate's own docs/, where packaging can see it; the generator
test and every link follow.
This commit is contained in:
Michel de Graaf
2026-07-29 17:34:29 +02:00
parent 881b124b7d
commit d11326f149
7 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
# Generated and compared byte-for-byte by `daemon::openrpc::document_is_current`,
# which builds its expectation with `\n`. A CRLF checkout would fail that test on
# Windows.
docs/openrpc.json text eol=lf
soulseek-rs/docs/openrpc.json text eol=lf
+1 -1
View File
@@ -202,7 +202,7 @@ the internet. Reach it over SSH instead, with a tunnel
The daemon speaks newline-delimited JSON-RPC 2.0, described by an
[OpenRPC](https://open-rpc.org) document,
[`docs/openrpc.json`](docs/openrpc.json), which it also serves over
[`soulseek-rs/docs/openrpc.json`](soulseek-rs/docs/openrpc.json), which it also serves over
`rpc.discover`. Point a client generator at it for typed bindings in your
language. Searches, transfers, rooms, private messages and shares are all on
the interface this CLI uses, with no private back channel, and live updates are
+1 -1
View File
@@ -2,7 +2,7 @@
`soulseek-rs daemon` stays logged in and answers JSON-RPC over a socket, so
several clients can share one Soulseek session. The machine-readable contract
is [`openrpc.json`](openrpc.json), an [OpenRPC](https://open-rpc.org)
is [`openrpc.json`](../soulseek-rs/docs/openrpc.json), an [OpenRPC](https://open-rpc.org)
document and the JSON-RPC counterpart to OpenAPI. Point a client generator at it,
or at a running daemon via `rpc.discover`, and you have a client in your
language.
+2 -2
View File
@@ -348,10 +348,10 @@ fn document() -> Value {
})
}
/// Where the published document lives, relative to this source file.
/// Where the published document lives. Inside this crate, not the repository's
/// docs/: `include_str!` has to find it in the published package too.
fn document_path() -> std::path::PathBuf {
std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
.join("..")
.join("docs")
.join("openrpc.json")
}
+1 -1
View File
@@ -17,7 +17,7 @@ pub const PROTOCOL_VERSION: u32 = 1;
/// The OpenRPC document, served by `rpc.discover` so a generator can point at
/// a running daemon instead of needing this repository.
pub const OPENRPC: &str = include_str!("../../../../docs/openrpc.json");
pub const OPENRPC: &str = include_str!("../../../docs/openrpc.json");
mod dto;
mod envelope;
+2 -2
View File
@@ -360,8 +360,8 @@ const Daemon = () => (
<ExtLink href="https://open-rpc.org">OpenRPC</ExtLink> document. The daemon serves
that document itself through <Code>rpc.discover</Code>, so a client can ask it what
it can do. The same document is checked in at{' '}
<ExtLink href={`${LINKS.gh}/blob/master/docs/openrpc.json`}>
docs/openrpc.json
<ExtLink href={`${LINKS.gh}/blob/master/soulseek-rs/docs/openrpc.json`}>
soulseek-rs/docs/openrpc.json
</ExtLink>{' '}
on GitHub. <Code>auth</Code> answers with the protocol version, 1 today, so a
client written against an older shape learns it at connect time.