Skip to main content

cratestack_core/schema/
procedure.rs

1//! Procedure / query-mutation IR nodes parsed out of a `.cstack` file.
2
3use serde::{Deserialize, Serialize};
4
5use super::SourceSpan;
6use super::model::{Attribute, TypeRef};
7
8#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9pub struct Procedure {
10    pub docs: Vec<String>,
11    pub name: String,
12    pub name_span: SourceSpan,
13    pub kind: ProcedureKind,
14    pub args: Vec<ProcedureArg>,
15    pub return_type: TypeRef,
16    pub attributes: Vec<Attribute>,
17    pub span: SourceSpan,
18}
19
20#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
21pub enum ProcedureKind {
22    Query,
23    Mutation,
24}
25
26#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
27pub struct ProcedureArg {
28    pub docs: Vec<String>,
29    pub name: String,
30    pub name_span: SourceSpan,
31    pub ty: TypeRef,
32    pub span: SourceSpan,
33}