Skip to content

Commit

Permalink
gen-openapi moved to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
archeoss committed Nov 9, 2023
1 parent 6657a7a commit 64223d8
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gen-openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: run
args: --bin gen-openapi --features "swagger gen_api" --no-default-features
args: -p utils --bin gen-openapi
- uses: actions/upload-artifact@v3
with:
name: API schemas
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license-file = "./LICENSE"
edition = "2021"

[workspace]
members = [ "cli", "frontend", "backend" ]
members = [ "cli", "frontend", "backend", "utils" ]
default-members = [ "frontend", "backend"]
resolver = "2"

Expand Down
5 changes: 0 additions & 5 deletions backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ edition.workspace = true
readme.workspace = true
repository.workspace = true

[[bin]]
name = "gen-openapi"
path = "gen_openapi.rs"
required-features = [ "swagger", "gen_api" ]

[dependencies]
# Backend (lib.rs)
## Axum related
Expand Down
26 changes: 26 additions & 0 deletions utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "utils"
description = "Bob Management GUI: Utility tools"
publish = false
keywords = [ "BOB", "Management", "GUI" ]
version.workspace = true
authors.workspace = true
license-file.workspace = true
edition.workspace = true
readme.workspace = true
repository.workspace = true

[[bin]]
name = "gen-openapi"
path = "gen_openapi.rs"
required-features = [ "gen_api" ]

[dependencies]
backend = { path = "../backend/", optional = true }

## OpenAPI + Swagger
utoipa = { version = "4.0", features = ["yaml"], optional = true }

[features]
default = [ "gen_api" ]
gen_api = [ "dep:utoipa", "backend/swagger"]
1 change: 0 additions & 1 deletion backend/gen_openapi.rs → utils/gen_openapi.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::fs;
use utoipa::OpenApi;
// in ./src/gen_openapi.rs
fn main() {
let doc = backend::ApiDoc::openapi().to_yaml().unwrap();
let _ = fs::write("./api/openapi.yaml", doc);
Expand Down

0 comments on commit 64223d8

Please sign in to comment.