feat(import): bind OpenAPI security schemes safely
This commit is contained in:
1 parent
c562d5368d
commit
41a0e46110
38 files changed
+4651
-590
No files matched your search
@@ -542,17 +542,48 @@ pub struct OpenApiImportPreviewResponse {
|
||||
pub job_id: String,
|
||||
pub expires_at: String,
|
||||
pub preview: crank_import::rest::ImportPreview,
|
||||
/// Compatible Auth Profiles visible to the current workspace, grouped by
|
||||
/// operation and security alternative. Profile credentials are never
|
||||
/// included.
|
||||
pub auth_profile_choices: Vec<OpenApiAuthProfileChoice>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize)]
|
||||
pub struct OpenApiAuthProfileChoice {
|
||||
pub operation_key: String,
|
||||
pub alternative_index: usize,
|
||||
pub scheme_names: Vec<String>,
|
||||
pub supported: bool,
|
||||
pub profiles: Vec<OpenApiAuthProfileOption>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize)]
|
||||
pub struct OpenApiAuthProfileOption {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
pub kind: AuthKind,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
pub struct OpenApiImportCreatePayload {
|
||||
pub selected_operation_keys: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub auth_mappings: Vec<OpenApiAuthMapping>,
|
||||
#[serde(default)]
|
||||
pub server_url: Option<String>,
|
||||
#[serde(default = "default_openapi_conflict_mode")]
|
||||
pub conflict_mode: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct OpenApiAuthMapping {
|
||||
pub operation_key: String,
|
||||
pub alternative_index: usize,
|
||||
/// `None` is an explicit unresolved mapping. It is never actionable for a
|
||||
/// required authentication alternative.
|
||||
pub auth_profile_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize)]
|
||||
pub struct OpenApiImportCreateResponse {
|
||||
pub created: Vec<OpenApiImportCreatedOperation>,
|
||||
|
||||
Reference in new issue
Block a user