Skip to content

Commit e920668

Browse files
committed
Enable #[deny(missing-docs)] on the base crate
1 parent a37217b commit e920668

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/lib.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
//!
33
//! The main interface to this library is the custom derive that generates modules from a GraphQL query and schema.
44
5+
#![deny(missing_docs)]
6+
57
extern crate serde;
68
#[macro_use]
79
extern crate serde_derive;
@@ -16,20 +18,27 @@ extern crate serde_json;
1618
pub use graphql_query_derive::*;
1719

1820
/// A convenience trait that can be used to build a GraphQL request body.
21+
///
22+
/// This will be implemented for you by codegen in the normal case.
1923
pub trait GraphQLQuery<'de> {
24+
/// The shape of the variables expected by the query. This should be a generated struct most of the time.
2025
type Variables: serde::Serialize;
26+
/// The top-level shape of the response data (the `data` field in the GraphQL response). In practice this should be generated, since it is hard to write by hand without error.
2127
type ResponseData: serde::Deserialize<'de>;
2228

2329
/// Produce a GraphQL query struct that can be JSON serialized and sent to a GraphQL API.
2430
fn build_query(variables: Self::Variables) -> GraphQLQueryBody<Self::Variables>;
2531
}
2632

33+
/// The form in which queries are sent over HTTP in most implemnetations.
2734
#[derive(Debug, Serialize, Deserialize)]
2835
pub struct GraphQLQueryBody<Variables>
2936
where
3037
Variables: serde::Serialize,
3138
{
39+
/// The values for the variables. They must match those declared in the queries. This should be the `Variables` struct from the generated module corresponding to the query.
3240
pub variables: Variables,
41+
/// The GraphQL query, as a string.
3342
pub query: &'static str,
3443
}
3544

@@ -44,7 +53,9 @@ pub struct Location {
4453
#[derive(Debug, Serialize, Deserialize, PartialEq)]
4554
#[serde(untagged)]
4655
pub enum PathFragment {
56+
/// A key inside an object
4757
Key(String),
58+
/// An index inside an array
4859
Index(i32),
4960
}
5061

@@ -70,7 +81,9 @@ pub struct GraphQLError {
7081
/// Spec: [https://github.com/facebook/graphql/blob/master/spec/Section%207%20--%20Response.md]
7182
#[derive(Debug, Serialize, Deserialize)]
7283
pub struct GraphQLResponse<Data> {
84+
/// The absent, partial or complete response data.
7385
pub data: Option<Data>,
86+
/// The top-level errors returned by the server.
7487
pub errors: Option<Vec<GraphQLError>>,
7588
}
7689

0 commit comments

Comments
 (0)