Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion .spectral.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,34 @@ rules:
info-license: hint
license-url: hint
oas3-api-servers: hint
info-contact: hint
info-contact: hint

schema-title:
given: "$.components.schemas[*]"
severity: error
then:
field: title
function: truthy

response-no-inline-schemas:
given: "$.components.responses[*].content.application/json.schema.type"
severity: error
resolved: false
then:
function: pattern
functionOptions:
notMatch: "object"

paths-no-inline-responses:
given: "$.paths[*][get,post,put,delete].responses[*].content.application/json.schema"
severity: error
resolved: false
then:
function: undefined

paths-no-inline-requests:
given: "$.paths[*][get,post,put,delete].requestBody.content.application/json.schema.properties"
severity: error
resolved: false
then:
function: undefined
6 changes: 6 additions & 0 deletions openapi/components/parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,12 @@ notificationId:
required: true
schema:
type: string
permissionId:
name: permissionId
in: path
required: true
schema:
type: string
variant:
name: variant
in: query
Expand Down
117 changes: 8 additions & 109 deletions openapi/components/paths/authentication.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,7 @@ paths:
- authentication
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
ok:
type: boolean
token:
type: string
minLength: 1
required:
- ok
- token
headers: {}
$ref: ../responses/authentication/VerifyAuthTokenResponse.yaml
'401':
$ref: ../responses/MissingCredentialsError.yaml
operationId: verifyAuthToken
Expand All @@ -39,33 +25,7 @@ paths:
operationId: logout
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: ../schemas/Success.yaml
examples:
Logout Success:
value:
success:
message: Ok!
status_code: 200
headers:
Set-Cookie:
schema:
type: string
default: 'auth=; Expires=Tue, 01 Jan 2030 00:00:00 GMT; Path=/'
description: Clears the `auth` cookie.
\0Set-Cookie:
schema:
type: string
default: 'age=; Expires=Tue, 01 Jan 2030 00:00:00 GMT; Path=/'
description: Clears the `age` cookie.
\0\0Set-Cookie:
schema:
type: string
default: 'tos=; Expires=Tue, 01 Jan 2030 00:00:00 GMT; Path=/'
description: Clears the `tos` cookie.
$ref: ../responses/authentication/LogoutSuccess.yaml
'401':
$ref: ../responses/MissingCredentialsError.yaml
description: Invalidates the login session.
Expand All @@ -80,22 +40,7 @@ paths:
- authentication
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: ../schemas/CurrentUser.yaml
headers:
Set-Cookie:
schema:
type: string
example: 'auth=authcookie_00000000-0000-0000-0000-000000000000; Expires=Tue, 01 Jan 2030 00:00:00 GMT; Path=/; HttpOnly'
description: Successful authentication returns an `auth` cookie.
\0Set-Cookie:
schema:
type: string
default: apiKey=JlE5Jldo5Jibnk5O5hTx6XVqsJu4WJ26; Path=/
description: This endpoint **always** sets the `apiKey` irrespective if it is already set.
$ref: ../responses/authentication/CurrentUserLoginResponse.yaml
'401':
$ref: ../responses/MissingCredentialsError.yaml
operationId: getCurrentUser
Expand Down Expand Up @@ -139,34 +84,14 @@ paths:
operationId: verify2FA
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
verified:
type: boolean
required:
- verified
headers:
Set-Cookie:
schema:
type: string
example: 'twoFactorAuth=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx; Expires=Tue, 01 Jan 2030 00:00:00 GMT; Path=/; HttpOnly'
description: 'Provides a `twoFactorAuth` cookie, which can be used to bypasses the 2FA requirement for future logins on the same device.'
$ref: ../responses/authentication/Verify2FAResponse.yaml
'401':
$ref: ../responses/MissingCredentialsError.yaml
requestBody:
content:
application/json:
schema:
type: object
properties:
code:
type: string
required:
- code
$ref: ../requests/TwoFactorAuthCode.yaml
examples: {}
description: Finishes the login sequence with a normal 2FA-generated code for accounts with 2FA-protection enabled.
tags:
Expand All @@ -180,34 +105,14 @@ paths:
operationId: verifyRecoveryCode
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
verified:
type: boolean
required:
- verified
headers:
Set-Cookie:
schema:
type: string
example: 'twoFactorAuth=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx; Expires=Tue, 01 Jan 2030 00:00:00 GMT; Path=/; HttpOnly'
description: 'Provides a `twoFactorAuth` cookie, which can be used to bypasses the 2FA requirement for future logins on the same device.'
$ref: ../responses/authentication/Verify2FAResponse.yaml
'401':
$ref: ../responses/MissingCredentialsError.yaml
requestBody:
content:
application/json:
schema:
type: object
properties:
code:
type: string
required:
- code
$ref: ../requests/TwoFactorAuthCode.yaml
examples: {}
description: Finishes the login sequence with an OTP (One Time Password) recovery code for accounts with 2FA-protection enabled.
tags:
Expand All @@ -222,11 +127,7 @@ paths:
operationId: deleteUser
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: ../schemas/CurrentUser.yaml
$ref: ../responses/authentication/DeleteUserResponse.yaml
'401':
$ref: ../responses/MissingCredentialsError.yaml
tags:
Expand All @@ -243,7 +144,5 @@ paths:
tags:
$ref: ../tags.yaml
components:
parameters:
$ref: ../parameters.yaml
securitySchemes:
$ref: ../securitySchemes.yaml
73 changes: 4 additions & 69 deletions openapi/components/paths/avatars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,41 +88,7 @@ paths:
content:
application/json:
schema:
description: ''
type: object
properties:
assetUrl:
type: string
id:
$ref: ../schemas/AvatarID.yaml
name:
type: string
minLength: 1
description:
type: string
minLength: 1
tags:
type: array
items:
$ref: ../schemas/Tag.yaml
imageUrl:
type: string
minLength: 1
releaseStatus:
$ref: ../schemas/ReleaseStatus.yaml
version:
type: number
minimum: 0
default: 1
featured:
type: boolean
x-internal: true
description: You cannot set featured tag if you are not an admin.
unityPackageUrl:
type: string
required:
- name
- imageUrl
$ref: ../requests/CreateAvatarRequest.yaml
description: Create an avatar. It's possible to optionally specify a ID if you want a custom one. Attempting to create an Avatar with an already claimed ID will result in a DB error.
'/avatars/{avatarId}':
parameters:
Expand Down Expand Up @@ -163,38 +129,7 @@ paths:
content:
application/json:
schema:
description: ''
type: object
properties:
assetUrl:
type: string
id:
$ref: ../schemas/AvatarID.yaml
name:
type: string
minLength: 1
description:
type: string
minLength: 1
tags:
type: array
items:
$ref: ../schemas/Tag.yaml
imageUrl:
type: string
minLength: 1
releaseStatus:
$ref: ../schemas/ReleaseStatus.yaml
version:
type: number
minimum: 0
default: 1
featured:
type: boolean
x-internal: true
description: You cannot set featured tag if you are not an admin.
unityPackageUrl:
type: string
$ref: ../requests/UpdateAvatarRequest.yaml
delete:
summary: Delete Avatar
operationId: deleteAvatar
Expand All @@ -220,7 +155,7 @@ paths:
- avatars
responses:
'200':
$ref: ../responses/CurrentUserResponse.yaml
$ref: ../responses/users/CurrentUserResponse.yaml
'401':
$ref: ../responses/MissingCredentialsError.yaml
'404':
Expand All @@ -239,7 +174,7 @@ paths:
- avatars
responses:
'200':
$ref: ../responses/CurrentUserResponse.yaml
$ref: ../responses/users/CurrentUserResponse.yaml
'401':
$ref: ../responses/MissingCredentialsError.yaml
'403':
Expand Down
29 changes: 2 additions & 27 deletions openapi/components/paths/favorites.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,7 @@ paths:
content:
application/json:
schema:
type: object
properties:
type:
$ref: ../schemas/FavoriteType.yaml
favoriteId:
type: string
description: 'Must be either AvatarID, WorldID or UserID.'
tags:
type: array
description: Tags indicate which group this favorite belongs to. Adding multiple groups makes it show up in all. Removing it from one in that case removes it from all.
items:
$ref: ../schemas/Tag.yaml
required:
- type
- favoriteId
- tags
$ref: ../requests/AddFavoriteRequest.yaml
examples:
Example Favorite Friend:
value:
Expand Down Expand Up @@ -172,17 +157,7 @@ paths:
content:
application/json:
schema:
type: object
properties:
displayName:
type: string
visibility:
$ref: ../schemas/FavoriteGroupVisibility.yaml
tags:
type: array
description: Tags on FavoriteGroups are believed to do nothing.
items:
$ref: ../schemas/Tag.yaml
$ref: ../requests/UpdateFavoriteGroupRequest.yaml
tags:
- favorites
description: Update information about a specific favorite group.
Expand Down
Loading