From 53253f62d52daec635ddaac7b591608f4f6acf10 Mon Sep 17 00:00:00 2001 From: Sadayuki Furuhashi Date: Mon, 23 Dec 2019 14:39:05 -0800 Subject: [PATCH 1/2] Serve REST API document as a static HTML at docs.digdag.io/api/ digdag-docs/src/api/index.html file uses RapiDoc (MIT License) hosted at unpkg.com. Sphinx config is changed to serve static files at /api. Also update URL in documents from swagger.digdag.io (deprecated) to the new URL. --- README.md | 4 +- build.gradle | 2 +- digdag-docs/src/api/index.html | 48 +++++++++++++++++++ digdag-docs/src/{_static => api}/swagger.yaml | 0 digdag-docs/src/conf.py | 2 +- digdag-docs/src/rest_api.rst | 2 +- 6 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 digdag-docs/src/api/index.html rename digdag-docs/src/{_static => api}/swagger.yaml (100%) diff --git a/README.md b/README.md index 7b17e6747a..40beea84a8 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Please check [digdag.io](https://digdag.io) and [docs.digdag.io](https://docs.digdag.io) for installation & user manual. -REST API document is available at [swagger.digdag.io](http://swagger.digdag.io/). +REST API document is available at [docs.digdag.io/api](http://docs.digdag.io/api/). ## Development @@ -133,7 +133,7 @@ $ npm run dev # starts dev server on http://localhost:9000/ ### Updating REST API document -Run this command to update REST API document at digdag-docs/src/_static/swagger.yaml. +Run this command to update REST API document file at digdag-docs/src/api/swagger.yaml. ``` ./gradlew swaggerYaml # dump swagger.yaml file diff --git a/build.gradle b/build.gradle index 0967c77977..cb1ab17186 100644 --- a/build.gradle +++ b/build.gradle @@ -413,7 +413,7 @@ task swaggerYaml(dependsOn: ':digdag-cli:shadowJar') { file("config/dummy.properties").write("") Process server = ["java", "-jar", "digdag-cli/build/libs/digdag-cli-${project.version}-all.jar", "server", "-c", "config/dummy.properties", "--memory", "--enable-swagger"].execute() sleep(5 * 1000) - ["curl", "http://127.0.0.1:65432/api/swagger.yaml", "-o", "digdag-docs/src/_static/swagger.yaml"].execute().waitFor() + ["curl", "http://127.0.0.1:65432/api/swagger.yaml", "-o", "digdag-docs/src/api/swagger.yaml"].execute().waitFor() server.destroy() server.waitForOrKill(1000) } diff --git a/digdag-docs/src/api/index.html b/digdag-docs/src/api/index.html new file mode 100644 index 0000000000..a44251479b --- /dev/null +++ b/digdag-docs/src/api/index.html @@ -0,0 +1,48 @@ + + + + + + + + +
+ Digdag logo +
+
+ + + + diff --git a/digdag-docs/src/_static/swagger.yaml b/digdag-docs/src/api/swagger.yaml similarity index 100% rename from digdag-docs/src/_static/swagger.yaml rename to digdag-docs/src/api/swagger.yaml diff --git a/digdag-docs/src/conf.py b/digdag-docs/src/conf.py index d51de10351..9071281b7f 100644 --- a/digdag-docs/src/conf.py +++ b/digdag-docs/src/conf.py @@ -63,7 +63,7 @@ def setup(app): # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ['_static', 'api'] html_context = { 'extra_css_files': ['_static/custom.css'] diff --git a/digdag-docs/src/rest_api.rst b/digdag-docs/src/rest_api.rst index 4d930a52c9..36ddb89f9c 100644 --- a/digdag-docs/src/rest_api.rst +++ b/digdag-docs/src/rest_api.rst @@ -1,5 +1,5 @@ REST API ================================== -Open API document is available at `swagger.digdag.io `_. +Open API document is available at `docs.digdag.io/api `_. From 1c6d71578a89af188e6ead787864c3b774e2534a Mon Sep 17 00:00:00 2001 From: Sadayuki Furuhashi Date: Mon, 23 Dec 2019 19:43:40 -0800 Subject: [PATCH 2/2] fixed paths --- build.gradle | 2 +- digdag-docs/src/{ => _extra}/api/index.html | 2 +- digdag-docs/src/{ => _extra}/api/swagger.yaml | 0 digdag-docs/src/conf.py | 3 ++- 4 files changed, 4 insertions(+), 3 deletions(-) rename digdag-docs/src/{ => _extra}/api/index.html (98%) rename digdag-docs/src/{ => _extra}/api/swagger.yaml (100%) diff --git a/build.gradle b/build.gradle index cb1ab17186..eb0f01c0e0 100644 --- a/build.gradle +++ b/build.gradle @@ -413,7 +413,7 @@ task swaggerYaml(dependsOn: ':digdag-cli:shadowJar') { file("config/dummy.properties").write("") Process server = ["java", "-jar", "digdag-cli/build/libs/digdag-cli-${project.version}-all.jar", "server", "-c", "config/dummy.properties", "--memory", "--enable-swagger"].execute() sleep(5 * 1000) - ["curl", "http://127.0.0.1:65432/api/swagger.yaml", "-o", "digdag-docs/src/api/swagger.yaml"].execute().waitFor() + ["curl", "http://127.0.0.1:65432/api/swagger.yaml", "-o", "digdag-docs/src/_extra/api/swagger.yaml"].execute().waitFor() server.destroy() server.waitForOrKill(1000) } diff --git a/digdag-docs/src/api/index.html b/digdag-docs/src/_extra/api/index.html similarity index 98% rename from digdag-docs/src/api/index.html rename to digdag-docs/src/_extra/api/index.html index a44251479b..6075dbdbf3 100644 --- a/digdag-docs/src/api/index.html +++ b/digdag-docs/src/_extra/api/index.html @@ -7,7 +7,7 @@