wesley_core/domain/
operation.rs1use indexmap::IndexMap;
4use serde::{Deserialize, Serialize};
5
6use super::ir::TypeReference;
7
8#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
10#[serde(rename_all = "camelCase")]
11pub struct OperationDirectiveArgs {
12 pub directive_name: String,
14 pub arguments: IndexMap<String, serde_json::Value>,
16}
17
18#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
20#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
21pub enum OperationType {
22 Query,
24 Mutation,
26 Subscription,
28}
29
30#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
32#[serde(rename_all = "camelCase")]
33pub struct OperationArgument {
34 pub name: String,
36 pub r#type: TypeReference,
38 #[serde(skip_serializing_if = "Option::is_none")]
40 pub default_value: Option<serde_json::Value>,
41 pub directives: IndexMap<String, serde_json::Value>,
43}
44
45#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
47#[serde(rename_all = "camelCase")]
48pub struct SchemaOperation {
49 pub operation_type: OperationType,
51 pub root_type_name: String,
53 pub field_name: String,
55 pub arguments: Vec<OperationArgument>,
57 pub result_type: TypeReference,
59 pub directives: IndexMap<String, serde_json::Value>,
61}