-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add foundation for API development #1834
Conversation
@@ -58,7 +58,8 @@ | |||
"release-final": "node extra/update-version.js && npm run build-docker && node ./extra/press-any-key.js && npm run upload-artifacts && node ./extra/update-wiki-version.js", | |||
"release-beta": "node extra/beta/update-version.js && npm run build && node ./extra/env2arg.js docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:$VERSION -t louislam/uptime-kuma:beta . --target release --push && node ./extra/press-any-key.js && npm run upload-artifacts", | |||
"git-remove-tag": "git tag -d", | |||
"build-dist-and-restart": "npm run build && npm run start-server-dev" | |||
"build-dist-and-restart": "npm run build && npm run start-server-dev", | |||
"swagger-autogen": "node ./extra/swagger.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add it into build
script
It is probably a good idea to also serve the raw json file as well as the swagger UI. Something like |
@@ -0,0 +1,25 @@ | |||
/* npm run swagger-autogen */ | |||
|
|||
const swaggerAutogen = require("swagger-autogen")(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const swaggerAutogen = require("swagger-autogen")(); | |
const swaggerAutogen = require("swagger-autogen")({openapi: '3.0.0'}); |
Would it be possible to use openapi 3.0.0 instead of swagger 2.0?
}; | ||
|
||
// The working directory is root | ||
const outputFile = "./swagger.json"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const outputFile = "./swagger.json"; | |
const outputFile = "./openapi.json"; |
If 3.0.0 is used, it is suggested by the spec to use openapi.json
as the file name
@@ -50,6 +52,13 @@ class UptimeKumaServer { | |||
log.info("server", "Creating express and socket.io instance"); | |||
this.app = express(); | |||
|
|||
// TODO swaggerDocument.host should be match current base url! | |||
const swaggerDocument = require("../swagger.json"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const swaggerDocument = require("../swagger.json"); | |
const swaggerDocument = require("../openapi.json"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this PR also provide the ability to create new services, or is it just the GET endpoints for now?
As soon as the api is available I plan to start a terraform provider. |
Does this mean Uptime Kuma will have an api to create new monitors? |
@rafaribe: You can follow any GitHub issue by clicking Subscribe button on the right, without notifying anybody about your spam message ;) |
Move to #3854 |
Description
Type of change
Checklist
(including JSDoc for methods)
Screenshots (if any)
Just have a quick test, Swagger Autogen do a great job.