Skip to content

Fix parameters with references #1061

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

Merged
merged 1 commit into from
Mar 30, 2023
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
2,365 changes: 2,289 additions & 76 deletions examples/digital-ocean-api.ts

Large diffs are not rendered by default.

57 changes: 50 additions & 7 deletions examples/digital-ocean-api/DigitalOcean-public.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,11 @@ tags:
configurations requiring movable addresses.

Floating IPs are bound to a specific region.

- name: Functions
description: |-
[Serverless functions](https://docs.digitalocean.com/products/functions) are blocks of code that run on demand without the need to manage any infrastructure.
You can develop functions on your local machine and then deploy them to a namespace using `doctl`, the [official DigitalOcean CLI tool](https://docs.digitalocean.com/reference/doctl).
You can develop functions on your local machine and then deploy them to a namespace using `doctl`, the [official DigitalOcean CLI tool](https://docs.digitalocean.com/reference/doctl).

The Serverless Functions API currently only supports creating and managing namespaces.

Expand Down Expand Up @@ -515,8 +515,8 @@ tags:

- name: Uptime
description: >-
[DigitalOcean Uptime Checks](https://docs.digitalocean.com/products/uptime/) provide the ability to monitor your endpoints from around the world, and alert you when they're slow, unavailable, or SSL certificates are expiring.
[DigitalOcean Uptime Checks](https://docs.digitalocean.com/products/uptime/) provide the ability to monitor your endpoints from around the world, and alert you when they're slow, unavailable, or SSL certificates are expiring.

To interact with Uptime, you will generally send requests to the Uptime endpoint at `/v2/uptime/`.

- name: VPCs
Expand Down Expand Up @@ -581,6 +581,10 @@ paths:
put:
$ref: 'resources/apps/apps_update.yml'

/v2/apps/{app_id}/components/{component_name}/logs:
get:
$ref: 'resources/apps/apps_get_logs_active_deployment.yml'

/v2/apps/{app_id}/deployments:
get:
$ref: 'resources/apps/apps_list_deployments.yml'
Expand All @@ -595,13 +599,17 @@ paths:
post:
$ref: 'resources/apps/apps_cancel_deployment.yml'

/v2/apps/{app_id}/deployments/{deployment_id}/components/{component_name}/logs:
/v2/apps/{app_id}/deployments/{deployment_id}/components/{component_name}/logs:
get:
$ref: 'resources/apps/apps_get_logs.yml'

/v2/apps/{app_id}/deployments/{deployment_id}/logs:
get:
$ref: 'resources/apps/apps_get_logsAggregate.yml'
$ref: 'resources/apps/apps_get_logs_aggregate.yml'

/v2/apps/{app_id}/logs:
get:
$ref: 'resources/apps/apps_get_logs_active_deployment_aggregate.yml'

/v2/apps/tiers:
get:
Expand Down Expand Up @@ -651,6 +659,14 @@ paths:
post:
$ref: 'resources/apps/apps_revert_rollback.yml'

/v2/apps/{app_id}/metrics/bandwidth_daily:
get:
$ref: 'resources/apps/apps_get_metrics_bandwidth_usage.yml'

/v2/apps/metrics/bandwidth_daily:
post:
$ref: 'resources/apps/apps_list_metrics_bandwidth_usage.yml'

/v2/cdn/endpoints:
get:
$ref: 'resources/cdn/cdn_list_endpoints.yml'
Expand Down Expand Up @@ -784,6 +800,10 @@ paths:
delete:
$ref: 'resources/databases/databases_destroy_replica.yml'

/v2/databases/{database_cluster_uuid}/replicas/{replica_name}/promote:
put:
$ref: 'resources/databases/databases_promote_replica.yml'

/v2/databases/{database_cluster_uuid}/users:
get:
$ref: 'resources/databases/databases_list_users.yml'
Expand Down Expand Up @@ -821,6 +841,8 @@ paths:
/v2/databases/{database_cluster_uuid}/pools/{pool_name}:
get:
$ref: 'resources/databases/databases_get_connectionPool.yml'
put:
$ref: 'resources/databases/databases_update_connectionPool.yml'
delete:
$ref: 'resources/databases/databases_delete_connectionPool.yml'

Expand All @@ -836,6 +858,10 @@ paths:
put:
$ref: 'resources/databases/databases_update_sql_mode.yml'

/v2/databases/{database_cluster_uuid}/upgrade:
put:
$ref: 'resources/databases/databases_upgrade_major_version.yml'

/v2/domains:
get:
$ref: 'resources/domains/domains_list.yml'
Expand Down Expand Up @@ -1006,6 +1032,23 @@ paths:
delete:
$ref: 'resources/functions/functions_delete_namespace.yml'

/v2/functions/namespaces/{namespace_id}/triggers:
get:
$ref: 'resources/functions/functions_list_triggers.yml'

post:
$ref: 'resources/functions/functions_create_trigger.yml'

/v2/functions/namespaces/{namespace_id}/triggers/{trigger_name}:
get:
$ref: 'resources/functions/functions_get_trigger.yml'

put:
$ref: 'resources/functions/functions_update_trigger.yml'

delete:
$ref: 'resources/functions/functions_delete_trigger.yml'

/v2/images:
get:
$ref: 'resources/images/images_list.yml'
Expand Down Expand Up @@ -1511,7 +1554,7 @@ components:
authorization. OAuth allows you to delegate access to your account in full
or in read-only mode.

You can generate an OAuth token by visiting the [Apps & API](https://cloud.digitalocean.com/settings/api/tokens)
You can generate an OAuth token by visiting the [Apps & API](https://cloud.digitalocean.com/account/api/tokens)
section of the DigitalOcean control panel for your account.

An OAuth token functions as a complete authentication request. In effect, it
Expand Down
28 changes: 16 additions & 12 deletions examples/digital-ocean-api/description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,30 +202,30 @@ introduction: |
The rate limiting information is contained within the response headers of
each request. The relevant headers are:

* **RateLimit-Limit**: The number of requests that can be made per hour.
* **RateLimit-Remaining**: The number of requests that remain before you hit your request limit. See the information below for how the request limits expire.
* **RateLimit-Reset**: This represents the time when the oldest request will expire. The value is given in [Unix epoch time](http://en.wikipedia.org/wiki/Unix_time). See below for more information about how request limits expire.
* **ratelimit-limit**: The number of requests that can be made per hour.
* **ratelimit-remaining**: The number of requests that remain before you hit your request limit. See the information below for how the request limits expire.
* **ratelimit-reset**: This represents the time when the oldest request will expire. The value is given in [Unix epoch time](http://en.wikipedia.org/wiki/Unix_time). See below for more information about how request limits expire.

As long as the `RateLimit-Remaining` count is above zero, you will be able
As long as the `ratelimit-remaining` count is above zero, you will be able
to make additional requests.

The way that a request expires and is removed from the current limit count
is important to understand. Rather than counting all of the requests for an
hour and resetting the `RateLimit-Remaining` value at the end of the hour,
hour and resetting the `ratelimit-remaining` value at the end of the hour,
each request instead has its own timer.

This means that each request contributes toward the `RateLimit-Remaining`
This means that each request contributes toward the `ratelimit-remaining`
count for one complete hour after the request is made. When that request's
timer runs out, it is no longer counted towards the request limit.

This has implications on the meaning of the `RateLimit-Reset` header as
This has implications on the meaning of the `ratelimit-reset` header as
well. Because the entire rate limit is not reset at one time, the value of
this header is set to the time when the _oldest_ request will expire.

Keep this in mind if you see your `RateLimit-Reset` value change, but not
Keep this in mind if you see your `ratelimit-reset` value change, but not
move an entire hour into the future.

If the `RateLimit-Remaining` reaches zero, subsequent requests will receive
If the `ratelimit-remaining` reaches zero, subsequent requests will receive
a 429 error code until the request reset has been reached. You can see the
format of the response in the examples.

Expand All @@ -234,14 +234,18 @@ introduction: |

* Only 12 `POST` requests to the `/v2/floating_ips` endpoint to create Floating IPs can be made per 60 seconds.
* Only 10 `GET` requests to the `/v2/account/keys` endpoint to list SSH keys can be made per 60 seconds.
* Only 5 requests to any and all `v2/cdn/endpoints` can be made per 10 seconds. This includes `v2/cdn/endpoints`,
`v2/cdn/endpoints/$ENDPOINT_ID`, and `v2/cdn/endpoints/$ENDPOINT_ID/cache`.
* Only 50 strings within the `files` json struct in the `v2/cdn/endpoints/$ENDPOINT_ID/cache` [payload](https://docs.digitalocean.com/reference/api/api-reference/#operation/cdn_purge_cache)
can be requested every 20 seconds.

### Sample Rate Limit Headers

```
. . .
RateLimit-Limit: 1200
RateLimit-Remaining: 1193
RateLimit-Reset: 1402425459
ratelimit-limit: 1200
ratelimit-remaining: 1193
rateLimit-reset: 1402425459
. . .
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ operationId: apps_get_logs

summary: Retrieve Deployment Logs

description: Retrieve the logs of a past, in-progress, or active deployment. If a
component name is specified, the logs will be limited to only that component. The
description: Retrieve the logs of a past, in-progress, or active deployment. The
response will include links to either real-time logs of an in-progress or active
deployment or archived logs of a past deployment.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ source: |-
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
"https://api.digitalocean.com/v2/apps"
-d '{"spec":{"name":"web-app","region":"nyc", \
"services":[{"name":"api","github":{"branch":"main",\
"deploy_on_push":true,"repo":"digitalocean/sample-golang"}, \
"run_command":"bin/api","environment_slug":"node-js", \
"instance_count":2,"instance_size_slug":"basic-xxs", \
"routes":[{"path":"/api"}]}]}}'
4 changes: 4 additions & 0 deletions examples/digital-ocean-api/resources/apps/models/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ properties:
title: The ID of the account to which the application belongs
type: string
example: 4f6c71e2-1e90-4762-9fee-6cc4a0a9f2cf
pending_deployment:
allOf:
- description: The most recent pending deployment. For CreateApp and UpdateApp transactions this is guaranteed to reflect the associated deployment.
- $ref: apps_deployment.yml
project_id:
readOnly: true
type: string
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type: object
properties:
rules:
description: Rules for configuring HTTP ingress for component routes, CORS, rewrites, and redirects.
type: array
items:
$ref: app_ingress_spec_rule.yml
description: Specification for app ingress configurations.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type: object
properties:
match:
$ref: app_ingress_spec_rule_match.yml

cors:
$ref: apps_cors_policy.yml

component:
$ref: app_ingress_spec_rule_routing_component.yml

redirect:
$ref: app_ingress_spec_rule_routing_redirect.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: object
properties:
path:
$ref: app_ingress_spec_rule_string_match.yml
description: The match configuration for the rule.
required:
- path
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
type: object
properties:
name:
description: The name of the component to route to.
type: string
example: web

preserve_path_prefix:
description: "An optional flag to preserve the path that is forwarded to the backend service. By default, the HTTP request path will be trimmed from the left when forwarded to the component. For example, a component with `path=/api` will have requests to `/api/list` trimmed to `/list`. If this value is `true`, the path will remain `/api/list`. Note: this is not applicable for Functions Components and is mutually exclusive with `rewrite`."
type: string
example: "true"

rewrite:
description: "An optional field that will rewrite the path of the component to be what is specified here. By default, the HTTP request path will be trimmed from the left when forwarded to the component. For example, a component with `path=/api` will have requests to `/api/list` trimmed to `/list`. If you specified the rewrite to be `/v1/`, requests to `/api/list` would be rewritten to `/v1/list`. Note: this is mutually exclusive with `preserve_path_prefix`."
type: string
example: /api/v1/
description: The component to route to. Only one of `component` or `redirect` may be set.
required:
- name
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
type: object
properties:
uri:
description: "An optional URI path to redirect to. Note: if this is specified the whole URI of the original request will be overwritten to this value, irrespective of the original request URI being matched."
type: string
example: /about

authority:
description: "The authority/host to redirect to. This can be a hostname or IP address. Note: use `port` to set the port."
type: string
example: example.com

port:
description: The port to redirect to.
type: integer
format: int64
example: 443

scheme:
description: "The scheme to redirect to. Supported values are `http` or `https`. Default: `https`."
type: string
example: "https"

redirect_code:
description: The redirect code to use. Defaults to `302`. Supported values are 300, 301, 302, 303, 304, 307, 308.
type: integer
format: int64
example: 302
description: The redirect configuration for the rule. Only one of `component` or `redirect` may be set.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type: object
properties:
prefix:
type: string
description: Prefix-based match. For example, `/api` will match `/api`, `/api/`, and any nested paths such as `/api/v1/endpoint`.
maxLength: 256
example: /api
description: The path to match on.
required:
- prefix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ properties:
- ams
- nyc
- fra
- sfo
- sgp
- blr
- tor
- lon
- syd
example: nyc

domains:
Expand Down Expand Up @@ -65,5 +71,8 @@ properties:
items:
$ref: app_database_spec.yml

ingress:
$ref: app_ingress_spec.yml

required:
- name
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,19 @@ properties:
$ref: apps_domain_progress.yml
spec:
$ref: app_domain_spec.yml
validations:
title: "List of TXT validation records"
type: array
items:
$ref: app_domain_validation.yml
rotate_validation_records:
title: "Validation values have changed and require manual intervention"
type: boolean
readOnly: true
certificate_expires_at:
title: "Current SSL certificate expiration time"
type: string
format: date-time
readOnly: true
example: "2024-01-29T23:59:59Z"
type: object
Loading