Skip to content

Commit

Permalink
Put behind Cargo features
Browse files Browse the repository at this point in the history
  • Loading branch information
tyranron committed Oct 16, 2023
1 parent f1f8a00 commit 280db94
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ jobs:
- { feature: time, crate: juniper }
- { feature: url, crate: juniper }
- { feature: uuid, crate: juniper }
- { feature: graphql-transport-ws, crate: juniper_graphql_ws }
- { feature: graphql-ws, crate: juniper_graphql_ws }
- { feature: <none>, crate: juniper_actix }
- { feature: subscriptions, crate: juniper_actix }
- { feature: <none>, crate: juniper_warp }
Expand Down
2 changes: 1 addition & 1 deletion juniper_actix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ actix-web-actors = { version = "4.1", optional = true }
anyhow = "1.0.47"
futures = "0.3.22"
juniper = { version = "0.16.0-dev", path = "../juniper", default-features = false }
juniper_graphql_ws = { version = "0.4.0-dev", path = "../juniper_graphql_ws", optional = true }
juniper_graphql_ws = { version = "0.4.0-dev", path = "../juniper_graphql_ws", features = ["graphql-transport-ws", "graphql-ws"], optional = true }
http = "0.2.4"
serde = { version = "1.0.122", features = ["derive"] }
serde_json = "1.0.18"
Expand Down
4 changes: 2 additions & 2 deletions juniper_graphql_ws/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ All user visible changes to `juniper_graphql_ws` crate will be documented in thi

### BC Breaks

- Moved existing implementation to `graphql_ws` module implementing [legacy `graphql-ws` GraphQL over WebSocket Protocol][proto-legacy]. ([#1196])
- Moved existing implementation to `graphql_ws` module implementing [legacy `graphql-ws` GraphQL over WebSocket Protocol][proto-legacy] behind `graphql-ws` Cargo feature. ([#1196])
- Switched to 0.16 version of [`juniper` crate].
- Switched to 0.17 version of [`juniper_subscriptions` crate].

### Added

- `graphql_transport_ws` module implementing [`graphql-transport-ws` GraphQL over WebSocket Protocol][proto-5.14.0] as of 5.14.0 version of [`graphql-ws` npm package]. ([#1158], [#1191], [#1196], [#1022])
- `graphql_transport_ws` module implementing [`graphql-transport-ws` GraphQL over WebSocket Protocol][proto-5.14.0] as of 5.14.0 version of [`graphql-ws` npm package] behind `graphql-transport-ws` Cargo feature. ([#1158], [#1191], [#1196], [#1022])

### Changed

Expand Down
17 changes: 14 additions & 3 deletions juniper_graphql_ws/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,28 @@ name = "juniper_graphql_ws"
version = "0.4.0-dev"
edition = "2021"
rust-version = "1.65"
description = "Legacy `graphql-ws` GraphQL over WebSocket Protocol implementation for `juniper` crate."
description = "GraphQL over WebSocket Protocol implementations for `juniper` crate."
license = "BSD-2-Clause"
authors = ["Christopher Brown <[email protected]>"]
authors = [
"Christopher Brown <[email protected]>",
"Kai Ren <[email protected]>",
]
documentation = "https://docs.rs/juniper_graphql_ws"
homepage = "https://github.com/graphql-rust/juniper/tree/master/juniper_graphql_ws"
repository = "https://github.com/graphql-rust/juniper"
readme = "README.md"
categories = ["asynchronous", "web-programming", "web-programming::http-server"]
keywords = ["apollo", "graphql", "graphql-ws", "subscription", "websocket"]
keywords = ["apollo", "graphql-transport-ws", "graphql-ws", "subscription", "websocket"]
exclude = ["/release.toml"]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[features]
graphql-transport-ws = []
graphql-ws = []

[dependencies]
juniper = { version = "0.16.0-dev", path = "../juniper", default-features = false }
juniper_subscriptions = { version = "0.17.0-dev", path = "../juniper_subscriptions" }
Expand Down
6 changes: 5 additions & 1 deletion juniper_graphql_ws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@

- [Changelog](https://github.com/graphql-rust/juniper/blob/master/juniper_graphql_ws/CHANGELOG.md)

This crate contains an implementation of the [legacy `graphql-ws` GraphQL over WebSocket Protocol][old], as formerly used by [Apollo] and [`subscriptions-transport-ws` npm package]. It has now been deprecated in favor of the [new `graphql-transport-ws` GraphQL over WebSocket Protocol][new], implemented by the new and new [`graphql-ws` npm package].
This crate contains implementations of 2 protocols:

1. (`graphql-transport-ws` feature) The [new `graphql-transport-ws` GraphQL over WebSocket Protocol][new], as now used by [Apollo] and [`graphql-ws` npm package].

2. (`graphql-ws` feature) The [legacy `graphql-ws` GraphQL over WebSocket Protocol][old], as formerly used by [Apollo] and [`subscriptions-transport-ws` npm package] (deprecated in favor of the [new `graphql-transport-ws` GraphQL over WebSocket Protocol][new] mentioned above).



Expand Down
8 changes: 8 additions & 0 deletions juniper_graphql_ws/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
#![doc = include_str!("../README.md")]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![deny(missing_docs, warnings)]

#[cfg(not(any(feature = "graphql-transport-ws", feature = "graphql-ws")))]
compile_error!(
r#"at least one feature must be enabled (either "graphql-transport-ws" or "graphql-ws")"#
);

#[cfg(feature = "graphql-transport-ws")]
pub mod graphql_transport_ws;
#[cfg(feature = "graphql-ws")]
pub mod graphql_ws;
mod schema;
mod server_message;
Expand Down
2 changes: 1 addition & 1 deletion juniper_warp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ subscriptions = [
anyhow = "1.0.47"
futures = "0.3.22"
juniper = { version = "0.16.0-dev", path = "../juniper", default-features = false }
juniper_graphql_ws = { version = "0.4.0-dev", path = "../juniper_graphql_ws", optional = true }
juniper_graphql_ws = { version = "0.4.0-dev", path = "../juniper_graphql_ws", features = ["graphql-transport-ws", "graphql-ws"], optional = true }
log = { version = "0.4", optional = true }
serde = { version = "1.0.122", features = ["derive"] }
serde_json = "1.0.18"
Expand Down

0 comments on commit 280db94

Please sign in to comment.