Skip to content

Commit

Permalink
Fix extra quote generated in components/responses with $refs (#1324)
Browse files Browse the repository at this point in the history
* Fix extra quote generated in components/responses with $refs

* Use Vitest .toMatchFileSnapshot()

* Fix snapshots
  • Loading branch information
drwpow committed Aug 30, 2023
1 parent b661fa1 commit 0357325
Show file tree
Hide file tree
Showing 18 changed files with 1,221 additions and 308 deletions.
5 changes: 5 additions & 0 deletions .changeset/curvy-ants-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"openapi-typescript": patch
---

Fix accidental quote appearing in components/responses with $refs
2 changes: 1 addition & 1 deletion packages/openapi-typescript/examples/digital-ocean-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4964,7 +4964,7 @@ export interface external {
};
};
responses: {
204: external["shared/responses/no_content.yml"];
200: external["shared/responses/no_content.yml"];
401: external["shared/responses/unauthorized.yml"];
404: external["shared/responses/not_found.yml"];
429: external["shared/responses/too_many_requests.yml"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ introduction: |
* **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.
More rate limiting information is returned only within burst limit error response headers:
* **retry-after**: The number of seconds to wait before making another request when rate limited.
As long as the `ratelimit-remaining` count is above zero, you will be able
to make additional requests.
Expand All @@ -226,10 +229,14 @@ introduction: |
move an entire hour into the future.
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. `ratelimit-remaining` reaching zero
can also indicate that the 250 requests per minute limit was met, even if
the 5,000 requests per hour limit was not.
a 429 error code until the request reset has been reached.
`ratelimit-remaining` reaching zero can also indicate that the "burst limit" of 250
requests per minute limit was met, even if the 5,000 requests per hour limit was not.
In this case, the 429 error response will include a retry-after header to indicate how
long to wait (in seconds) until the request may be retried.
You can see the format of the response in the examples.
**Note:** The following endpoints have special rate limit requirements that
are independent of the limits defined above.
Expand All @@ -251,6 +258,17 @@ introduction: |
. . .
```
### Sample Rate Limit Headers When Burst Limit is Reached:
```
. . .
ratelimit-limit: 5000
ratelimit-remaining: 0
rateLimit-reset: 1402425459
retry-after: 29
. . .
```
### Sample Rate Exceeded Response
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ parameters:
- $ref: 'parameters.yml#/database_cluster_uuid'

responses:
'204':
'200':
$ref: '../../shared/responses/no_content.yml'

'401':
Expand Down
168 changes: 147 additions & 21 deletions packages/openapi-typescript/examples/github-api-next.ts

Large diffs are not rendered by default.

243 changes: 227 additions & 16 deletions packages/openapi-typescript/examples/github-api-next.yaml

Large diffs are not rendered by default.

48 changes: 37 additions & 11 deletions packages/openapi-typescript/examples/github-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3610,7 +3610,7 @@ export interface paths {
* Rerequest a check suite
* @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.
*
* 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.
* 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.
*/
post: operations["checks/rerequest-suite"];
};
Expand Down Expand Up @@ -4348,7 +4348,7 @@ export interface paths {
get: operations["repos/get-content"];
/**
* Create or update file contents
* @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.
* @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.
*
* **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.
*/
Expand Down Expand Up @@ -4531,7 +4531,7 @@ export interface paths {
* * Create a new deployment that is active so that the system has a record of the current state, then delete the previously active deployment.
* * Mark the active deployment as inactive by adding any non-successful deployment status.
*
* 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)."
* 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)."
*/
delete: operations["repos/delete-deployment"];
};
Expand Down Expand Up @@ -12253,7 +12253,7 @@ export interface components {
* @description The mode of assigning new seats.
* @enum {string}
*/
seat_management_setting: "assign_all" | "assign_selected" | "disabled";
seat_management_setting: "assign_all" | "assign_selected" | "disabled" | "unconfigured";
[key: string]: unknown;
};
/**
Expand Down Expand Up @@ -13202,7 +13202,7 @@ export interface components {
};
/**
* Organization ruleset conditions
* @description Conditions for an organization ruleset
* @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.
*/
"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"]);
/**
Expand Down Expand Up @@ -22975,6 +22975,26 @@ export interface components {
*/
push_protection_bypassed_at?: string | null;
};
/** branch protection configuration disabled event */
"webhook-branch-protection-configuration-disabled": {
/** @enum {string} */
action: "disabled";
enterprise?: components["schemas"]["enterprise"];
installation?: components["schemas"]["simple-installation"];
organization?: components["schemas"]["organization-simple"];
repository: components["schemas"]["repository"];
sender: components["schemas"]["simple-user"];
};
/** branch protection configuration enabled event */
"webhook-branch-protection-configuration-enabled": {
/** @enum {string} */
action: "enabled";
enterprise?: components["schemas"]["enterprise"];
installation?: components["schemas"]["simple-installation"];
organization?: components["schemas"]["organization-simple"];
repository: components["schemas"]["repository"];
sender: components["schemas"]["simple-user"];
};
/** branch protection rule created event */
"webhook-branch-protection-rule-created": {
/** @enum {string} */
Expand Down Expand Up @@ -81572,6 +81592,8 @@ export interface components {
"card-id": number;
/** @description The unique identifier of the column. */
"column-id": number;
/** @description The name field of an artifact. When specified, only artifacts with this name will be returned. */
"artifact-name"?: string;
/** @description The unique identifier of the artifact. */
"artifact-id": number;
/** @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`. */
Expand Down Expand Up @@ -90793,8 +90815,7 @@ export interface operations {
query?: {
per_page?: components["parameters"]["per-page"];
page?: components["parameters"]["page"];
/** @description Filters artifacts by exact match on their name field. */
name?: string;
name?: components["parameters"]["artifact-name"];
};
path: {
owner: components["parameters"]["owner"];
Expand Down Expand Up @@ -91899,6 +91920,7 @@ export interface operations {
query?: {
per_page?: components["parameters"]["per-page"];
page?: components["parameters"]["page"];
name?: components["parameters"]["artifact-name"];
};
path: {
owner: components["parameters"]["owner"];
Expand Down Expand Up @@ -94649,7 +94671,7 @@ export interface operations {
* Rerequest a check suite
* @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.
*
* 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.
* 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.
*/
"checks/rerequest-suite": {
parameters: {
Expand Down Expand Up @@ -95427,6 +95449,8 @@ export interface operations {
location?: string;
/** @description IP for location auto-detection when proxying a request */
client_ip?: string;
/** @description The branch or commit to check for prebuild availability and devcontainer restrictions. */
ref?: string;
};
path: {
owner: components["parameters"]["owner"];
Expand Down Expand Up @@ -96575,7 +96599,7 @@ export interface operations {
};
/**
* Create or update file contents
* @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.
* @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.
*
* **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.
*/
Expand Down Expand Up @@ -96718,7 +96742,7 @@ export interface operations {
};
};
responses: {
/** @description if repository contains content */
/** @description If repository contains content */
200: {
headers: {
Link: components["headers"]["link"];
Expand Down Expand Up @@ -97263,7 +97287,7 @@ export interface operations {
* * Create a new deployment that is active so that the system has a record of the current state, then delete the previously active deployment.
* * Mark the active deployment as inactive by adding any non-successful deployment status.
*
* 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)."
* 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)."
*/
"repos/delete-deployment": {
parameters: {
Expand Down Expand Up @@ -104372,7 +104396,9 @@ export interface operations {
"repos/create-using-template": {
parameters: {
path: {
/** @description The account owner of the template repository. The name is not case sensitive. */
template_owner: string;
/** @description The name of the template repository without the `.git` extension. The name is not case sensitive. */
template_repo: string;
};
};
Expand Down

0 comments on commit 0357325

Please sign in to comment.