Added more components and upload endpoint
This commit is contained in:
90
api.yaml
90
api.yaml
@@ -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,21 +63,108 @@ paths:
|
|||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/ArticleSummary'
|
$ref: '#/components/schemas/ArticleSummary'
|
||||||
|
/api/upload:
|
||||||
|
post:
|
||||||
|
summary: "Uploads a new article"
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
title:
|
||||||
|
type: string
|
||||||
|
description: "Name of the article. Must be unique"
|
||||||
|
summary:
|
||||||
|
type: string
|
||||||
|
description: A short overview summary of the article
|
||||||
|
image:
|
||||||
|
type: string
|
||||||
|
description: Link to a preview image
|
||||||
|
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:
|
components:
|
||||||
schemas:
|
schemas:
|
||||||
|
ApiError:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
description: Error message
|
||||||
ArticleSummary:
|
ArticleSummary:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
id:
|
||||||
|
type: number
|
||||||
|
description: The article id
|
||||||
title:
|
title:
|
||||||
type: string
|
type: string
|
||||||
description: Title of the article
|
description: Title of the article
|
||||||
summary:
|
summary:
|
||||||
type: string
|
type: string
|
||||||
description: A short overview summary of the article
|
description: A short overview summary of the article
|
||||||
|
author:
|
||||||
|
$ref: '#/components/schemas/Author'
|
||||||
image:
|
image:
|
||||||
type: string
|
type: string
|
||||||
description: Link to a preview image
|
description: Link to a preview image
|
||||||
nullable: true
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user