Skip to content

Commit 9939b76

Browse files
authored
Remove undefined from additionalProperties union (#1799)
* Remove undefined from additionalProperties * Add missing schema to update:examples script
1 parent 7de583a commit 9939b76

File tree

65 files changed

+25805
-5787
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+25805
-5787
lines changed

.changeset/spotty-donuts-sleep.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"openapi-typescript": minor
3+
---
4+
5+
Don’t generate `| undefined` for additionalProperties

docs/data/contributors.json

+1-1
Large diffs are not rendered by default.

docs/scripts/update-contributors.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,12 @@ async function main() {
196196
? OPENAPI_REACT_QUERY_CONTRIBUTORS
197197
: OPENAPI_TS_CONTRIBUTORS;
198198
for (const username of userlist) {
199+
i++;
199200
// skip profiles that have been updated within the past week
200201
const { lastFetch } = contributors[repo].find((u) => u.username === username) ?? { lastFetch: 0 };
201202
if (Date.now() - lastFetch < ONE_MONTH) {
203+
// biome-ignore lint/suspicious/noConsoleLog: this is a script
204+
console.log(`[${i}/${total}] (Skipped ${username})`);
202205
continue;
203206
}
204207

@@ -212,11 +215,10 @@ async function main() {
212215
lastFetch: new Date().getTime(),
213216
};
214217
upsert(contributors[repo], userData);
215-
i++;
216-
// biome-ignore lint/suspicious/noConsoleLog: this is a script
218+
// biome-ignore lint/suspicious/noConsoleLog: this is a script
217219
console.log(`[${i}/${total}] Updated for ${username}`);
218220
fs.writeFileSync(new URL("../data/contributors.json", import.meta.url), JSON.stringify(contributors)); // update file while fetching (sync happens safely in between fetches)
219-
await new Promise((resolve) => setTimeout(resolve, 900)); // sleep to prevent 429
221+
await new Promise((resolve) => setTimeout(resolve, 1000)); // sleep to prevent 429
220222
} catch (err) {
221223
throw new Error(err);
222224
}

packages/openapi-typescript/examples/digital-ocean-api.ts

+694-55
Large diffs are not rendered by default.

packages/openapi-typescript/examples/digital-ocean-api/DigitalOcean-public.v2.yaml

+18-2
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,9 @@ tags:
144144
simplifies the creation and management of highly available database clusters. Currently, it
145145
offers support for [PostgreSQL](http://www.digitalocean.com/docs/databases/postgresql/),
146146
[Redis](https://www.digitalocean.com/docs/databases/redis/),
147-
[MySQL](https://www.digitalocean.com/docs/databases/mysql/), and
148-
[MongoDB](https://www.digitalocean.com/docs/databases/mongodb/).
147+
[MySQL](https://www.digitalocean.com/docs/databases/mysql/),
148+
[MongoDB](https://www.digitalocean.com/docs/databases/mongodb/), and
149+
[OpenSearch](https://docs.digitalocean.com/products/databases/opensearch/).
149150
150151
By sending requests to the `/v2/databases` endpoint, you can list, create, or delete
151152
database clusters as well as scale the size of a cluster, add or remove read-only replicas,
@@ -839,6 +840,21 @@ paths:
839840
$ref: 'resources/databases/databases_update_kafka_topic.yml'
840841
delete:
841842
$ref: 'resources/databases/databases_delete_kafka_topic.yml'
843+
844+
/v2/databases/{database_cluster_uuid}/logsink:
845+
get:
846+
$ref: 'resources/databases/databases_list_logsink.yml'
847+
post:
848+
$ref: 'resources/databases/databases_create_logsink.yml'
849+
850+
/v2/databases/{database_cluster_uuid}/logsink/{logsink_id}:
851+
get:
852+
$ref: 'resources/databases/databases_get_logsink.yml'
853+
put:
854+
$ref: 'resources/databases/databases_update_logsink.yml'
855+
delete:
856+
$ref: 'resources/databases/databases_delete_logsink.yml'
857+
842858

843859
/v2/databases/metrics/credentials:
844860
get:

packages/openapi-typescript/examples/digital-ocean-api/resources/apps/apps_validate_appSpec.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,5 @@ responses:
5353

5454
security:
5555
- bearer_auth:
56-
- 'app:create'
56+
- 'app:read'
5757

packages/openapi-typescript/examples/digital-ocean-api/resources/apps/examples/python/apps_update.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ source: |-
8181
"token": "abcdefghijklmnopqrstuvwxyz0123456789"
8282
},
8383
"open_search": {
84-
"endpoint": "myopensearchendpoint.com:9300"
84+
"endpoint": "https://myopensearchendpoint.com:9300"
8585
"index_name": "logs"
8686
"basic_auth": {
8787
"user": "doadmin",
@@ -134,7 +134,7 @@ source: |-
134134
"token": "abcdefghijklmnopqrstuvwxyz0123456789"
135135
},
136136
"open_search": {
137-
"endpoint": "myopensearchendpoint.com:9300"
137+
"endpoint": "https://myopensearchendpoint.com:9300"
138138
"index_name": "logs"
139139
"basic_auth": {
140140
"user": "doadmin",

packages/openapi-typescript/examples/digital-ocean-api/resources/apps/models/app_database_spec.yml

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
type: object
22
properties:
33
cluster_name:
4-
description: The name of the underlying DigitalOcean DBaaS cluster. This is required
4+
description:
5+
The name of the underlying DigitalOcean DBaaS cluster. This is required
56
for production databases. For dev databases, if cluster_name is not set, a new
67
cluster will be provisioned.
78
type: string
@@ -21,22 +22,24 @@ properties:
2122
type: string
2223
default: UNSET
2324
enum:
24-
- UNSET
25-
- MYSQL
26-
- PG
27-
- REDIS
28-
- MONGODB
29-
- KAFKA
25+
- UNSET
26+
- MYSQL
27+
- PG
28+
- REDIS
29+
- MONGODB
30+
- KAFKA
31+
- OPENSEARCH
3032
description: |-
3133
- MYSQL: MySQL
3234
- PG: PostgreSQL
3335
- REDIS: Redis
3436
- MONGODB: MongoDB
3537
- KAFKA: Kafka
38+
- OPENSEARCH: OpenSearch
3639
example: PG
3740

3841
name:
39-
description: The name. Must be unique across all components within the same app.
42+
description: The database's name. The name must be unique across all components within the same app and cannot use capital letters.
4043
maxLength: 32
4144
minLength: 2
4245
pattern: ^[a-z][a-z0-9-]{0,30}[a-z0-9]$
@@ -54,4 +57,4 @@ properties:
5457
example: "12"
5558

5659
required:
57-
- name
60+
- name

packages/openapi-typescript/examples/digital-ocean-api/resources/apps/models/app_log_destination_open_search_spec.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ type: object
22
properties:
33
endpoint:
44
type: string
5-
description: >-
6-
OpenSearch API Endpoint. Only HTTPS is supported. Format: `https://<host>:<port>`.
5+
description: |-
6+
OpenSearch API Endpoint. Only HTTPS is supported. Format: https://<host>:<port>.
7+
Cannot be specified if `cluster_name` is also specified.
78
example: "https://example.com:9300"
89
basic_auth:
910
$ref: app_log_destination_open_search_spec_basic_auth.yml
@@ -14,6 +15,10 @@ properties:
1415
The index name to use for the logs. If not set, the default index name
1516
is "logs".
1617
example: logs
18+
cluster_name:
19+
type: string
20+
description: |-
21+
The name of a DigitalOcean DBaaS OpenSearch cluster to use as a log forwarding destination.
22+
Cannot be specified if `endpoint` is also specified.
23+
example: my-opensearch-cluster
1724
description: OpenSearch configuration.
18-
required:
19-
- endpoint

packages/openapi-typescript/examples/digital-ocean-api/resources/apps/models/app_log_destination_open_search_spec_basic_auth.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ type: object
22
properties:
33
user:
44
type: string
5-
description: Username to authenticate with.
5+
description: |-
6+
Username to authenticate with. Only required when `endpoint` is set.
7+
Defaults to `doadmin` when `cluster_name` is set.
68
example: apps_user
79
password:
8-
type: string
9-
description: Password for user defined in User.
10+
description: |-
11+
Password for user defined in User. Is required when `endpoint` is set.
12+
Cannot be set if using a DigitalOcean DBaaS OpenSearch cluster.
1013
example: password1
1114
description: Configure Username and/or Password for Basic authentication.
12-
required:
13-
- user
14-
- password

packages/openapi-typescript/examples/digital-ocean-api/resources/apps/models/apps_string_match.yml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ properties:
1515
maxLength: 256
1616
minLength: 1
1717
example: https://www.example.com
18+
deprecated: true
1819

1920
regex:
2021
type: string

packages/openapi-typescript/examples/digital-ocean-api/resources/databases/databases_create_cluster.yml

-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ description: >-
2727
2828
Note: Backups are not supported for Redis clusters.
2929
30-
OpenSearch is in closed beta. To request access, [contact support](https://cloudsupport.digitalocean.com).
31-
3230
tags:
3331
- Databases
3432

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
operationId: databases_create_logsink
2+
3+
summary: >
4+
Create Logsink for a Database Cluster
5+
6+
description: |
7+
To create logsink for a database cluster, send a POST request to
8+
`/v2/databases/$DATABASE_ID/logsink`.
9+
10+
tags:
11+
- Databases
12+
13+
parameters:
14+
- $ref: "parameters.yml#/database_cluster_uuid"
15+
16+
requestBody:
17+
required: true
18+
content:
19+
application/json:
20+
schema:
21+
allOf:
22+
- $ref: models/logsink_create.yml
23+
required:
24+
- sink_name
25+
- sink_type
26+
- config
27+
examples:
28+
Create an opensearch logsink:
29+
value:
30+
sink_name: "logs-sink"
31+
sink_type: "opensearch"
32+
config:
33+
url: https://user:[email protected]:25060
34+
index_prefix: "opensearch-logs"
35+
index_days_max: 5
36+
Create an elasticsearch logsink:
37+
value:
38+
sink_name: "logs-sink"
39+
sink_type: "elasticsearch"
40+
config:
41+
url: https://user:[email protected]:25060
42+
index_prefix: "elasticsearch-logs"
43+
index_days_max: 5
44+
Create a rsyslog logsink:
45+
value:
46+
sink_name: "logs-sink"
47+
sink_type: "rsyslog"
48+
config:
49+
server: 192.168.0.1
50+
port: 514
51+
tls: false
52+
format: rfc5424
53+
54+
responses:
55+
"201":
56+
$ref: "responses/logsink.yml"
57+
58+
"401":
59+
$ref: "../../shared/responses/unauthorized.yml"
60+
61+
"404":
62+
$ref: "../../shared/responses/not_found.yml"
63+
64+
"429":
65+
$ref: "../../shared/responses/too_many_requests.yml"
66+
67+
"500":
68+
$ref: "../../shared/responses/server_error.yml"
69+
70+
default:
71+
$ref: "../../shared/responses/unexpected_error.yml"
72+
73+
x-codeSamples:
74+
- $ref: "examples/curl/databases_create_logsink.yml"
75+
76+
security:
77+
- bearer_auth:
78+
- 'database:create'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
operationId: databases_delete_logsink
2+
3+
summary: >
4+
Delete Logsink for a Database Cluster
5+
6+
description: |
7+
To delete a logsink for a database cluster, send a DELETE request to
8+
`/v2/databases/$DATABASE_ID/logsink/$LOGSINK_ID`.
9+
10+
tags:
11+
- Databases
12+
13+
parameters:
14+
- $ref: "parameters.yml#/database_cluster_uuid"
15+
- $ref: "parameters.yml#/logsink_id"
16+
17+
responses:
18+
"200":
19+
$ref: "../../shared/responses/no_content.yml"
20+
21+
"401":
22+
$ref: "../../shared/responses/unauthorized.yml"
23+
24+
"404":
25+
$ref: "../../shared/responses/not_found.yml"
26+
27+
"429":
28+
$ref: "../../shared/responses/too_many_requests.yml"
29+
30+
"500":
31+
$ref: "../../shared/responses/server_error.yml"
32+
33+
default:
34+
$ref: "../../shared/responses/unexpected_error.yml"
35+
36+
x-codeSamples:
37+
- $ref: "examples/curl/databases_delete_logsink.yml"
38+
39+
security:
40+
- bearer_auth:
41+
- 'database:delete'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
operationId: databases_get_logsink
2+
3+
summary: >
4+
Get Logsink for a Database Cluster
5+
6+
description: |
7+
To get a logsink for a database cluster, send a GET request to
8+
`/v2/databases/$DATABASE_ID/logsink/$LOGSINK_ID`.
9+
10+
tags:
11+
- Databases
12+
13+
parameters:
14+
- $ref: "parameters.yml#/database_cluster_uuid"
15+
- $ref: "parameters.yml#/logsink_id"
16+
17+
responses:
18+
"201":
19+
$ref: "responses/logsink.yml"
20+
21+
"401":
22+
$ref: "../../shared/responses/unauthorized.yml"
23+
24+
"404":
25+
$ref: "../../shared/responses/not_found.yml"
26+
27+
"429":
28+
$ref: "../../shared/responses/too_many_requests.yml"
29+
30+
"500":
31+
$ref: "../../shared/responses/server_error.yml"
32+
33+
default:
34+
$ref: "../../shared/responses/unexpected_error.yml"
35+
36+
x-codeSamples:
37+
- $ref: "examples/curl/databases_get_logsink.yml"
38+
39+
security:
40+
- bearer_auth:
41+
- 'database:read'

0 commit comments

Comments
 (0)