feature #11: describe "create/delete follow to article" in openAPI

This commit is contained in:
2019-08-30 10:07:47 +02:00
parent 2f079d9d9d
commit fffecd5072
4 changed files with 37 additions and 4 deletions

View File

@@ -24,7 +24,6 @@ object ArticlesPaths {
val limit: Int = if (limit > 50) 50 else if (limit < 1) 1 else limit
}
@Location("/articles/{article}") class ArticleRequest(val article: ArticleEntity)
@Location("/articles/{article}/follow") class ArticleFollowRequest(val article: ArticleEntity)
@Location("/articles") class PostArticleRequest
}

View File

@@ -13,7 +13,7 @@ import fr.dcproject.repository.FollowArticle as FollowArticleRepository
@KtorExperimentalLocationsAPI
object FollowArticlePaths {
@Location("/articles/{article}/follow") class ArticleFollowRequest(val article: ArticleEntity)
@Location("/articles/{article}/follows") class ArticleFollowRequest(val article: ArticleEntity)
@Location("/citizens/{citizen}/follows/articles") class CitizenFollowArticleRequest(val citizen: Citizen)
}

View File

@@ -323,6 +323,34 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/CommentResponse'
/articles/{article}/follows:
parameters:
- name: article
in: path
description: The ID of article
example: e74be8e4-6823-47c4-bd1b-789725b2fa8e
required: true
schema:
type: string
format: uuid
post:
security:
- JWTAuth: []
summary: Follow one article
tags:
- follow
responses:
201:
description: Return only http status 201 on success
delete:
security:
- JWTAuth: []
summary: Unfollow one article
tags:
- follow
responses:
204:
description: Return only http status 204 on success
components:
@@ -661,6 +689,12 @@ components:
- $ref: '#/components/schemas/UUID'
- $ref: '#/components/schemas/UUID'
FollowBase:
allOf:
- $ref: '#/components/schemas/Extra'
FollowResponse:
allOf:
- $ref: '#/components/schemas/FollowBase'
requestBodies: