Skip to content

Commit 7c03f92

Browse files
authored
Implement Clone and PartialEq for GraphQLResponse (#1228, #103)
1 parent f98bdf1 commit 7c03f92

File tree

7 files changed

+9
-6
lines changed

7 files changed

+9
-6
lines changed

juniper/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ All user visible changes to `juniper` crate will be documented in this file. Thi
7171
- `LookAheadMethods::field_original_name()` and `LookAheadMethods::field_alias()` methods. ([#1199])
7272
- [`anyhow` crate] integration behind `anyhow` and `backtrace` [Cargo feature]s. ([#1215], [#988])
7373
- `RootNode::disable_introspection()` applying additional `validation::rules::disable_introspection`, and `RootNode::enable_introspection()` reverting it. ([#1227], [#456])
74+
- `Clone` and `PartialEq` implementations for `GraphQLResponse`. ([#1228], [#103])
7475

7576
### Changed
7677

@@ -88,6 +89,7 @@ All user visible changes to `juniper` crate will be documented in this file. Thi
8889
- Incorrect error when explicit `null` provided for `null`able list input parameter. ([#1086], [#1085])
8990
- Stack overflow on nested GraphQL fragments. ([CVE-2022-31173])
9091

92+
[#103]: /../../issues/103
9193
[#113]: /../../issues/113
9294
[#456]: /../../issues/456
9395
[#503]: /../../issues/503
@@ -143,6 +145,7 @@ All user visible changes to `juniper` crate will be documented in this file. Thi
143145
[#1215]: /../../pull/1215
144146
[#1221]: /../../pull/1221
145147
[#1227]: /../../pull/1227
148+
[#1228]: /../../pull/1228
146149
[ba1ed85b]: /../../commit/ba1ed85b3c3dd77fbae7baf6bc4e693321a94083
147150
[CVE-2022-31173]: /../../security/advisories/GHSA-4rx6-g5vg-5f3j
148151

juniper/src/executor/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ where
8787
///
8888
/// All execution errors contain the source position in the query of the field
8989
/// that failed to resolve. It also contains the field stack.
90-
#[derive(Debug, PartialEq)]
90+
#[derive(Clone, Debug, PartialEq)]
9191
pub struct ExecutionError<S> {
9292
location: SourcePosition,
9393
path: Vec<String>,

juniper/src/http/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ where
163163
/// This struct implements Serialize, so you can simply serialize this
164164
/// to JSON and send it over the wire. Use the `is_ok` method to determine
165165
/// whether to send a 200 or 400 HTTP status code.
166-
#[derive(Debug)]
166+
#[derive(Clone, Debug, PartialEq)]
167167
pub struct GraphQLResponse<S = DefaultScalarValue>(
168168
Result<(Value<S>, Vec<ExecutionError<S>>), GraphQLError>,
169169
);

juniper/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ pub use crate::{
9898

9999
/// An error that prevented query execution
100100
#[allow(missing_docs)]
101-
#[derive(Debug, Eq, PartialEq)]
101+
#[derive(Clone, Debug, Eq, PartialEq)]
102102
pub enum GraphQLError {
103103
ParseError(Spanning<ParseError>),
104104
ValidationError(Vec<RuleError>),

juniper/src/parser/lexer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub enum Token<'a> {
5151
}
5252

5353
/// Error when tokenizing the input source
54-
#[derive(Debug, PartialEq, Eq)]
54+
#[derive(Clone, Debug, PartialEq, Eq)]
5555
pub enum LexerError {
5656
/// An unknown character was found
5757
///

juniper/src/parser/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use smartstring::alias::String;
55
use crate::parser::{Lexer, LexerError, Spanning, Token};
66

77
/// Error while parsing a GraphQL query
8-
#[derive(Debug, Eq, PartialEq)]
8+
#[derive(Clone, Debug, Eq, PartialEq)]
99
pub enum ParseError {
1010
/// An unexpected token occurred in the source
1111
// TODO: Previously was `Token<'a>`.

juniper/src/validation/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::schema::{meta::MetaType, model::SchemaType};
1010
use crate::parser::SourcePosition;
1111

1212
/// Query validation error
13-
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)]
13+
#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
1414
pub struct RuleError {
1515
locations: Vec<SourcePosition>,
1616
message: String,

0 commit comments

Comments
 (0)