openapi_nexus/ir/types/
operation.rs1use indexmap::IndexMap;
4use serde::Serialize;
5
6use super::type_expr::IrTypeExpr;
7
8#[derive(Debug, Clone, Serialize)]
10pub struct IrOperation {
11 pub operation_id: String,
12 pub tags: Vec<String>,
13 pub method: String,
14 pub path: String,
15 pub summary: Option<String>,
16 pub description: Option<String>,
17 pub deprecated: bool,
18 pub parameters: Vec<IrParameter>,
19 pub request_body: Option<IrRequestBody>,
20 pub responses: Vec<IrResponse>,
21 pub security: Vec<IrSecurityRequirement>,
22}
23
24#[derive(Debug, Clone, Serialize)]
26pub struct IrParameter {
27 pub name: String,
28 pub location: ParameterLocation,
29 pub type_expr: IrTypeExpr,
30 pub required: bool,
31 pub description: Option<String>,
32 pub default_value: Option<serde_json::Value>,
33}
34
35#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
37pub enum ParameterLocation {
38 Query,
39 Header,
40 Path,
41 Cookie,
42}
43
44#[derive(Debug, Clone, Serialize)]
46pub struct IrRequestBody {
47 pub required: bool,
48 pub description: Option<String>,
49 pub content: IndexMap<String, IrTypeExpr>,
51}
52
53#[derive(Debug, Clone, Serialize)]
55pub struct IrResponse {
56 pub status: String,
57 pub description: String,
58 pub content: IndexMap<String, IrTypeExpr>,
59 pub item_content: IndexMap<String, IrTypeExpr>,
62 pub headers: IndexMap<String, IrHeader>,
63}
64
65#[derive(Debug, Clone, Serialize)]
67pub struct IrHeader {
68 pub description: Option<String>,
69 pub type_expr: IrTypeExpr,
70 pub required: bool,
71}
72
73#[derive(Debug, Clone, Serialize)]
75pub struct IrSecurityRequirement {
76 pub scheme_name: String,
77 pub scopes: Vec<String>,
78}