Skip to content

Commit 0357325

Browse files
authored
Fix extra quote generated in components/responses with $refs (#1324)
* Fix extra quote generated in components/responses with $refs * Use Vitest .toMatchFileSnapshot() * Fix snapshots
1 parent b661fa1 commit 0357325

18 files changed

+1221
-308
lines changed

.changeset/curvy-ants-add.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"openapi-typescript": patch
3+
---
4+
5+
Fix accidental quote appearing in components/responses with $refs

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -4964,7 +4964,7 @@ export interface external {
49644964
};
49654965
};
49664966
responses: {
4967-
204: external["shared/responses/no_content.yml"];
4967+
200: external["shared/responses/no_content.yml"];
49684968
401: external["shared/responses/unauthorized.yml"];
49694969
404: external["shared/responses/not_found.yml"];
49704970
429: external["shared/responses/too_many_requests.yml"];

packages/openapi-typescript/examples/digital-ocean-api/description.yml

+22-4
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ introduction: |
205205
* **ratelimit-limit**: The number of requests that can be made per hour.
206206
* **ratelimit-remaining**: The number of requests that remain before you hit your request limit. See the information below for how the request limits expire.
207207
* **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.
208+
209+
More rate limiting information is returned only within burst limit error response headers:
210+
* **retry-after**: The number of seconds to wait before making another request when rate limited.
208211
209212
As long as the `ratelimit-remaining` count is above zero, you will be able
210213
to make additional requests.
@@ -226,10 +229,14 @@ introduction: |
226229
move an entire hour into the future.
227230
228231
If the `ratelimit-remaining` reaches zero, subsequent requests will receive
229-
a 429 error code until the request reset has been reached. You can see the
230-
format of the response in the examples. `ratelimit-remaining` reaching zero
231-
can also indicate that the 250 requests per minute limit was met, even if
232-
the 5,000 requests per hour limit was not.
232+
a 429 error code until the request reset has been reached.
233+
234+
`ratelimit-remaining` reaching zero can also indicate that the "burst limit" of 250
235+
requests per minute limit was met, even if the 5,000 requests per hour limit was not.
236+
In this case, the 429 error response will include a retry-after header to indicate how
237+
long to wait (in seconds) until the request may be retried.
238+
239+
You can see the format of the response in the examples.
233240
234241
**Note:** The following endpoints have special rate limit requirements that
235242
are independent of the limits defined above.
@@ -251,6 +258,17 @@ introduction: |
251258
. . .
252259
```
253260
261+
### Sample Rate Limit Headers When Burst Limit is Reached:
262+
263+
```
264+
. . .
265+
ratelimit-limit: 5000
266+
ratelimit-remaining: 0
267+
rateLimit-reset: 1402425459
268+
retry-after: 29
269+
. . .
270+
```
271+
254272
### Sample Rate Exceeded Response
255273
256274
```

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ parameters:
2323
- $ref: 'parameters.yml#/database_cluster_uuid'
2424

2525
responses:
26-
'204':
26+
'200':
2727
$ref: '../../shared/responses/no_content.yml'
2828

2929
'401':

packages/openapi-typescript/examples/github-api-next.ts

+147-21
Large diffs are not rendered by default.

packages/openapi-typescript/examples/github-api-next.yaml

+227-16
Large diffs are not rendered by default.

packages/openapi-typescript/examples/github-api.ts

+37-11
Original file line numberDiff line numberDiff line change
@@ -3610,7 +3610,7 @@ export interface paths {
36103610
* Rerequest a check suite
36113611
* @description Triggers GitHub to rerequest an existing check suite, without pushing new code to a repository. This endpoint will trigger the [`check_suite` webhook](https://docs.github.com/webhooks/event-payloads/#check_suite) event with the action `rerequested`. When a check suite is `rerequested`, its `status` is reset to `queued` and the `conclusion` is cleared.
36123612
*
3613-
* To rerequest a check suite, your GitHub App must have the `checks:read` permission on a private repository or pull access to a public repository.
3613+
* To rerequest a check suite, your GitHub App must have the `checks:write` permission on a private repository or pull access to a public repository.
36143614
*/
36153615
post: operations["checks/rerequest-suite"];
36163616
};
@@ -4348,7 +4348,7 @@ export interface paths {
43484348
get: operations["repos/get-content"];
43494349
/**
43504350
* Create or update file contents
4351-
* @description Creates a new file or replaces an existing file in a repository. You must authenticate using an access token with the `workflow` scope to use this endpoint.
4351+
* @description Creates a new file or replaces an existing file in a repository. You must authenticate using an access token with the `repo` scope to use this endpoint. If you want to modify files in the `.github/workflows` directory, you must authenticate using an access token with the `workflow` scope.
43524352
*
43534353
* **Note:** If you use this endpoint and the "[Delete a file](https://docs.github.com/rest/repos/contents/#delete-a-file)" endpoint in parallel, the concurrent requests will conflict and you will receive errors. You must use these endpoints serially instead.
43544354
*/
@@ -4531,7 +4531,7 @@ export interface paths {
45314531
* * Create a new deployment that is active so that the system has a record of the current state, then delete the previously active deployment.
45324532
* * Mark the active deployment as inactive by adding any non-successful deployment status.
45334533
*
4534-
* For more information, see "[Create a deployment](https://docs.github.com/rest/deployments/deployments/#create-a-deployment)" and "[Create a deployment status](https://docs.github.com/rest/deployments/deployment-statuses#create-a-deployment-status)."
4534+
* For more information, see "[Create a deployment](https://docs.github.com/rest/deployments/deployments/#create-a-deployment)" and "[Create a deployment status](https://docs.github.com/rest/deployments/statuses#create-a-deployment-status)."
45354535
*/
45364536
delete: operations["repos/delete-deployment"];
45374537
};
@@ -12253,7 +12253,7 @@ export interface components {
1225312253
* @description The mode of assigning new seats.
1225412254
* @enum {string}
1225512255
*/
12256-
seat_management_setting: "assign_all" | "assign_selected" | "disabled";
12256+
seat_management_setting: "assign_all" | "assign_selected" | "disabled" | "unconfigured";
1225712257
[key: string]: unknown;
1225812258
};
1225912259
/**
@@ -13202,7 +13202,7 @@ export interface components {
1320213202
};
1320313203
/**
1320413204
* Organization ruleset conditions
13205-
* @description Conditions for an organization ruleset
13205+
* @description Conditions for an organization ruleset. The conditions object should contain both `repository_name` and `ref_name` properties or both `repository_id` and `ref_name` properties.
1320613206
*/
1320713207
"org-ruleset-conditions": (components["schemas"]["repository-ruleset-conditions"] & components["schemas"]["repository-ruleset-conditions-repository-name-target"]) | (components["schemas"]["repository-ruleset-conditions"] & components["schemas"]["repository-ruleset-conditions-repository-id-target"]);
1320813208
/**
@@ -22975,6 +22975,26 @@ export interface components {
2297522975
*/
2297622976
push_protection_bypassed_at?: string | null;
2297722977
};
22978+
/** branch protection configuration disabled event */
22979+
"webhook-branch-protection-configuration-disabled": {
22980+
/** @enum {string} */
22981+
action: "disabled";
22982+
enterprise?: components["schemas"]["enterprise"];
22983+
installation?: components["schemas"]["simple-installation"];
22984+
organization?: components["schemas"]["organization-simple"];
22985+
repository: components["schemas"]["repository"];
22986+
sender: components["schemas"]["simple-user"];
22987+
};
22988+
/** branch protection configuration enabled event */
22989+
"webhook-branch-protection-configuration-enabled": {
22990+
/** @enum {string} */
22991+
action: "enabled";
22992+
enterprise?: components["schemas"]["enterprise"];
22993+
installation?: components["schemas"]["simple-installation"];
22994+
organization?: components["schemas"]["organization-simple"];
22995+
repository: components["schemas"]["repository"];
22996+
sender: components["schemas"]["simple-user"];
22997+
};
2297822998
/** branch protection rule created event */
2297922999
"webhook-branch-protection-rule-created": {
2298023000
/** @enum {string} */
@@ -81572,6 +81592,8 @@ export interface components {
8157281592
"card-id": number;
8157381593
/** @description The unique identifier of the column. */
8157481594
"column-id": number;
81595+
/** @description The name field of an artifact. When specified, only artifacts with this name will be returned. */
81596+
"artifact-name"?: string;
8157581597
/** @description The unique identifier of the artifact. */
8157681598
"artifact-id": number;
8157781599
/** @description The full Git reference for narrowing down the cache. The `ref` for a branch should be formatted as `refs/heads/<branch name>`. To reference a pull request use `refs/pull/<number>/merge`. */
@@ -90793,8 +90815,7 @@ export interface operations {
9079390815
query?: {
9079490816
per_page?: components["parameters"]["per-page"];
9079590817
page?: components["parameters"]["page"];
90796-
/** @description Filters artifacts by exact match on their name field. */
90797-
name?: string;
90818+
name?: components["parameters"]["artifact-name"];
9079890819
};
9079990820
path: {
9080090821
owner: components["parameters"]["owner"];
@@ -91899,6 +91920,7 @@ export interface operations {
9189991920
query?: {
9190091921
per_page?: components["parameters"]["per-page"];
9190191922
page?: components["parameters"]["page"];
91923+
name?: components["parameters"]["artifact-name"];
9190291924
};
9190391925
path: {
9190491926
owner: components["parameters"]["owner"];
@@ -94649,7 +94671,7 @@ export interface operations {
9464994671
* Rerequest a check suite
9465094672
* @description Triggers GitHub to rerequest an existing check suite, without pushing new code to a repository. This endpoint will trigger the [`check_suite` webhook](https://docs.github.com/webhooks/event-payloads/#check_suite) event with the action `rerequested`. When a check suite is `rerequested`, its `status` is reset to `queued` and the `conclusion` is cleared.
9465194673
*
94652-
* To rerequest a check suite, your GitHub App must have the `checks:read` permission on a private repository or pull access to a public repository.
94674+
* To rerequest a check suite, your GitHub App must have the `checks:write` permission on a private repository or pull access to a public repository.
9465394675
*/
9465494676
"checks/rerequest-suite": {
9465594677
parameters: {
@@ -95427,6 +95449,8 @@ export interface operations {
9542795449
location?: string;
9542895450
/** @description IP for location auto-detection when proxying a request */
9542995451
client_ip?: string;
95452+
/** @description The branch or commit to check for prebuild availability and devcontainer restrictions. */
95453+
ref?: string;
9543095454
};
9543195455
path: {
9543295456
owner: components["parameters"]["owner"];
@@ -96575,7 +96599,7 @@ export interface operations {
9657596599
};
9657696600
/**
9657796601
* Create or update file contents
96578-
* @description Creates a new file or replaces an existing file in a repository. You must authenticate using an access token with the `workflow` scope to use this endpoint.
96602+
* @description Creates a new file or replaces an existing file in a repository. You must authenticate using an access token with the `repo` scope to use this endpoint. If you want to modify files in the `.github/workflows` directory, you must authenticate using an access token with the `workflow` scope.
9657996603
*
9658096604
* **Note:** If you use this endpoint and the "[Delete a file](https://docs.github.com/rest/repos/contents/#delete-a-file)" endpoint in parallel, the concurrent requests will conflict and you will receive errors. You must use these endpoints serially instead.
9658196605
*/
@@ -96718,7 +96742,7 @@ export interface operations {
9671896742
};
9671996743
};
9672096744
responses: {
96721-
/** @description if repository contains content */
96745+
/** @description If repository contains content */
9672296746
200: {
9672396747
headers: {
9672496748
Link: components["headers"]["link"];
@@ -97263,7 +97287,7 @@ export interface operations {
9726397287
* * Create a new deployment that is active so that the system has a record of the current state, then delete the previously active deployment.
9726497288
* * Mark the active deployment as inactive by adding any non-successful deployment status.
9726597289
*
97266-
* For more information, see "[Create a deployment](https://docs.github.com/rest/deployments/deployments/#create-a-deployment)" and "[Create a deployment status](https://docs.github.com/rest/deployments/deployment-statuses#create-a-deployment-status)."
97290+
* For more information, see "[Create a deployment](https://docs.github.com/rest/deployments/deployments/#create-a-deployment)" and "[Create a deployment status](https://docs.github.com/rest/deployments/statuses#create-a-deployment-status)."
9726797291
*/
9726897292
"repos/delete-deployment": {
9726997293
parameters: {
@@ -104372,7 +104396,9 @@ export interface operations {
104372104396
"repos/create-using-template": {
104373104397
parameters: {
104374104398
path: {
104399+
/** @description The account owner of the template repository. The name is not case sensitive. */
104375104400
template_owner: string;
104401+
/** @description The name of the template repository without the `.git` extension. The name is not case sensitive. */
104376104402
template_repo: string;
104377104403
};
104378104404
};

0 commit comments

Comments
 (0)