Skip to content

Commit

Permalink
Feature/worlds (#25)
Browse files Browse the repository at this point in the history
* Added worlds endpoint

* Made the generator happy

* Fixed LimitedWorld parameter issues

* Made the linter happy I hope

* Occupants is nullable in the websocket api

* Modified openapi/components/schemas/LimitedWorld.yaml

* Yeah that didn't generate

Revert "Modified openapi/components/schemas/LimitedWorld.yaml"

This reverts commit 5dd09d6.

* Removed format: date from publicationDate since it can be 'none'

* Switched default ReleaseStatus to public

Example of a variable should be what makes somewhat sense in a auto-generated response. `hidden` means it has been deleted, so something most people will never see as a response.

Co-authored-by: Aaron DeLory <[email protected]>
Co-authored-by: Foorack / Max Faxälv <[email protected]>
  • Loading branch information
3 people authored Jul 22, 2021
1 parent be73a84 commit 19bfd51
Show file tree
Hide file tree
Showing 3 changed files with 222 additions and 0 deletions.
142 changes: 142 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,104 @@ paths:
**Has been locked down and now always respond with "Invalid Admin Credentials".**
deprecated: true
/worlds:
get:
summary: Search all worlds
tags:
- worlds
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: ./openapi/components/schemas/LimitedWorld.yaml
'401':
$ref: '#/components/responses/MissingCredentials'
operationId: searchWorlds
security:
- apiKeyCookie: []
authCookie: []
parameters:
- schema:
type: boolean
in: query
required: false
name: featured
description: is the world featured
- $ref: '#/components/parameters/sortOptions'
- schema:
type: string
in: query
required: false
name: user
description: Set to `me` for searching own worlds
- schema:
type: string
in: query
required: false
name: userId
description: Filter by creator id, use `me` for only worlds owned by current user
- $ref: '#/components/parameters/number'
- $ref: '#/components/parameters/orderOptions'
- $ref: '#/components/parameters/offset'
- schema:
type: string
minLength: 0
in: query
required: false
name: search
description: Searches by `name`. Will return empty array if search query is empty or missing.
- schema:
type: array
items:
type: string
in: query
required: false
name: tag
description: Filter by Tag
- schema:
type: array
items:
type: string
in: query
required: false
name: notag
description: Tags to exclude
- $ref: '#/components/parameters/releaseStatus'
- schema:
type: string
in: query
required: false
name: maxUnityVersion
description: Current unity version the game is using
- schema:
type: string
in: query
required: false
name: minUnityVersion
description: The min unity version the world support
- schema:
type: string
in: query
required: false
name: maxAssetVersion
description: Current asset version the game is using
- schema:
type: string
in: query
required: false
name: minAssetVersion
description: The min asset version the world support
- schema:
type: string
in: query
required: false
name: platform
description: The platform the world supports (usually standalonewindows)
description: Search and list any worlds by text query
/health:
get:
summary: Check API Health
Expand Down Expand Up @@ -1433,6 +1531,49 @@ components:
type: integer
minimum: 0
description: A zero-based offset from the default object sorting from where search results start.
sortOptions:
name: sort
in: query
required: false
schema:
title: SortOptions
type: string
default: order
enum:
- popularity
- created
- updated
- order
- _created_at
- _updated_at
example: order
description: How to sort
orderOptions:
name: order
in: query
required: false
schema:
title: OrderOptions
type: string
default: descending
enum:
- ascending
- descending
example: descending
description: Result ordering
# Tried to make this a reference to ./openapi/components/schemas/ReleaseStatus.yaml and the generator was not happy
releaseStatus:
name: releaseStatus
in: query
required: false
schema:
type: string
default: hidden
enum:
- public
- private
- hidden
example: hidden
offline:
name: offline
in: query
Expand Down Expand Up @@ -1470,6 +1611,7 @@ components:
tags:
- name: authentication
- name: users
- name: worlds
- name: friends
- name: notifications
- name: files
Expand Down
72 changes: 72 additions & 0 deletions openapi/components/schemas/LimitedWorld.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
title: LimitedWorld
type: object
properties:
authorId:
$ref: ./UserID.yaml
authorName:
type: string
capacity:
type: number
created_at:
type: string
format: date
favorites:
type: number
heat:
type: number
id:
$ref: ./WorldID.yaml
imageUrl:
type: string
labsPublicationDate:
type: string
# This is a date string unless there is no date, then it's 'none'
# oneOf: date, string did not generate
# format: date
name:
type: string
occupants:
type: number
organization:
type: string
popularity:
type: number
publicationDate:
type: string
# This is a date string unless there is no date, then it's 'none'
# oneOf: date, string did not generate
# format: date
releaseStatus:
$ref: ./ReleaseStatus.yaml
tags:
type: array
items:
$ref: ./Tag.yaml
thumbnailImageUrl:
type: string
# TODO
unityPackages:
type: array
items:
type: object
updated_at:
type: string
format: date
required:
- authorId
- authorName
- capacity
- createdAt
- favorites
- heat
- id
- imageUrl
- name
- organization
- popularity
- publicationDate
- releaseStatus
- tags
- thumbnailImageUrl
- unityPackages
- updatedAt
8 changes: 8 additions & 0 deletions openapi/components/schemas/ReleaseStatus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
title: ReleaseStatus
type: string
default: public
enum:
- public
- private
- hidden
example: public

0 comments on commit 19bfd51

Please sign in to comment.