1
0

API Docs improvements (#46)

This commit is contained in:
konrad
2019-01-03 22:22:06 +00:00
committed by Gitea
parent 3183d10dbe
commit 607dbd6ae8
100 changed files with 1306 additions and 9201 deletions

176
pkg/routes/api/v1/docs.go Normal file

File diff suppressed because one or more lines are too long

View File

@ -31,7 +31,7 @@ import (
// @Accept json
// @Produce json
// @Param id path int true "Namespace ID"
// @Security ApiKeyAuth
// @Security JWTKeyAuth
// @Success 200 {array} models.List "The lists."
// @Failure 403 {object} models.Message "No access to that namespace."
// @Failure 404 {object} models.Message "The namespace does not exist."

View File

@ -30,7 +30,7 @@ import (
// @Accept json
// @Produce json
// @Param s query string false "Search for a user by its name."
// @Security ApiKeyAuth
// @Security JWTKeyAuth
// @Success 200 {array} models.User "All (found) users."
// @Failure 400 {object} code.vikunja.io/web.HTTPError "Something's invalid."
// @Failure 500 {object} models.Message "Internal server error."

View File

@ -29,7 +29,7 @@ import (
// @tags user
// @Accept json
// @Produce json
// @Security ApiKeyAuth
// @Security JWTKeyAuth
// @Success 200 {object} models.User
// @Failure 404 {object} code.vikunja.io/web.HTTPError "User does not exist."
// @Failure 500 {object} models.Message "Internal server error."

View File

@ -36,7 +36,7 @@ type UserPassword struct {
// @Accept json
// @Produce json
// @Param userPassword body v1.UserPassword true "The current and new password."
// @Security ApiKeyAuth
// @Security JWTKeyAuth
// @Success 200 {object} models.Message
// @Failure 400 {object} code.vikunja.io/web.HTTPError "Something's invalid."
// @Failure 404 {object} code.vikunja.io/web.HTTPError "User does not exist."

View File

@ -15,12 +15,24 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// @title Vikunja API
// @license.name GPLv3
// @description This is the documentation for the [Vikunja](http://vikunja.io) API. Vikunja is a cross-plattform Todo-application with a lot of features, such as sharing lists with users or teams. <!-- ReDoc-Inject: <security-definitions> -->
// @description # Authorization
// @description **JWT-Auth:** Main authorization method, used for most of the requests. Needs ` + "`" + `Authorization: Bearer <jwt-token>` + "`" + `-header to authenticate successfully.
// @description
// @description **BasicAuth:** Only used when requesting tasks via caldav.
// @description <!-- ReDoc-Inject: <security-definitions> -->
// @BasePath /api/v1
// @license.url http://code.vikunja.io/api/src/branch/master/LICENSE
// @license.name GPLv3
// @contact.url http://vikunja.io/en/contact/
// @contact.name General Vikunja contact
// @contact.email hello@vikunja.io
// @securityDefinitions.basic BasicAuth
// @securityDefinitions.apikey ApiKeyAuth
// @securityDefinitions.apikey JWTKeyAuth
// @in header
// @name Authorization
@ -39,7 +51,6 @@ import (
"github.com/labstack/echo/middleware"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/spf13/viper"
"github.com/swaggo/echo-swagger"
)
// CustomValidator is a dummy struct to use govalidator with echo
@ -95,8 +106,9 @@ func RegisterRoutes(e *echo.Echo) {
// API Routes
a := e.Group("/api/v1")
// Swagger UI
a.GET("/swagger/*", echoSwagger.WrapHandler)
// Docs
a.GET("/docs.json", apiv1.DocsJSON)
a.GET("/docs", apiv1.RedocUI)
// Prometheus endpoint
if viper.GetBool("service.enablemetrics") {