Added more components and upload endpoint

This commit is contained in:
2022-01-21 17:06:38 +01:00
parent a23773acd4
commit 65bac399f2

View File

@@ -4,7 +4,7 @@ info:
description: TheAdversary api description: TheAdversary api
version: 1.0.0 version: 1.0.0
servers: servers:
- url: 'https://localhost:8080' - url: 'http://localhost:8080'
paths: paths:
/api/recent: /api/recent:
get: get:
@@ -27,7 +27,6 @@ paths:
type: array type: array
items: items:
$ref: '#/components/schemas/ArticleSummary' $ref: '#/components/schemas/ArticleSummary'
/api/search: /api/search:
get: get:
summary: Search all articles summary: Search all articles
@@ -64,14 +63,19 @@ paths:
type: array type: array
items: items:
$ref: '#/components/schemas/ArticleSummary' $ref: '#/components/schemas/ArticleSummary'
components: /api/upload:
schemas: post:
ArticleSummary: summary: "Uploads a new article"
requestBody:
required: true
content:
application/json:
schema:
type: object type: object
properties: properties:
title: title:
type: string type: string
description: Title of the article description: "Name of the article. Must be unique"
summary: summary:
type: string type: string
description: A short overview summary of the article description: A short overview summary of the article
@@ -79,6 +83,88 @@ components:
type: string type: string
description: Link to a preview image description: Link to a preview image
nullable: true nullable: true
tags:
type: array
description: Tags the article should have. If the tag does not exist, a new one is created automatically
items:
$ref: '#/components/schemas/Tag'
security:
- cookie: []
responses:
201:
description: The article was created
401:
description: Not authorized
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
409:
description: A article with the same title already exists
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
components:
schemas:
ApiError:
type: object
properties:
message:
type: string
description: Error message
ArticleSummary:
type: object
properties:
id:
type: number
description: The article id
title:
type: string
description: Title of the article
summary:
type: string
description: A short overview summary of the article
author:
$ref: '#/components/schemas/Author'
image:
type: string
description: Link to a preview image
nullable: true
tags:
type: array
items:
$ref: '#/components/schemas/Tag'
link: link:
type: string type: string
description: Link to the article itself description: Link to the article itself
Author:
type: object
properties:
id:
type: number
description: Id of the author
name:
type: string
description: The author name
information:
type: string
description: Further information about the author
nullable: true
Tag:
type: object
properties:
id:
type: number
description: The tag id
name:
type: string
description: Name of the tag
securitySchemes:
cookie:
type: apiKey
in: cookie
name: session_id