Add OpenAPI import backend
This commit is contained in:
@@ -41,6 +41,7 @@ macro_rules! define_registry_id {
|
||||
}
|
||||
|
||||
define_registry_id!(YamlImportJobId);
|
||||
define_registry_id!(ImportJobId);
|
||||
define_registry_id!(WorkspaceUpstreamId);
|
||||
|
||||
pub type RegistryOperation = Operation<Schema, MappingSet>;
|
||||
@@ -326,6 +327,61 @@ pub struct YamlImportJobCompletion {
|
||||
pub finished_at: OffsetDateTime,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ImportJobStatus {
|
||||
Pending,
|
||||
Completed,
|
||||
Failed,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ImportJobKind {
|
||||
OpenApi,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ImportJob {
|
||||
pub id: ImportJobId,
|
||||
pub workspace_id: WorkspaceId,
|
||||
pub kind: ImportJobKind,
|
||||
pub source_format: String,
|
||||
pub source_version: Option<String>,
|
||||
pub status: ImportJobStatus,
|
||||
pub preview_payload: Value,
|
||||
pub created_operation_ids: Value,
|
||||
pub error_text: Option<String>,
|
||||
#[serde(with = "time::serde::rfc3339")]
|
||||
pub created_at: OffsetDateTime,
|
||||
#[serde(with = "time::serde::rfc3339")]
|
||||
pub expires_at: OffsetDateTime,
|
||||
#[serde(with = "time::serde::rfc3339::option")]
|
||||
pub finished_at: Option<OffsetDateTime>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct CreateImportJobRequest<'a> {
|
||||
pub id: &'a ImportJobId,
|
||||
pub workspace_id: &'a WorkspaceId,
|
||||
pub kind: ImportJobKind,
|
||||
pub source_format: &'a str,
|
||||
pub source_version: Option<&'a str>,
|
||||
pub status: ImportJobStatus,
|
||||
pub preview_payload: &'a Value,
|
||||
pub created_at: &'a OffsetDateTime,
|
||||
pub expires_at: &'a OffsetDateTime,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct FinishImportJobRequest<'a> {
|
||||
pub id: &'a ImportJobId,
|
||||
pub status: ImportJobStatus,
|
||||
pub created_operation_ids: &'a Value,
|
||||
pub error_text: Option<&'a str>,
|
||||
pub finished_at: &'a OffsetDateTime,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct CreateInvocationLogRequest<'a> {
|
||||
pub log: &'a InvocationLog,
|
||||
|
||||
Reference in New Issue
Block a user