Verified Commit c4777532 authored by Agate's avatar Agate 💬

Bundle swagger docs with sphinx docs

parent d2c2fb83
......@@ -89,3 +89,4 @@ data/
.env
po/*.po
docs/swagger
......@@ -92,12 +92,14 @@ build_front:
pages:
stage: test
image: python:3.6-alpine
image: python:3.6
variables:
BUILD_PATH: "../public"
before_script:
- cd docs
script:
- pip install sphinx
- python -m sphinx . ../public
- ./build_docs.sh
artifacts:
paths:
- public
......
This diff is collapsed.
#!/bin/bash -eux
# Building sphinx and swagger docs
python -m sphinx . $BUILD_PATH
TARGET_PATH="$BUILD_PATH/swagger" ./build_swagger.sh
#!/bin/bash -eux
SWAGGER_VERSION="3.13.6"
TARGET_PATH=${TARGET_PATH-"swagger"}
rm -rf $TARGET_PATH /tmp/swagger-ui
git clone --branch="v$SWAGGER_VERSION" --depth=1 "https://github.com/swagger-api/swagger-ui.git" /tmp/swagger-ui
mv /tmp/swagger-ui/dist $TARGET_PATH
cp swagger.yml $TARGET_PATH
sed -i "s,http://petstore.swagger.io/v2/swagger.json,swagger.yml,g" $TARGET_PATH/index.html
openapi: "3.0"
info:
description: "Documentation for [Funkwhale](https://funkwhale.audio) API. The API is **not** stable yet."
version: "1.0.0"
title: "Funkwhale API"
servers:
- url: https://demo.funkwhale.audio/api/v1
description: Demo server
- url: https://node1.funkwhale.test/api/v1
description: Node 1 (local)
components:
securitySchemes:
jwt:
type: http
scheme: bearer
bearerFormat: JWT
description: "You can get a token by using the /token endpoint"
security:
- jwt: []
paths:
/token/:
post:
tags:
- "auth"
description:
Obtain a JWT token you can use for authenticating your next requests.
security: []
responses:
'200':
description: Successfull auth
'400':
description: Invalid credentials
requestBody:
required: true
content:
application/json:
schema:
type: "object"
properties:
username:
type: "string"
example: "demo"
password:
type: "string"
example: "demo"
/artists/:
get:
tags:
- "artists"
parameters:
- name: "q"
in: "query"
description: "Search query used to filter artists"
schema:
required: false
type: "string"
example: "carpenter"
- name: "listenable"
in: "query"
description: "Filter/exclude artists with listenable tracks"
schema:
required: false
type: "boolean"
responses:
200:
content:
application/json:
schema:
type: "object"
properties:
count:
$ref: "#/properties/resultsCount"
results:
type: "array"
items:
$ref: "#/definitions/ArtistNested"
properties:
resultsCount:
type: "integer"
format: "int64"
description: "The total number of resources matching the request"
mbid:
type: "string"
formats: "uuid"
description: "A musicbrainz ID"
definitions:
Artist:
type: "object"
properties:
mbid:
required: false
$ref: "#/properties/mbid"
id:
type: "integer"
format: "int64"
example: 42
name:
type: "string"
example: "System of a Down"
creation_date:
type: "string"
format: "date-time"
ArtistNested:
type: "object"
allOf:
- $ref: "#/definitions/Artist"
- type: "object"
properties:
albums:
type: "array"
items:
$ref: "#/definitions/AlbumNested"
Album:
type: "object"
properties:
mbid:
required: false
$ref: "#/properties/mbid"
id:
type: "integer"
format: "int64"
example: 16
artist:
type: "integer"
format: "int64"
example: 42
title:
type: "string"
example: "Toxicity"
creation_date:
type: "string"
format: "date-time"
release_date:
type: "string"
required: false
format: "date"
example: "2001-01-01"
AlbumNested:
type: "object"
allOf:
- $ref: "#/definitions/Album"
- type: "object"
properties:
tracks:
type: "array"
items:
$ref: "#/definitions/Track"
Track:
type: "object"
properties:
mbid:
required: false
$ref: "#/properties/mbid"
id:
type: "integer"
format: "int64"
example: 66
artist:
type: "integer"
format: "int64"
example: 42
album:
type: "integer"
format: "int64"
example: 16
title:
type: "string"
example: "Chop Suey!"
position:
required: false
description: "Position of the track in the album"
type: "number"
minimum: 1
example: 1
creation_date:
type: "string"
format: "date-time"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment