Closed firekind closed 5 months ago
When a document contains multiple operations, the generated QUERY and __QUERY_WORKAROUND constants are incorrect.
QUERY
__QUERY_WORKAROUND
Using the schema and queries defined in this test and running cargo expand, you get:
cargo expand
use graphql_client::GraphQLQuery; #[graphql( query_path = "query.graphql", schema_path = "schema.graphql", response_derives = "Debug, PartialEq, Eq" )] pub struct Heights; pub mod heights { . . . pub const OPERATION_NAME: &str = "Heights"; pub const QUERY: &str = "query Heights($buildingId: ID!, $mountainName: String) {\n mountainHeight(name: $mountainName)\n buildingHeight(id: $buildingId)\n}\n\nquery Echo($msg: String) {\n echo(msg: $msg)\n}"; const __QUERY_WORKAROUND: &str = "query Heights($buildingId: ID!, $mountainName: String) {\n mountainHeight(name: $mountainName)\n buildingHeight(id: $buildingId)\n}\n\nquery Echo($msg: String) {\n echo(msg: $msg)\n}"; use serde::{Serialize, Deserialize}; use super::*; . . . } #[graphql( query_path = "query.graphql", schema_path = "schema.graphql", response_derives = "Debug, PartialEq, Eq" )] pub struct Echo; pub mod echo { . . . pub const OPERATION_NAME: &str = "Echo"; pub const QUERY: &str = "query Heights($buildingId: ID!, $mountainName: String) {\n mountainHeight(name: $mountainName)\n buildingHeight(id: $buildingId)\n}\n\nquery Echo($msg: String) {\n echo(msg: $msg)\n}"; const __QUERY_WORKAROUND: &str = "query Heights($buildingId: ID!, $mountainName: String) {\n mountainHeight(name: $mountainName)\n buildingHeight(id: $buildingId)\n}\n\nquery Echo($msg: String) {\n echo(msg: $msg)\n}"; use serde::{Serialize, Deserialize}; . . . }
The Echo operation uses the query for Heights instead.
Echo
Heights
never mind, my bad. Didn't notice that the entire document contents were present in the two constants.
When a document contains multiple operations, the generated
QUERY
and__QUERY_WORKAROUND
constants are incorrect.Using the schema and queries defined in this test and running
cargo expand
, you get:The
Echo
operation uses the query forHeights
instead.