Skip to content

Commit

Permalink
refactor: remove body from multiple article endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
geromegrignon committed Aug 22, 2024
1 parent ce06f32 commit dedb696
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 29 deletions.
12 changes: 0 additions & 12 deletions api/Conduit.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@
"",
" tests['Article has \"title\" property'] = article.hasOwnProperty('title');",
" tests['Article has \"slug\" property'] = article.hasOwnProperty('slug');",
" tests['Article has \"body\" property'] = article.hasOwnProperty('body');",
" tests['Article has \"createdAt\" property'] = article.hasOwnProperty('createdAt');",
" tests['Article\\'s \"createdAt\" property is an ISO 8601 timestamp'] = /^\\d{4,}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d.\\d+(?:[+-][0-2]\\d:[0-5]\\d|Z)$/.test(article.createdAt);",
" tests['Article has \"updatedAt\" property'] = article.hasOwnProperty('updatedAt');",
Expand Down Expand Up @@ -364,7 +363,6 @@
"",
" tests['Article has \"title\" property'] = article.hasOwnProperty('title');",
" tests['Article has \"slug\" property'] = article.hasOwnProperty('slug');",
" tests['Article has \"body\" property'] = article.hasOwnProperty('body');",
" tests['Article has \"createdAt\" property'] = article.hasOwnProperty('createdAt');",
" tests['Article\\'s \"createdAt\" property is an ISO 8601 timestamp'] = /^\\d{4,}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d.\\d+(?:[+-][0-2]\\d:[0-5]\\d|Z)$/.test(article.createdAt);",
" tests['Article has \"updatedAt\" property'] = article.hasOwnProperty('updatedAt');",
Expand Down Expand Up @@ -439,7 +437,6 @@
"",
" tests['Article has \"title\" property'] = article.hasOwnProperty('title');",
" tests['Article has \"slug\" property'] = article.hasOwnProperty('slug');",
" tests['Article has \"body\" property'] = article.hasOwnProperty('body');",
" tests['Article has \"createdAt\" property'] = article.hasOwnProperty('createdAt');",
" tests['Article\\'s \"createdAt\" property is an ISO 8601 timestamp'] = /^\\d{4,}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d.\\d+(?:[+-][0-2]\\d:[0-5]\\d|Z)$/.test(article.createdAt);",
" tests['Article has \"updatedAt\" property'] = article.hasOwnProperty('updatedAt');",
Expand Down Expand Up @@ -514,7 +511,6 @@
"",
" tests['Article has \"title\" property'] = article.hasOwnProperty('title');",
" tests['Article has \"slug\" property'] = article.hasOwnProperty('slug');",
" tests['Article has \"body\" property'] = article.hasOwnProperty('body');",
" tests['Article has \"createdAt\" property'] = article.hasOwnProperty('createdAt');",
" tests['Article\\'s \"createdAt\" property is an ISO 8601 timestamp'] = /^\\d{4,}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d.\\d+(?:[+-][0-2]\\d:[0-5]\\d|Z)$/.test(article.createdAt);",
" tests['Article has \"updatedAt\" property'] = article.hasOwnProperty('updatedAt');",
Expand Down Expand Up @@ -658,7 +654,6 @@
"",
" tests['Article has \"title\" property'] = article.hasOwnProperty('title');",
" tests['Article has \"slug\" property'] = article.hasOwnProperty('slug');",
" tests['Article has \"body\" property'] = article.hasOwnProperty('body');",
" tests['Article has \"createdAt\" property'] = article.hasOwnProperty('createdAt');",
" tests['Article\\'s \"createdAt\" property is an ISO 8601 timestamp'] = /^\\d{4,}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d.\\d+(?:[+-][0-2]\\d:[0-5]\\d|Z)$/.test(article.createdAt);",
" tests['Article has \"updatedAt\" property'] = article.hasOwnProperty('updatedAt');",
Expand Down Expand Up @@ -731,7 +726,6 @@
"",
" tests['Article has \"title\" property'] = article.hasOwnProperty('title');",
" tests['Article has \"slug\" property'] = article.hasOwnProperty('slug');",
" tests['Article has \"body\" property'] = article.hasOwnProperty('body');",
" tests['Article has \"createdAt\" property'] = article.hasOwnProperty('createdAt');",
" tests['Article\\'s \"createdAt\" property is an ISO 8601 timestamp'] = /^\\d{4,}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d.\\d+(?:[+-][0-2]\\d:[0-5]\\d|Z)$/.test(article.createdAt);",
" tests['Article has \"updatedAt\" property'] = article.hasOwnProperty('updatedAt');",
Expand Down Expand Up @@ -804,7 +798,6 @@
"",
" tests['Article has \"title\" property'] = article.hasOwnProperty('title');",
" tests['Article has \"slug\" property'] = article.hasOwnProperty('slug');",
" tests['Article has \"body\" property'] = article.hasOwnProperty('body');",
" tests['Article has \"createdAt\" property'] = article.hasOwnProperty('createdAt');",
" tests['Article\\'s \"createdAt\" property is an ISO 8601 timestamp'] = /^\\d{4,}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d.\\d+(?:[+-][0-2]\\d:[0-5]\\d|Z)$/.test(article.createdAt);",
" tests['Article has \"updatedAt\" property'] = article.hasOwnProperty('updatedAt');",
Expand Down Expand Up @@ -877,7 +870,6 @@
"",
" tests['Article has \"title\" property'] = article.hasOwnProperty('title');",
" tests['Article has \"slug\" property'] = article.hasOwnProperty('slug');",
" tests['Article has \"body\" property'] = article.hasOwnProperty('body');",
" tests['Article has \"createdAt\" property'] = article.hasOwnProperty('createdAt');",
" tests['Article\\'s \"createdAt\" property is an ISO 8601 timestamp'] = /^\\d{4,}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d.\\d+(?:[+-][0-2]\\d:[0-5]\\d|Z)$/.test(article.createdAt);",
" tests['Article has \"updatedAt\" property'] = article.hasOwnProperty('updatedAt');",
Expand Down Expand Up @@ -956,7 +948,6 @@
"",
" tests['Article has \"title\" property'] = article.hasOwnProperty('title');",
" tests['Article has \"slug\" property'] = article.hasOwnProperty('slug');",
" tests['Article has \"body\" property'] = article.hasOwnProperty('body');",
" tests['Article has \"createdAt\" property'] = article.hasOwnProperty('createdAt');",
" tests['Article\\'s \"createdAt\" property is an ISO 8601 timestamp'] = /^\\d{4,}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d.\\d+(?:[+-][0-2]\\d:[0-5]\\d|Z)$/.test(article.createdAt);",
" tests['Article has \"updatedAt\" property'] = article.hasOwnProperty('updatedAt');",
Expand Down Expand Up @@ -1093,7 +1084,6 @@
" tests['An article was returned'] = article !== undefined;",
" tests['Article has \"title\" property'] = article.hasOwnProperty('title');",
" tests['Article has \"slug\" property'] = article.hasOwnProperty('slug');",
" tests['Article has \"body\" property'] = article.hasOwnProperty('body');",
" tests['Article has \"createdAt\" property'] = article.hasOwnProperty('createdAt');",
" tests['Article\\'s \"createdAt\" property is an ISO 8601 timestamp'] = /^\\d{4,}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d.\\d+(?:[+-][0-2]\\d:[0-5]\\d|Z)$/.test(article.createdAt);",
" tests['Article has \"updatedAt\" property'] = article.hasOwnProperty('updatedAt');",
Expand Down Expand Up @@ -1293,7 +1283,6 @@
" tests['articlesCount is an integer'] = Number.isInteger(responseJSON.articlesCount);",
" tests['Article has \"title\" property'] = article.hasOwnProperty('title');",
" tests['Article has \"slug\" property'] = article.hasOwnProperty('slug');",
" tests['Article has \"body\" property'] = article.hasOwnProperty('body');",
" tests['Article has \"createdAt\" property'] = article.hasOwnProperty('createdAt');",
" tests['Article\\'s \"createdAt\" property is an ISO 8601 timestamp'] = /^\\d{4,}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d.\\d+(?:[+-][0-2]\\d:[0-5]\\d|Z)$/.test(article.createdAt);",
" tests['Article has \"updatedAt\" property'] = article.hasOwnProperty('updatedAt');",
Expand Down Expand Up @@ -1365,7 +1354,6 @@
" tests['articlesCount is an integer'] = Number.isInteger(responseJSON.articlesCount);",
" tests['Article has \"title\" property'] = article.hasOwnProperty('title');",
" tests['Article has \"slug\" property'] = article.hasOwnProperty('slug');",
" tests['Article has \"body\" property'] = article.hasOwnProperty('body');",
" tests['Article has \"createdAt\" property'] = article.hasOwnProperty('createdAt');",
" tests['Article\\'s \"createdAt\" property is an ISO 8601 timestamp'] = /^\\d{4,}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d.\\d+(?:[+-][0-2]\\d:[0-5]\\d|Z)$/.test(article.createdAt);",
" tests['Article has \"updatedAt\" property'] = article.hasOwnProperty('updatedAt');",
Expand Down
63 changes: 48 additions & 15 deletions api/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ paths:
'422':
$ref: '#/components/responses/GenericError'
security:
- Token: []
- Token: [ ]
put:
tags:
- User and Authentication
Expand All @@ -82,7 +82,7 @@ paths:
'422':
$ref: '#/components/responses/GenericError'
security:
- Token: []
- Token: [ ]
x-codegen-request-body-name: body
/profiles/{username}:
get:
Expand Down Expand Up @@ -127,7 +127,7 @@ paths:
'422':
$ref: '#/components/responses/GenericError'
security:
- Token: []
- Token: [ ]
delete:
tags:
- Profile
Expand All @@ -149,7 +149,7 @@ paths:
'422':
$ref: '#/components/responses/GenericError'
security:
- Token: []
- Token: [ ]
/articles/feed:
get:
tags:
Expand All @@ -169,7 +169,7 @@ paths:
'422':
$ref: '#/components/responses/GenericError'
security:
- Token: []
- Token: [ ]
/articles:
get:
tags:
Expand Down Expand Up @@ -219,7 +219,7 @@ paths:
'422':
$ref: '#/components/responses/GenericError'
security:
- Token: []
- Token: [ ]
x-codegen-request-body-name: article
/articles/{slug}:
get:
Expand Down Expand Up @@ -263,7 +263,7 @@ paths:
'422':
$ref: '#/components/responses/GenericError'
security:
- Token: []
- Token: [ ]
x-codegen-request-body-name: article
delete:
tags:
Expand All @@ -286,7 +286,7 @@ paths:
'422':
$ref: '#/components/responses/GenericError'
security:
- Token: []
- Token: [ ]
/articles/{slug}/comments:
get:
tags:
Expand Down Expand Up @@ -331,7 +331,7 @@ paths:
'422':
$ref: '#/components/responses/GenericError'
security:
- Token: []
- Token: [ ]
x-codegen-request-body-name: comment
/articles/{slug}/comments/{id}:
delete:
Expand Down Expand Up @@ -361,7 +361,7 @@ paths:
'422':
$ref: '#/components/responses/GenericError'
security:
- Token: []
- Token: [ ]
/articles/{slug}/favorite:
post:
tags:
Expand All @@ -384,7 +384,7 @@ paths:
'422':
$ref: '#/components/responses/GenericError'
security:
- Token: []
- Token: [ ]
delete:
tags:
- Favorites
Expand All @@ -406,7 +406,7 @@ paths:
'422':
$ref: '#/components/responses/GenericError'
security:
- Token: []
- Token: [ ]
/tags:
get:
tags:
Expand Down Expand Up @@ -662,7 +662,40 @@ components:
articles:
type: array
items:
$ref: '#/components/schemas/Article'
required:
- author
- createdAt
- description
- favorited
- favoritesCount
- slug
- tagList
- title
- updatedAt
type: object
properties:
slug:
type: string
title:
type: string
description:
type: string
tagList:
type: array
items:
type: string
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
favorited:
type: boolean
favoritesCount:
type: integer
author:
$ref: '#/components/schemas/Profile'
articlesCount:
type: integer
ProfileResponse:
Expand All @@ -689,10 +722,10 @@ components:
$ref: '#/components/schemas/User'
EmptyOkResponse:
description: No content
content: {}
content: { }
Unauthorized:
description: Unauthorized
content: {}
content: { }
GenericError:
description: Unexpected error
content:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,19 @@ Make sure the right content type like `Content-Type: application/json; charset=u

### Multiple Articles

:::caution
Starting from the 2024/08/16, the endpoints retrieving a list of articles do no longer return the body of an article for performance reasons.
It affcts:
- `GET /api/articles`
- `GET /api/articles/feed`
:::

```JSON
{
"articles":[{
"slug": "how-to-train-your-dragon",
"title": "How to train your dragon",
"description": "Ever wonder how?",
"body": "It takes a Jacobian",
"tagList": ["dragons", "training"],
"createdAt": "2016-02-18T03:22:56.637Z",
"updatedAt": "2016-02-18T03:48:35.824Z",
Expand All @@ -81,7 +87,6 @@ Make sure the right content type like `Content-Type: application/json; charset=u
"slug": "how-to-train-your-dragon-2",
"title": "How to train your dragon 2",
"description": "So toothless",
"body": "It a dragon",
"tagList": ["dragons", "training"],
"createdAt": "2016-02-18T03:22:56.637Z",
"updatedAt": "2016-02-18T03:48:35.824Z",
Expand Down

0 comments on commit dedb696

Please sign in to comment.