Skip to content

Commit

Permalink
fix(writeapi): tests
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Oct 28, 2020
1 parent ec03af7 commit b092f65
Show file tree
Hide file tree
Showing 17 changed files with 308 additions and 331 deletions.
115 changes: 1 addition & 114 deletions public/openapi/components/schemas/PostsObject.yaml
Expand Up @@ -2,117 +2,4 @@ PostsObject:
description: One of the objects in the array returned from `Posts.getPostSummaryByPids`
type: array
items:
type: object
properties:
pid:
type: number
tid:
type: number
description: A topic identifier
content:
type: string
uid:
type: number
description: A user identifier
timestamp:
type: number
deleted:
type: boolean
upvotes:
type: number
downvotes:
type: number
votes:
type: number
timestampISO:
type: string
description: An ISO 8601 formatted date string (complementing `timestamp`)
user:
type: object
properties:
uid:
type: number
description: A user identifier
username:
type: string
description: A friendly name for a given user account
userslug:
type: string
description: An URL-safe variant of the username (i.e. lower-cased, spaces
removed, etc.)
picture:
type: string
nullable: true
status:
type: string
icon:text:
type: string
description: A single-letter representation of a username. This is used in the
auto-generated icon given to users without
an avatar
icon:bgColor:
type: string
description: A six-character hexadecimal colour code assigned to the user. This
value is used in conjunction with
`icon:text` for the user's auto-generated
icon
example: "#f44336"
topic:
type: object
properties:
uid:
type: number
description: A user identifier
tid:
type: number
description: A topic identifier
title:
type: string
cid:
type: number
description: A category identifier
slug:
type: string
deleted:
type: number
postcount:
type: number
mainPid:
type: number
description: The post id of the first post in this topic (also called the
"original post")
teaserPid:
type: number
description: The post id of the teaser (the most recent post, depending on settings)
nullable: true
titleRaw:
type: string
category:
type: object
properties:
cid:
type: number
description: A category identifier
name:
type: string
icon:
type: string
slug:
type: string
parentCid:
type: number
description: The category identifier for the category that is the immediate
ancestor of the current category
bgColor:
type: string
color:
type: string
backgroundImage:
nullable: true
imageClass:
nullable: true
type: string
isMainPost:
type: boolean
replies:
type: number
$ref: ./PostObject.yaml#/PostObject
35 changes: 0 additions & 35 deletions public/openapi/components/schemas/UserRequest.yaml

This file was deleted.

8 changes: 6 additions & 2 deletions public/openapi/write.yaml
Expand Up @@ -28,6 +28,8 @@ tags:
- name: categories
description: Administrative calls to manage categories
paths:
/users/:
$ref: 'write/users.yaml'
/users/{uid}:
$ref: 'write/users/uid.yaml'
/users/{uid}/settings:
Expand All @@ -40,12 +42,14 @@ paths:
$ref: 'write/users/uid/follow.yaml'
/users/{uid}/ban:
$ref: 'write/users/uid/ban.yaml'
/users/{uid}/tokens:
$ref: 'write/users/uid/tokens.yaml'
/users/{uid}/tokens/{token}:
$ref: 'write/users/uid/tokens/token.yaml'
/categories/:
$ref: 'write/categories.yaml'
/groups/:
$ref: 'write/groups.yaml'
/groups/{slug}:
$ref: 'write/groups/slug.yaml'
/groups/{slug}/membership/{uid}:
$ref: 'write/groups/slug/membership/uid.yaml'
/topics:
Expand Down
21 changes: 10 additions & 11 deletions public/openapi/write/categories.yaml
Expand Up @@ -12,38 +12,37 @@ post:
properties:
name:
type: string
example: My New Category
description:
type: string
example: Lorem ipsum, dolor sit amet
parentCid:
type: number
example: 0
cloneFromCid:
type: number
example: 0
icon:
type: string
example: bullhorn
description: A ForkAwesome icon without the `fa-` prefix
bgColor:
type: string
example: '#ffffff'
color:
type: string
example: '#000000'
link:
type: string
example: 'https://example.org'
class:
type: string
example: 'col-md-3 col-xs-6'
backgroundImage:
type: string
example: '/assets/relative/path/to/image'
required:
- name
example:
name: My New Category
description: Lorem ipsum, dolor sit amet
parentCid: 0
cloneFromCid: 0
icon: bullhorn
bgColor: '#ffffff'
color: '#000000'
link: 'https://example.org'
class: 'col-md-3 col-xs-6'
backgroundImage: '/assets/relative/path/to/image'
responses:
'200':
description: category successfully created
Expand Down
25 changes: 3 additions & 22 deletions public/openapi/write/groups.yaml
Expand Up @@ -12,6 +12,7 @@ post:
properties:
name:
type: string
example: 'My Test Group'
timestamp:
type: number
disableJoinRequests:
Expand All @@ -23,6 +24,7 @@ post:
hidden:
type: number
enum: [0, 1]
example: 1
ownerUid:
type: number
private:
Expand All @@ -37,9 +39,6 @@ post:
type: number
required:
- name
example:
name: 'My Test Group'
hidden: 1
responses:
'200':
description: group successfully created
Expand All @@ -51,22 +50,4 @@ post:
status:
$ref: ../components/schemas/Status.yaml#/Status
response:
$ref: ../components/schemas/GroupObject.yaml#/GroupDataObject
delete:
tags:
- groups
summary: Delete an existing group
description: This operation deletes an existing group, all members within this group will cease to be members after the group is deleted.
responses:
'200':
description: group successfully deleted
content:
application/json:
schema:
type: object
properties:
status:
$ref: ../components/schemas/Status.yaml#/Status
response:
type: object
properties: {}
$ref: ../components/schemas/GroupObject.yaml#/GroupDataObject
42 changes: 41 additions & 1 deletion public/openapi/write/groups/slug/membership/uid.yaml
Expand Up @@ -10,10 +10,50 @@ put:
type: string
required: true
description: slug of the group you would like to join
example: my-group
example: test-group
- in: path
name: uid
schema:
type: number
required: true
description: uid of the user to join the group
example: 1
responses:
'200':
description: group successfully joined, or membership requested
content:
application/json:
schema:
type: object
properties:
status:
$ref: ../../../../components/schemas/Status.yaml#/Status
response:
type: object
properties: {}
delete:
tags:
- groups
summary: leave a group
description: This operation leaves a group.
parameters:
- in: path
name: slug
schema:
type: string
required: true
description: slug of the group you would like to leave
example: test-group
- in: path
name: uid
schema:
type: number
required: true
description: uid of the user to leave the group
example: 1
responses:
'200':
description: group successfully left
content:
application/json:
schema:
Expand Down
7 changes: 3 additions & 4 deletions public/openapi/write/posts/pid.yaml
Expand Up @@ -21,14 +21,13 @@ put:
content:
type: string
description: New post content
example: New post content
title:
type: string
description: Topic title, only accepted for main posts
example: New title
required:
- content
example:
content: 'New post content'
title: 'New title'
responses:
'200':
description: Post successfully edited
Expand All @@ -40,7 +39,7 @@ put:
status:
$ref: ../../components/schemas/Status.yaml#/Status
response:
$ref: ../../components/schemas/PostsObject.yaml#/PostsObject
$ref: ../../components/schemas/PostObject.yaml#/PostObject
delete:
tags:
- posts
Expand Down

0 comments on commit b092f65

Please sign in to comment.