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 pub encoding: IndexMap<String, IndexMap<String, IrRequestBodyEncoding>>,
53}
54
55#[derive(Debug, Clone, Serialize)]
57pub struct IrRequestBodyEncoding {
58 pub content_type: Option<String>,
59}
60
61#[derive(Debug, Clone, Serialize)]
63pub struct IrResponse {
64 pub status: String,
65 pub description: String,
66 pub content: IndexMap<String, IrTypeExpr>,
67 pub item_content: IndexMap<String, IrTypeExpr>,
70 pub headers: IndexMap<String, IrHeader>,
71}
72
73#[derive(Debug, Clone, Serialize)]
75pub struct IrHeader {
76 pub description: Option<String>,
77 pub type_expr: IrTypeExpr,
78 pub required: bool,
79}
80
81#[derive(Debug, Clone, Serialize)]
83pub struct IrSecurityRequirement {
84 pub scheme_name: String,
85 pub scopes: Vec<String>,
86}