Skip to content

Commit

Permalink
fix: repairs the OpenAPI schema provided by runrs (#30)
Browse files Browse the repository at this point in the history
Previous PR and v0.4.0 breaks the OpenAPI schema provided by runrs. This
is the fix.
  • Loading branch information
cdbrkfxrpt authored Jul 14, 2024
1 parent a81cefc commit 98b7efd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ tracing-subscriber = { version = "0.3.18", features = [
"chrono",
] }
tracing-test = "0.2.4"
utoipa = { version = "4.2.0", features = ["axum_extras", "url"] }
utoipa = { version = "4.2.0", features = ["axum_extras", "url", "uuid"] }
utoipa-swagger-ui = { version = "6.0.0", features = ["axum"] }
uuid = { version = "1.8.0", features = ["v4", "serde"] }

Expand Down
12 changes: 6 additions & 6 deletions src/handlers/gitlab_runners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ pub async fn list(State(AppState { pool, .. }): State<AppState>) -> Result<Respo

#[utoipa::path(
get,
path = "/gitlab-runners/{id}",
path = "/gitlab-runners/{uuid}",
params(
("id" = u32, Path, description = "GitLabRunner ID")
("uuid" = Uuid, Path, description = "GitLabRunner UUID")
),
responses(
(status = StatusCode::OK, description = "Read all GitLabRunners", body = GitLabRunner),
Expand All @@ -95,9 +95,9 @@ pub async fn read(

#[utoipa::path(
put,
path = "/gitlab-runners/{id}",
path = "/gitlab-runners/{uuid}",
params(
("id" = u32, Path, description = "GitLabRunner ID")
("uuid" = Uuid, Path, description = "GitLab Runner UUID")
),
request_body(
content = GitLabRunner, description = "GitLabRunner to update", content_type = "application/json"
Expand Down Expand Up @@ -141,9 +141,9 @@ pub async fn update(

#[utoipa::path(
delete,
path = "/gitlab-runners/{id}",
path = "/gitlab-runners/{uuid}",
params(
("id" = u32, Path, description = "GitLabRunner ID")
("uuid" = Uuid, Path, description = "GitLabRunner UUID")
),
responses(
(status = StatusCode::OK, description = "Deleted GitLabRunner", body = GitLabRunner),
Expand Down
1 change: 1 addition & 0 deletions src/models/gitlab_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ fn default_name() -> String {
pub struct GitLabRunner {
#[sql(pk)]
#[serde(default = "Uuid::new_v4")]
#[schema(value_type = String, format = Uuid, example = "be924fdd-fb28-468c-8c70-1f0ed3af4485")]
uuid: Uuid,
/// ID of the runner within the GitLab instance; unique for that GitLab instance
id: u32,
Expand Down

0 comments on commit 98b7efd

Please sign in to comment.