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
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(rename = "http")]
HTTP {
scheme: String,
#[serde(rename = "bearerFormat")]
bearer_format: Option<String>,
},
#[serde(rename = "oauth2")]
OAuth2 { flows: OAuth2Flows },
#[serde(rename = "openIdConnect")]
OpenIDConnect {
#[serde(rename = "openIdConnectUrl")]
open_id_connect_url: String,
},
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub enum APIKeyLocation {
#[serde(rename = "query")]
Query,
#[serde(rename = "header")]
Header,
#[serde(rename = "cookie")]
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)]
pub enum OAuth2Flow {
#[serde(rename = "implicit")]
Implicit {
#[serde(rename = "authorizationUrl")]
authorization_url: String,
#[serde(rename = "refreshUrl")]
refresh_url: Option<String>,
#[serde(default)]
scopes: IndexMap<String, String>,
},
#[serde(rename = "password")]
Password {
#[serde(rename = "refreshUrl")]
refresh_url: Option<String>,
#[serde(rename = "tokenUrl")]
token_url: String,
#[serde(default)]
scopes: IndexMap<String, String>,
},
#[serde(rename = "clientCredentials")]
ClientCredentials {
#[serde(rename = "refreshUrl")]
refresh_url: Option<String>,
#[serde(rename = "tokenUrl")]
token_url: String,
#[serde(default)]
scopes: IndexMap<String, String>,
},
#[serde(rename = "authorizationCode")]
AuthorizationCode {
#[serde(rename = "authorizationUrl")]
authorization_url: String,
#[serde(rename = "tokenUrl")]
token_url: String,
#[serde(rename = "refreshUrl")]
refresh_url: Option<String>,
#[serde(default)]
scopes: IndexMap<String, String>,
},
}