add swagger reference
This commit is contained in:
parent
45c47d9b0c
commit
9463b24a4d
|
@ -0,0 +1,48 @@
|
|||
openapi: 3.0.3
|
||||
info:
|
||||
title: ResourceD API
|
||||
description: |-
|
||||
This is the ResourceD API docs.
|
||||
license:
|
||||
name: GPLv3
|
||||
url: https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
version: "1.0"
|
||||
servers:
|
||||
- url: http://localhost/resource
|
||||
tags:
|
||||
- name: Data API
|
||||
description: API for serving data
|
||||
- name: System API
|
||||
description: API for serving system data
|
||||
|
||||
paths:
|
||||
/{id}:
|
||||
get:
|
||||
description: Get a resource
|
||||
summary: Get a resource. Send browser requests to this URL
|
||||
tags:
|
||||
- Data API
|
||||
responses:
|
||||
200:
|
||||
description: Returns a resource in its binary data
|
||||
302:
|
||||
description: Resource is an external (http) link and the redirect is being forwarded to that link
|
||||
404:
|
||||
description: Not found
|
||||
500:
|
||||
description: Internal error
|
||||
/info/is_enabled:
|
||||
get:
|
||||
description: Check if resourceD is enabled
|
||||
summary: Check if resourceD is enabled
|
||||
tags:
|
||||
- System API
|
||||
responses:
|
||||
200:
|
||||
description: Ok
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: boolean
|
||||
example: true
|
||||
|
|
@ -119,7 +119,8 @@ func main() {
|
|||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
// we failed, send a redirect instead
|
||||
// (next executed line would be 115)
|
||||
// the next line would be the one with
|
||||
// c.Location(res.Url)
|
||||
} else {
|
||||
c.Response().Header.SetContentType(res.Mime)
|
||||
c.Response().Header.SetContentLength(len(data))
|
||||
|
|
Loading…
Reference in New Issue