Skip to content

Commit

Permalink
correct api paths in openapi docs
Browse files Browse the repository at this point in the history
  • Loading branch information
imor committed Sep 23, 2024
1 parent 0b4dd9f commit b585391
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/src/routes/images.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ pub struct GetImageResponse {
}

#[utoipa::path(
context_path = "/v1",
request_body = PostImageRequest,
responses(
(status = 200, description = "Create new image", body = PostImageResponse),
Expand All @@ -93,6 +94,7 @@ pub async fn create_image(
}

#[utoipa::path(
context_path = "/v1",
params(
("image_id" = i64, Path, description = "Id of the image"),
),
Expand Down Expand Up @@ -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"),
Expand All @@ -144,6 +147,7 @@ pub async fn update_image(
}

#[utoipa::path(
context_path = "/v1",
params(
("image_id" = i64, Path, description = "Id of the image"),
),
Expand All @@ -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")
Expand Down
19 changes: 19 additions & 0 deletions api/src/routes/pipelines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ fn extract_tenant_id(req: &HttpRequest) -> Result<i64, PipelineError> {
}

#[utoipa::path(
context_path = "/v1",
request_body = PostPipelineRequest,
responses(
(status = 200, description = "Create new pipeline", body = PostPipelineResponse),
Expand Down Expand Up @@ -197,6 +198,7 @@ pub async fn create_pipeline(
}

#[utoipa::path(
context_path = "/v1",
params(
("pipeline_id" = i64, Path, description = "Id of the pipeline"),
),
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -285,6 +288,7 @@ pub async fn update_pipeline(
}

#[utoipa::path(
context_path = "/v1",
params(
("pipeline_id" = i64, Path, description = "Id of the pipeline"),
),
Expand All @@ -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")
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions api/src/routes/sinks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ fn extract_tenant_id(req: &HttpRequest) -> Result<i64, SinkError> {
}

#[utoipa::path(
context_path = "/v1",
request_body = PostSinkRequest,
responses(
(status = 200, description = "Create new sink", body = PostSinkResponse),
Expand All @@ -127,6 +128,7 @@ pub async fn create_sink(
}

#[utoipa::path(
context_path = "/v1",
params(
("sink_id" = i64, Path, description = "Id of the sink"),
),
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -186,6 +189,7 @@ pub async fn update_sink(
}

#[utoipa::path(
context_path = "/v1",
params(
("sink_id" = i64, Path, description = "Id of the sink"),
),
Expand All @@ -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")
Expand Down
5 changes: 5 additions & 0 deletions api/src/routes/sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ fn extract_tenant_id(req: &HttpRequest) -> Result<i64, SourceError> {
}

#[utoipa::path(
context_path = "/v1",
request_body = PostSourceRequest,
responses(
(status = 200, description = "Create new source", body = PostSourceResponse),
Expand All @@ -134,6 +135,7 @@ pub async fn create_source(
}

#[utoipa::path(
context_path = "/v1",
params(
("source_id" = i64, Path, description = "Id of the source"),
),
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -193,6 +196,7 @@ pub async fn update_source(
}

#[utoipa::path(
context_path = "/v1",
params(
("source_id" = i64, Path, description = "Id of the source"),
),
Expand All @@ -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")
Expand Down
5 changes: 5 additions & 0 deletions api/src/routes/sources/publications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ pub struct UpdatePublicationRequest {
}

#[utoipa::path(
context_path = "/v1",
request_body = CreatePublicationRequest,
responses(
(status = 200, description = "Create new publication"),
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -241,6 +245,7 @@ pub async fn delete_publication(
}

#[utoipa::path(
context_path = "/v1",
params(
("source_id" = i64, Path, description = "Id of the source"),
),
Expand Down
1 change: 1 addition & 0 deletions api/src/routes/sources/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ fn extract_tenant_id(req: &HttpRequest) -> Result<i64, TableError> {
}

#[utoipa::path(
context_path = "/v1",
params(
("source_id" = i64, Path, description = "Id of the source"),
),
Expand Down
5 changes: 5 additions & 0 deletions api/src/routes/tenants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ pub struct GetTenantResponse {
}

#[utoipa::path(
context_path = "/v1",
request_body = PostTenantRequest,
responses(
(status = 200, description = "Create new tenant", body = PostTenantResponse),
Expand All @@ -93,6 +94,7 @@ pub async fn create_tenant(
}

#[utoipa::path(
context_path = "/v1",
params(
("tenant_id" = i64, Path, description = "Id of the tenant"),
),
Expand All @@ -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"),
Expand All @@ -143,6 +146,7 @@ pub async fn update_tenant(
}

#[utoipa::path(
context_path = "/v1",
params(
("tenant_id" = i64, Path, description = "Id of the tenant"),
),
Expand All @@ -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")
Expand Down

0 comments on commit b585391

Please sign in to comment.