From b5853918e9cdc2b5cd62d5f2a9f3f1a8aa7722ac Mon Sep 17 00:00:00 2001 From: Raminder Singh Date: Mon, 23 Sep 2024 14:12:42 +0530 Subject: [PATCH] correct api paths in openapi docs --- api/src/routes/images.rs | 5 +++++ api/src/routes/pipelines.rs | 19 +++++++++++++++++++ api/src/routes/sinks.rs | 5 +++++ api/src/routes/sources.rs | 5 +++++ api/src/routes/sources/publications.rs | 5 +++++ api/src/routes/sources/tables.rs | 1 + api/src/routes/tenants.rs | 5 +++++ 7 files changed, 45 insertions(+) diff --git a/api/src/routes/images.rs b/api/src/routes/images.rs index 8dd5f90..e2e5f28 100644 --- a/api/src/routes/images.rs +++ b/api/src/routes/images.rs @@ -75,6 +75,7 @@ pub struct GetImageResponse { } #[utoipa::path( + context_path = "/v1", request_body = PostImageRequest, responses( (status = 200, description = "Create new image", body = PostImageResponse), @@ -93,6 +94,7 @@ pub async fn create_image( } #[utoipa::path( + context_path = "/v1", params( ("image_id" = i64, Path, description = "Id of the image"), ), @@ -120,6 +122,7 @@ pub async fn read_image( } #[utoipa::path( + context_path = "/v1", request_body = PostImageRequest, params( ("image_id" = i64, Path, description = "Id of the image"), @@ -144,6 +147,7 @@ pub async fn update_image( } #[utoipa::path( + context_path = "/v1", params( ("image_id" = i64, Path, description = "Id of the image"), ), @@ -166,6 +170,7 @@ pub async fn delete_image( } #[utoipa::path( + context_path = "/v1", responses( (status = 200, description = "Return all images"), (status = 500, description = "Internal server error") diff --git a/api/src/routes/pipelines.rs b/api/src/routes/pipelines.rs index eaced78..7e31631 100644 --- a/api/src/routes/pipelines.rs +++ b/api/src/routes/pipelines.rs @@ -153,6 +153,7 @@ fn extract_tenant_id(req: &HttpRequest) -> Result { } #[utoipa::path( + context_path = "/v1", request_body = PostPipelineRequest, responses( (status = 200, description = "Create new pipeline", body = PostPipelineResponse), @@ -197,6 +198,7 @@ pub async fn create_pipeline( } #[utoipa::path( + context_path = "/v1", params( ("pipeline_id" = i64, Path, description = "Id of the pipeline"), ), @@ -236,6 +238,7 @@ pub async fn read_pipeline( } #[utoipa::path( + context_path = "/v1", request_body = PostSinkRequest, params( ("pipeline_id" = i64, Path, description = "Id of the pipeline"), @@ -285,6 +288,7 @@ pub async fn update_pipeline( } #[utoipa::path( + context_path = "/v1", params( ("pipeline_id" = i64, Path, description = "Id of the pipeline"), ), @@ -309,6 +313,7 @@ pub async fn delete_pipeline( } #[utoipa::path( + context_path = "/v1", responses( (status = 200, description = "Return all pipelines"), (status = 500, description = "Internal server error") @@ -337,6 +342,13 @@ pub async fn read_all_pipelines( Ok(Json(pipelines)) } +#[utoipa::path( + context_path = "/v1", + responses( + (status = 200, description = "Start a pipeline"), + (status = 500, description = "Internal server error") + ) +)] #[post("/pipelines/{pipeline_id}/start")] pub async fn start_pipeline( req: HttpRequest, @@ -361,6 +373,13 @@ pub async fn start_pipeline( Ok(HttpResponse::Ok().finish()) } +#[utoipa::path( + context_path = "/v1", + responses( + (status = 200, description = "Stop a pipeline"), + (status = 500, description = "Internal server error") + ) +)] #[post("/pipelines/{pipeline_id}/stop")] pub async fn stop_pipeline( req: HttpRequest, diff --git a/api/src/routes/sinks.rs b/api/src/routes/sinks.rs index d1254a5..5d82b4c 100644 --- a/api/src/routes/sinks.rs +++ b/api/src/routes/sinks.rs @@ -105,6 +105,7 @@ fn extract_tenant_id(req: &HttpRequest) -> Result { } #[utoipa::path( + context_path = "/v1", request_body = PostSinkRequest, responses( (status = 200, description = "Create new sink", body = PostSinkResponse), @@ -127,6 +128,7 @@ pub async fn create_sink( } #[utoipa::path( + context_path = "/v1", params( ("sink_id" = i64, Path, description = "Id of the sink"), ), @@ -157,6 +159,7 @@ pub async fn read_sink( } #[utoipa::path( + context_path = "/v1", request_body = PostSinkRequest, params( ("sink_id" = i64, Path, description = "Id of the sink"), @@ -186,6 +189,7 @@ pub async fn update_sink( } #[utoipa::path( + context_path = "/v1", params( ("sink_id" = i64, Path, description = "Id of the sink"), ), @@ -210,6 +214,7 @@ pub async fn delete_sink( } #[utoipa::path( + context_path = "/v1", responses( (status = 200, description = "Return all sinks"), (status = 500, description = "Internal server error") diff --git a/api/src/routes/sources.rs b/api/src/routes/sources.rs index e8c31d1..bce0d99 100644 --- a/api/src/routes/sources.rs +++ b/api/src/routes/sources.rs @@ -112,6 +112,7 @@ fn extract_tenant_id(req: &HttpRequest) -> Result { } #[utoipa::path( + context_path = "/v1", request_body = PostSourceRequest, responses( (status = 200, description = "Create new source", body = PostSourceResponse), @@ -134,6 +135,7 @@ pub async fn create_source( } #[utoipa::path( + context_path = "/v1", params( ("source_id" = i64, Path, description = "Id of the source"), ), @@ -164,6 +166,7 @@ pub async fn read_source( } #[utoipa::path( + context_path = "/v1", request_body = PostSourceRequest, params( ("source_id" = i64, Path, description = "Id of the source"), @@ -193,6 +196,7 @@ pub async fn update_source( } #[utoipa::path( + context_path = "/v1", params( ("source_id" = i64, Path, description = "Id of the source"), ), @@ -217,6 +221,7 @@ pub async fn delete_source( } #[utoipa::path( + context_path = "/v1", responses( (status = 200, description = "Return all sources"), (status = 500, description = "Internal server error") diff --git a/api/src/routes/sources/publications.rs b/api/src/routes/sources/publications.rs index 264590a..da4a359 100644 --- a/api/src/routes/sources/publications.rs +++ b/api/src/routes/sources/publications.rs @@ -102,6 +102,7 @@ pub struct UpdatePublicationRequest { } #[utoipa::path( + context_path = "/v1", request_body = CreatePublicationRequest, responses( (status = 200, description = "Create new publication"), @@ -136,6 +137,7 @@ pub async fn create_publication( } #[utoipa::path( + context_path = "/v1", params( ("source_id" = i64, Path, description = "Id of the source"), ("publication_name" = i64, Path, description = "Name of the publication"), @@ -170,6 +172,7 @@ pub async fn read_publication( } #[utoipa::path( + context_path = "/v1", request_body = UpdatePublicationRequest, params( ("source_id" = i64, Path, description = "Id of the source"), @@ -209,6 +212,7 @@ pub async fn update_publication( } #[utoipa::path( + context_path = "/v1", params( ("source_id" = i64, Path, description = "Id of the source"), ("publication_name" = i64, Path, description = "Name of the publication"), @@ -241,6 +245,7 @@ pub async fn delete_publication( } #[utoipa::path( + context_path = "/v1", params( ("source_id" = i64, Path, description = "Id of the source"), ), diff --git a/api/src/routes/sources/tables.rs b/api/src/routes/sources/tables.rs index e7db0f8..45a2c14 100644 --- a/api/src/routes/sources/tables.rs +++ b/api/src/routes/sources/tables.rs @@ -81,6 +81,7 @@ fn extract_tenant_id(req: &HttpRequest) -> Result { } #[utoipa::path( + context_path = "/v1", params( ("source_id" = i64, Path, description = "Id of the source"), ), diff --git a/api/src/routes/tenants.rs b/api/src/routes/tenants.rs index 1509978..2f30670 100644 --- a/api/src/routes/tenants.rs +++ b/api/src/routes/tenants.rs @@ -74,6 +74,7 @@ pub struct GetTenantResponse { } #[utoipa::path( + context_path = "/v1", request_body = PostTenantRequest, responses( (status = 200, description = "Create new tenant", body = PostTenantResponse), @@ -93,6 +94,7 @@ pub async fn create_tenant( } #[utoipa::path( + context_path = "/v1", params( ("tenant_id" = i64, Path, description = "Id of the tenant"), ), @@ -119,6 +121,7 @@ pub async fn read_tenant( } #[utoipa::path( + context_path = "/v1", request_body = PostTenantRequest, params( ("tenant_id" = i64, Path, description = "Id of the tenant"), @@ -143,6 +146,7 @@ pub async fn update_tenant( } #[utoipa::path( + context_path = "/v1", params( ("tenant_id" = i64, Path, description = "Id of the tenant"), ), @@ -165,6 +169,7 @@ pub async fn delete_tenant( } #[utoipa::path( + context_path = "/v1", responses( (status = 200, description = "Return all tenants"), (status = 500, description = "Internal server error")