From fecb92e45ef8b617f1e36294f0337e3a5d08a0be Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Mon, 8 Apr 2024 01:42:43 +0200 Subject: [PATCH] add scalar at openapi2.html --- backend/windmill-api/build_openapi.sh | 2 ++ backend/windmill-api/src/lib.rs | 7 ++++++- frontend/static/openapi2.html | 25 +++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 frontend/static/openapi2.html diff --git a/backend/windmill-api/build_openapi.sh b/backend/windmill-api/build_openapi.sh index 9d0bfa712c..8661c9b3e1 100755 --- a/backend/windmill-api/build_openapi.sh +++ b/backend/windmill-api/build_openapi.sh @@ -5,5 +5,7 @@ npx @redocly/openapi-cli@latest bundle openapi.yaml > openapi-bundled.yaml npx @redocly/openapi-cli@latest bundle openapi-bundled.yaml --ext yaml -d > openapi-deref.yaml +npx @redocly/openapi-cli@latest bundle openapi-bundled.yaml --ext json > openapi-deref.json + rm openapi-bundled.yaml diff --git a/backend/windmill-api/src/lib.rs b/backend/windmill-api/src/lib.rs index 2ba6263bf9..29ad935447 100644 --- a/backend/windmill-api/src/lib.rs +++ b/backend/windmill-api/src/lib.rs @@ -279,7 +279,8 @@ pub async fn run_server( .route("/version", get(git_v)) .route("/uptodate", get(is_up_to_date)) .route("/ee_license", get(ee_license)) - .route("/openapi.yaml", get(openapi)), + .route("/openapi.yaml", get(openapi)) + .route("/openapi.json", get(openapi_json)), ) .fallback(static_assets::static_handler) .layer(middleware_stack); @@ -367,6 +368,10 @@ async fn openapi() -> &'static str { include_str!("../openapi-deref.yaml") } +async fn openapi_json() -> &'static str { + include_str!("../openapi-deref.json") +} + pub async fn migrate_db(db: &DB) -> anyhow::Result<()> { db::migrate(db).await?; Ok(()) diff --git a/frontend/static/openapi2.html b/frontend/static/openapi2.html new file mode 100644 index 0000000000..33d6850351 --- /dev/null +++ b/frontend/static/openapi2.html @@ -0,0 +1,25 @@ + + + + API Reference + + + + + + + + + + + + + +