1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
use indexmap::IndexMap;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(tag = "type")]
pub enum SecurityScheme {
#[serde(rename = "apiKey")]
APIKey {
#[serde(rename = "in")]
location: APIKeyLocation,
name: String,
#[serde(skip_serializing_if = "Option::is_none")]
description: Option<String>,
},
#[serde(rename = "http")]
HTTP {
scheme: String,
#[serde(rename = "bearerFormat", skip_serializing_if = "Option::is_none")]
bearer_format: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
description: Option<String>,
},
#[serde(rename = "oauth2")]
OAuth2 {
flows: OAuth2Flows,
#[serde(skip_serializing_if = "Option::is_none")]
description: Option<String>,
},
#[serde(rename = "openIdConnect")]
OpenIDConnect {
#[serde(rename = "openIdConnectUrl")]
open_id_connect_url: String,
#[serde(skip_serializing_if = "Option::is_none")]
description: Option<String>,
},
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub enum APIKeyLocation {
Query,
Header,
Cookie,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct OAuth2Flows {
#[serde(flatten)]
pub implicit: Option<OAuth2Flow>,
#[serde(flatten)]
pub password: Option<OAuth2Flow>,
#[serde(flatten)]
pub client_credentials: Option<OAuth2Flow>,
#[serde(flatten)]
pub authorization_code: Option<OAuth2Flow>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub enum OAuth2Flow {
#[serde(rename_all = "camelCase")]
Implicit {
authorization_url: String,
#[serde(skip_serializing_if = "Option::is_none")]
refresh_url: Option<String>,
#[serde(default)]
scopes: IndexMap<String, String>,
},
#[serde(rename_all = "camelCase")]
Password {
#[serde(skip_serializing_if = "Option::is_none")]
refresh_url: Option<String>,
token_url: String,
#[serde(default)]
scopes: IndexMap<String, String>,
},
#[serde(rename_all = "camelCase")]
ClientCredentials {
#[serde(skip_serializing_if = "Option::is_none")]
refresh_url: Option<String>,
token_url: String,
#[serde(default)]
scopes: IndexMap<String, String>,
},
#[serde(rename_all = "camelCase")]
AuthorizationCode {
authorization_url: String,
token_url: String,
#[serde(skip_serializing_if = "Option::is_none")]
refresh_url: Option<String>,
#[serde(default)]
scopes: IndexMap<String, String>,
},
}