Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

organize contents by resource #3

Merged
merged 1 commit into from
Jul 1, 2020
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
9 changes: 5 additions & 4 deletions .spectral.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ extends: [[spectral:oas, all]]
rules:
contact-properties: off
operation-default-response: off
operation-singular-tag: off

ratelimit-headers:
description: Response must include ratelimit-x headers
Expand Down Expand Up @@ -29,22 +30,22 @@ rules:
minItems: 1

endpoint-must-be-ref:
description: Endpoint must a $ref
description: Endpoint must be a $ref
message: "{{description}}; {{property}} incorrect"
severity: error
resolved: false
given: $.paths.*
given: $.paths.*.*
hilary marked this conversation as resolved.
Show resolved Hide resolved
then:
- field: $ref
function: truthy

endpoint-ref-must-be-file:
description: Endpoint must a $ref to a file in endpoints/
description: Endpoint must a $ref to a file in resources/
message: "{{description}}; {{value}} incorrect"
severity: error
resolved: false
given: $.paths.*.$ref
then:
function: pattern
functionOptions:
match: "^endpoints\/.*yml$"
match: "^resources\/.*yml$"
hilary marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 4 additions & 2 deletions DigitalOcean-public.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ tags:
description: Manage SSH keys available on your account.
paths:
/account:
$ref: 'endpoints/account.yml'
get:
$ref: 'resources/account/get_user_information.yml'
/account/keys:
$ref: 'endpoints/ssh_keys.yml'
get:
$ref: 'resources/ssh_keys/list_all_keys.yml'
components:
securitySchemes:
bearerAuth:
Expand Down
112 changes: 0 additions & 112 deletions components/schemas.yml

This file was deleted.

19 changes: 0 additions & 19 deletions endpoints/account.yml

This file was deleted.

82 changes: 0 additions & 82 deletions endpoints/ssh_keys.yml

This file was deleted.

52 changes: 52 additions & 0 deletions resources/account/account.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
type: object

properties:
droplet_limit:
description: The total number of Droplets current user or team may have active at one time.
type: integer
example: 25

floating_ip_limit:
description: The total number of Floating IPs the current user or team may have.
type: integer
example: 5

email:
description: The email address used by the current user to register for DigitalOcean.
type: string
example: sammy@digitalocean.com

uuid:
description: The unique universal identifier for the current user.
type: string
example: b6fr89dbf6d9156cace5f3c78dc9851d957381ef

email_verified:
description: If true, the user has verified their account via email. False otherwise.
type: boolean
default: false
example: true

status:
description: This value is one of "active", "warning" or "locked".
type: string
enum:
- active
- warning
- locked
default: active
example: active

status_message:
description: A human-readable message giving more details about the status of the account.
type: string
example: ""

required:
- droplet_limit
- floating_ip_limit
- email
- uuid
- email_verified
- status
- status_message
25 changes: 25 additions & 0 deletions resources/account/get_user_information.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
operationId: get_user_information

summary: Show information about my account.

description: To show information about the current user account, send a GET request to /account.

tags:
- Account

responses:
'200':
description: A JSON object keyed on account with an exerpt of the current user account data.

headers:
ratelimit-limit:
$ref: '../../shared/headers.yml#/ratelimit-limit'
ratelimit-remaining:
$ref: '../../shared/headers.yml#/ratelimit-remaining'
ratelimit-reset:
$ref: '../../shared/headers.yml#/ratelimit-reset'

content:
application/json:
schema:
$ref: 'wrapped_account.yml'
hilary marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 8 additions & 0 deletions resources/account/wrapped_account.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type: object

properties:
account:
$ref: 'account.yml'

required:
- account
hilary marked this conversation as resolved.
Show resolved Hide resolved
20 changes: 20 additions & 0 deletions resources/ssh_keys/list_all_keys.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
operationId: list_all_keys

summary: List all ssh keys in your account.

description: >-
To list all of the keys in your account, send a GET request to /v2/account/keys.
The response will be a JSON object with a key set to ssh_keys.
The value of this will be an array of key objects, each of which contain the standard key attributes.
hilary marked this conversation as resolved.
Show resolved Hide resolved

tags:
- Account
- SSH Keys

parameters:
- $ref: '../../shared/parameters.yml#/PerPage'
- $ref: '../../shared/parameters.yml#/Page'

responses:
'200':
$ref: 'responses/all_keys.yml'
hilary marked this conversation as resolved.
Show resolved Hide resolved
17 changes: 17 additions & 0 deletions resources/ssh_keys/models/decorated_wrapped_ssh_keys.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
description: >-
A paginated list of your ssh keys.

allOf:
- type: object

properties:
ssh_keys:
type: array
items:
$ref: 'ssh_keys.yml'

required:
- ssh_keys

- $ref: '../../../shared/pages.yml#/Pagination'
- $ref: '../../../shared/meta.yml'
Loading