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
|
||||
version: 1.0.0
|
||||
servers:
|
||||
- url: 'https://localhost:8080'
|
||||
- url: 'http://localhost:8080'
|
||||
paths:
|
||||
/api/recent:
|
||||
get:
|
||||
@@ -27,7 +27,6 @@ paths:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/ArticleSummary'
|
||||
|
||||
/api/search:
|
||||
get:
|
||||
summary: Search all articles
|
||||
@@ -64,21 +63,108 @@ paths:
|
||||
type: array
|
||||
items:
|
||||
$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:
|
||||
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:
|
||||
type: string
|
||||
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