From 19bfd51fc85c47d1daae94e8de4cb938f652f8cd Mon Sep 17 00:00:00 2001 From: Rexios80 Date: Thu, 22 Jul 2021 14:55:53 -0400 Subject: [PATCH] Feature/worlds (#25) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 5dd09d6abeb96eb88131253404d108e0a51e8dcb. * 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 Co-authored-by: Foorack / Max Faxälv --- openapi.yaml | 142 ++++++++++++++++++ openapi/components/schemas/LimitedWorld.yaml | 72 +++++++++ openapi/components/schemas/ReleaseStatus.yaml | 8 + 3 files changed, 222 insertions(+) create mode 100644 openapi/components/schemas/LimitedWorld.yaml create mode 100644 openapi/components/schemas/ReleaseStatus.yaml diff --git a/openapi.yaml b/openapi.yaml index 3e06f6b7..cdf0885c 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -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 @@ -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 @@ -1470,6 +1611,7 @@ components: tags: - name: authentication - name: users + - name: worlds - name: friends - name: notifications - name: files diff --git a/openapi/components/schemas/LimitedWorld.yaml b/openapi/components/schemas/LimitedWorld.yaml new file mode 100644 index 00000000..e4462887 --- /dev/null +++ b/openapi/components/schemas/LimitedWorld.yaml @@ -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 diff --git a/openapi/components/schemas/ReleaseStatus.yaml b/openapi/components/schemas/ReleaseStatus.yaml new file mode 100644 index 00000000..d7a40303 --- /dev/null +++ b/openapi/components/schemas/ReleaseStatus.yaml @@ -0,0 +1,8 @@ +title: ReleaseStatus +type: string +default: public +enum: + - public + - private + - hidden +example: public