From e39324ed848b620c5c93daa4dfe6229fe0845fbd Mon Sep 17 00:00:00 2001 From: Drew Powers Date: Wed, 30 Aug 2023 10:44:44 -0600 Subject: [PATCH 1/3] Fix extra quote generated in components/responses with $refs --- .changeset/curvy-ants-add.md | 5 + .../examples/digital-ocean-api.ts | 8 +- .../digital-ocean-api/description.yml | 26 +- .../databases/databases_patch_config.yml | 2 +- .../examples/github-api-next.ts | 182 +++++- .../examples/github-api-next.yaml | 243 +++++++- .../openapi-typescript/examples/github-api.ts | 62 +- .../examples/github-api.yaml | 242 +++++++- .../openapi-typescript/examples/stripe-api.ts | 138 +++-- .../examples/stripe-api.yaml | 577 +++++++++++++----- .../scripts/download-schemas.ts | 1 + .../scripts/update-examples.ts | 1 + .../src/transform/components-object.ts | 2 +- .../test/components-object.test.ts | 22 +- 14 files changed, 1223 insertions(+), 288 deletions(-) create mode 100644 .changeset/curvy-ants-add.md diff --git a/.changeset/curvy-ants-add.md b/.changeset/curvy-ants-add.md new file mode 100644 index 000000000..29e78994d --- /dev/null +++ b/.changeset/curvy-ants-add.md @@ -0,0 +1,5 @@ +--- +"openapi-typescript": patch +--- + +Fix accidental quote appearing in components/responses with $refs diff --git a/packages/openapi-typescript/examples/digital-ocean-api.ts b/packages/openapi-typescript/examples/digital-ocean-api.ts index 947a9aad5..e7f876169 100644 --- a/packages/openapi-typescript/examples/digital-ocean-api.ts +++ b/packages/openapi-typescript/examples/digital-ocean-api.ts @@ -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"]; @@ -5522,10 +5522,10 @@ export interface external { * "doadmin" * ] */ - db_names?: (readonly string[]) | null; + db_names?: readonly string[] | null; connection?: external["resources/databases/models/database_connection.yml"]; private_connection?: external["resources/databases/models/database_connection.yml"]; - users?: (readonly external["resources/databases/models/database_user.yml"][]) | null; + users?: readonly external["resources/databases/models/database_user.yml"][] | null; maintenance_window?: external["resources/databases/models/database_maintenance_window.yml"]; /** * Format: uuid @@ -15392,7 +15392,7 @@ export interface external { * @description An array containing the IDs of the Droplets the volume is attached to. Note that at this time, a volume can only be attached to a single Droplet. * @example [] */ - droplet_ids?: (readonly number[]) | null; + droplet_ids?: readonly number[] | null; /** * @description A human-readable name for the block storage volume. Must be lowercase and be composed only of numbers, letters and "-", up to a limit of 64 characters. The name must begin with a letter. * @example example diff --git a/packages/openapi-typescript/examples/digital-ocean-api/description.yml b/packages/openapi-typescript/examples/digital-ocean-api/description.yml index eb69dcbbc..72b46515f 100644 --- a/packages/openapi-typescript/examples/digital-ocean-api/description.yml +++ b/packages/openapi-typescript/examples/digital-ocean-api/description.yml @@ -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. @@ -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. @@ -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 ``` diff --git a/packages/openapi-typescript/examples/digital-ocean-api/resources/databases/databases_patch_config.yml b/packages/openapi-typescript/examples/digital-ocean-api/resources/databases/databases_patch_config.yml index 4bee6098c..212de2857 100644 --- a/packages/openapi-typescript/examples/digital-ocean-api/resources/databases/databases_patch_config.yml +++ b/packages/openapi-typescript/examples/digital-ocean-api/resources/databases/databases_patch_config.yml @@ -23,7 +23,7 @@ parameters: - $ref: 'parameters.yml#/database_cluster_uuid' responses: - '204': + '200': $ref: '../../shared/responses/no_content.yml' '401': diff --git a/packages/openapi-typescript/examples/github-api-next.ts b/packages/openapi-typescript/examples/github-api-next.ts index b56a99e87..9d5616967 100644 --- a/packages/openapi-typescript/examples/github-api-next.ts +++ b/packages/openapi-typescript/examples/github-api-next.ts @@ -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"]; }; @@ -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. */ @@ -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"]; }; @@ -8015,6 +8015,28 @@ export interface paths { } export interface webhooks { + "branch-protection-configuration-disabled": { + /** + * This event occurs when there is a change to branch protection configurations for a repository. + * For more information, see "[About protected branches](https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches)." + * For information about using the APIs to manage branch protection rules, see "[Branch protection rule](https://docs.github.com/graphql/reference/objects#branchprotectionrule)" in the GraphQL documentation or "[Branch protection](https://docs.github.com/rest/branches/branch-protection)" in the REST API documentation. + * + * To subscribe to this event, a GitHub App must have at least read-level access for the "Administration" repository permission. + * @description All branch protections were disabled for a repository. + */ + post: operations["branch-protection-configuration/disabled"]; + }; + "branch-protection-configuration-enabled": { + /** + * This event occurs when there is a change to branch protection configurations for a repository. + * For more information, see "[About protected branches](https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches)." + * For information about using the APIs to manage branch protection rules, see "[Branch protection rule](https://docs.github.com/graphql/reference/objects#branchprotectionrule)" in the GraphQL documentation or "[Branch protection](https://docs.github.com/rest/branches/branch-protection)" in the REST API documentation. + * + * To subscribe to this event, a GitHub App must have at least read-level access for the "Administration" repository permission. + * @description All branch protections were enabled for a repository. + */ + post: operations["branch-protection-configuration/enabled"]; + }; "branch-protection-rule-created": { /** * This event occurs when there is activity relating to branch protection rules. For more information, see "[About protected branches](https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches)." For information about the APIs to manage branch protection rules, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#branchprotectionrule) or "[Branch protection](https://docs.github.com/rest/branches/branch-protection)" in the REST API documentation. @@ -9453,7 +9475,7 @@ export interface webhooks { /** * This event occurs when there is activity relating to an organization-level project. For more information, see "[About Projects](https://docs.github.com/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)." For information about the Projects API, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#projectv2). * - * For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, project_card`, and `project_column` events instead. + * For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, `project_card`, and `project_column` events instead. * * To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. * @@ -9466,7 +9488,7 @@ export interface webhooks { /** * This event occurs when there is activity relating to an organization-level project. For more information, see "[About Projects](https://docs.github.com/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)." For information about the Projects API, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#projectv2). * - * For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, project_card`, and `project_column` events instead. + * For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, `project_card`, and `project_column` events instead. * * To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. * @@ -9479,7 +9501,7 @@ export interface webhooks { /** * This event occurs when there is activity relating to an organization-level project. For more information, see "[About Projects](https://docs.github.com/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)." For information about the Projects API, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#projectv2). * - * For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, project_card`, and `project_column` events instead. + * For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, `project_card`, and `project_column` events instead. * * To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. * @@ -9492,7 +9514,7 @@ export interface webhooks { /** * This event occurs when there is activity relating to an organization-level project. For more information, see "[About Projects](https://docs.github.com/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)." For information about the Projects API, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#projectv2). * - * For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, project_card`, and `project_column` events instead. + * For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, `project_card`, and `project_column` events instead. * * To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. * @@ -9596,7 +9618,7 @@ export interface webhooks { /** * This event occurs when there is activity relating to an organization-level project. For more information, see "[About Projects](https://docs.github.com/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)." For information about the Projects API, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#projectv2). * - * For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, project_card`, and `project_column` events instead. + * For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, `project_card`, and `project_column` events instead. * * To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. * @@ -10744,7 +10766,7 @@ export interface components { /** @description The package version that resolve the vulnerability. */ first_patched_version: string | null; /** @description The functions in the package that are affected by the vulnerability. */ - vulnerable_functions: (readonly string[]) | null; + vulnerable_functions: readonly string[] | null; })[]) | null; cvss: ({ /** @description The CVSS vector. */ @@ -10758,10 +10780,10 @@ export interface components { /** @description The name of the CWE. */ name: string; }[] | null; - credits: (readonly { + credits: readonly { user: components["schemas"]["simple-user"]; type: components["schemas"]["security-advisory-credit-types"]; - }[]) | null; + }[] | null; }; /** * Basic Error @@ -13514,7 +13536,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; }; /** @@ -14064,7 +14086,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"]); /** @@ -14434,12 +14456,12 @@ export interface components { /** @description The CVSS score. */ score: number | null; }) | null; - cwes: (readonly { + cwes: readonly { /** @description The Common Weakness Enumeration (CWE) identifier. */ cwe_id: string; /** @description The name of the CWE. */ name: string; - }[]) | null; + }[] | null; /** @description A list of only the CWE IDs. */ cwe_ids: string[] | null; credits: { @@ -14447,7 +14469,7 @@ export interface components { login?: string; type?: components["schemas"]["security-advisory-credit-types"]; }[] | null; - credits_detailed: (readonly components["schemas"]["repository-advisory-credit"][]) | null; + credits_detailed: readonly components["schemas"]["repository-advisory-credit"][] | null; /** @description A list of users that collaborate on the advisory. */ collaborating_users: components["schemas"]["simple-user"][] | null; /** @description A list of teams that collaborate on the advisory. */ @@ -16518,7 +16540,7 @@ export interface components { */ analyses_url?: string | null; /** @description Any errors that ocurred during processing of the delivery. */ - errors?: (readonly string[]) | null; + errors?: readonly string[] | null; }; /** * CODEOWNERS errors @@ -20850,6 +20872,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} */ @@ -79447,6 +79489,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/`. To reference a pull request use `refs/pull//merge`. */ @@ -88572,8 +88616,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"]; @@ -89678,6 +89721,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"]; @@ -92418,7 +92462,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: { @@ -93195,6 +93239,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"]; @@ -94343,7 +94389,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. */ @@ -94484,7 +94530,7 @@ export interface operations { }; }; responses: { - /** @description if repository contains content */ + /** @description If repository contains content */ 200: { headers: { Link: components["headers"]["link"]; @@ -95029,7 +95075,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: { @@ -102101,7 +102147,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; }; }; @@ -107446,6 +107494,84 @@ export interface operations { }; }; }; + /** + * This event occurs when there is a change to branch protection configurations for a repository. + * For more information, see "[About protected branches](https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches)." + * For information about using the APIs to manage branch protection rules, see "[Branch protection rule](https://docs.github.com/graphql/reference/objects#branchprotectionrule)" in the GraphQL documentation or "[Branch protection](https://docs.github.com/rest/branches/branch-protection)" in the REST API documentation. + * + * To subscribe to this event, a GitHub App must have at least read-level access for the "Administration" repository permission. + * @description All branch protections were disabled for a repository. + */ + "branch-protection-configuration/disabled": { + parameters: { + header?: { + /** @example GitHub-Hookshot/123abc */ + "User-Agent"?: string; + /** @example 12312312 */ + "X-Github-Hook-Id"?: string; + /** @example issues */ + "X-Github-Event"?: string; + /** @example 123123 */ + "X-Github-Hook-Installation-Target-Id"?: string; + /** @example repository */ + "X-Github-Hook-Installation-Target-Type"?: string; + /** @example 0b989ba4-242f-11e5-81e1-c7b6966d2516 */ + "X-GitHub-Delivery"?: string; + /** @example sha256=6dcb09b5b57875f334f61aebed695e2e4193db5e */ + "X-Hub-Signature-256"?: string; + }; + }; + requestBody: { + content: { + "application/json": components["schemas"]["webhook-branch-protection-configuration-disabled"]; + }; + }; + responses: { + /** @description Return a 200 status to indicate that the data was received successfully */ + 200: { + content: never; + }; + }; + }; + /** + * This event occurs when there is a change to branch protection configurations for a repository. + * For more information, see "[About protected branches](https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches)." + * For information about using the APIs to manage branch protection rules, see "[Branch protection rule](https://docs.github.com/graphql/reference/objects#branchprotectionrule)" in the GraphQL documentation or "[Branch protection](https://docs.github.com/rest/branches/branch-protection)" in the REST API documentation. + * + * To subscribe to this event, a GitHub App must have at least read-level access for the "Administration" repository permission. + * @description All branch protections were enabled for a repository. + */ + "branch-protection-configuration/enabled": { + parameters: { + header?: { + /** @example GitHub-Hookshot/123abc */ + "User-Agent"?: string; + /** @example 12312312 */ + "X-Github-Hook-Id"?: string; + /** @example issues */ + "X-Github-Event"?: string; + /** @example 123123 */ + "X-Github-Hook-Installation-Target-Id"?: string; + /** @example repository */ + "X-Github-Hook-Installation-Target-Type"?: string; + /** @example 0b989ba4-242f-11e5-81e1-c7b6966d2516 */ + "X-GitHub-Delivery"?: string; + /** @example sha256=6dcb09b5b57875f334f61aebed695e2e4193db5e */ + "X-Hub-Signature-256"?: string; + }; + }; + requestBody: { + content: { + "application/json": components["schemas"]["webhook-branch-protection-configuration-enabled"]; + }; + }; + responses: { + /** @description Return a 200 status to indicate that the data was received successfully */ + 200: { + content: never; + }; + }; + }; /** * This event occurs when there is activity relating to branch protection rules. For more information, see "[About protected branches](https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches)." For information about the APIs to manage branch protection rules, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#branchprotectionrule) or "[Branch protection](https://docs.github.com/rest/branches/branch-protection)" in the REST API documentation. * @@ -112584,7 +112710,7 @@ export interface operations { /** * This event occurs when there is activity relating to an organization-level project. For more information, see "[About Projects](https://docs.github.com/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)." For information about the Projects API, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#projectv2). * - * For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, project_card`, and `project_column` events instead. + * For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, `project_card`, and `project_column` events instead. * * To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. * @@ -112625,7 +112751,7 @@ export interface operations { /** * This event occurs when there is activity relating to an organization-level project. For more information, see "[About Projects](https://docs.github.com/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)." For information about the Projects API, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#projectv2). * - * For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, project_card`, and `project_column` events instead. + * For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, `project_card`, and `project_column` events instead. * * To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. * @@ -112666,7 +112792,7 @@ export interface operations { /** * This event occurs when there is activity relating to an organization-level project. For more information, see "[About Projects](https://docs.github.com/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)." For information about the Projects API, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#projectv2). * - * For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, project_card`, and `project_column` events instead. + * For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, `project_card`, and `project_column` events instead. * * To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. * @@ -112707,7 +112833,7 @@ export interface operations { /** * This event occurs when there is activity relating to an organization-level project. For more information, see "[About Projects](https://docs.github.com/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)." For information about the Projects API, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#projectv2). * - * For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, project_card`, and `project_column` events instead. + * For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, `project_card`, and `project_column` events instead. * * To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. * @@ -113035,7 +113161,7 @@ export interface operations { /** * This event occurs when there is activity relating to an organization-level project. For more information, see "[About Projects](https://docs.github.com/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)." For information about the Projects API, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#projectv2). * - * For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, project_card`, and `project_column` events instead. + * For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, `project_card`, and `project_column` events instead. * * To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. * diff --git a/packages/openapi-typescript/examples/github-api-next.yaml b/packages/openapi-typescript/examples/github-api-next.yaml index 1dd22dd31..51c192b81 100644 --- a/packages/openapi-typescript/examples/github-api-next.yaml +++ b/packages/openapi-typescript/examples/github-api-next.yaml @@ -10442,6 +10442,13 @@ paths: - refs/heads/master exclude: - refs/heads/dev* + repository_name: + include: + - important_repository + - another_important_repository + exclude: + - unimportant_repository + protected: true rules: - type: commit_author_email_pattern parameters: @@ -10568,6 +10575,13 @@ paths: - refs/heads/master exclude: - refs/heads/dev* + repository_name: + include: + - important_repository + - another_important_repository + exclude: + - unimportant_repository + protected: true rules: - type: commit_author_email_pattern parameters: @@ -13983,12 +13997,7 @@ paths: - "$ref": "#/components/parameters/repo" - "$ref": "#/components/parameters/per-page" - "$ref": "#/components/parameters/page" - - name: name - description: Filters artifacts by exact match on their name field. - in: query - required: false - schema: - type: string + - "$ref": "#/components/parameters/artifact-name" responses: '200': description: Response @@ -15533,6 +15542,7 @@ paths: - "$ref": "#/components/parameters/run-id" - "$ref": "#/components/parameters/per-page" - "$ref": "#/components/parameters/page" + - "$ref": "#/components/parameters/artifact-name" responses: '200': description: Response @@ -20104,7 +20114,7 @@ paths: 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. tags: - checks operationId: checks/rerequest-suite @@ -21286,6 +21296,14 @@ paths: in: query schema: type: string + - name: ref + description: The branch or commit to check for prebuild availability and devcontainer + restrictions. + in: query + schema: + type: string + examples: + - main responses: '200': description: Response @@ -22940,7 +22958,7 @@ paths: put: summary: 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. + 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. tags: @@ -23196,7 +23214,7 @@ paths: - "$ref": "#/components/parameters/page" responses: '200': - description: if repository contains content + description: If repository contains content content: application/json: schema: @@ -24025,7 +24043,7 @@ 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)." tags: - repos operationId: repos/delete-deployment @@ -35231,11 +35249,15 @@ paths: url: https://docs.github.com/rest/repos/repos#create-a-repository-using-a-template parameters: - name: template_owner + description: The account owner of the template repository. The name is not + case sensitive. in: path required: true schema: type: string - name: template_repo + description: The name of the template repository without the `.git` extension. + The name is not case sensitive. in: path required: true schema: @@ -43652,6 +43674,138 @@ paths: category: meta subcategory: meta webhooks: + branch-protection-configuration-disabled: + post: + summary: |- + This event occurs when there is a change to branch protection configurations for a repository. + For more information, see "[About protected branches](https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches)." + For information about using the APIs to manage branch protection rules, see "[Branch protection rule](https://docs.github.com/graphql/reference/objects#branchprotectionrule)" in the GraphQL documentation or "[Branch protection](https://docs.github.com/rest/branches/branch-protection)" in the REST API documentation. + + To subscribe to this event, a GitHub App must have at least read-level access for the "Administration" repository permission. + description: All branch protections were disabled for a repository. + operationId: branch-protection-configuration/disabled + externalDocs: + url: https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#branch-protection-configuration + parameters: + - name: User-Agent + in: header + example: GitHub-Hookshot/123abc + schema: + type: string + - name: X-Github-Hook-Id + in: header + example: 12312312 + schema: + type: string + - name: X-Github-Event + in: header + example: issues + schema: + type: string + - name: X-Github-Hook-Installation-Target-Id + in: header + example: 123123 + schema: + type: string + - name: X-Github-Hook-Installation-Target-Type + in: header + example: repository + schema: + type: string + - name: X-GitHub-Delivery + in: header + example: 0b989ba4-242f-11e5-81e1-c7b6966d2516 + schema: + type: string + - name: X-Hub-Signature-256 + in: header + example: sha256=6dcb09b5b57875f334f61aebed695e2e4193db5e + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + "$ref": "#/components/schemas/webhook-branch-protection-configuration-disabled" + responses: + '200': + description: Return a 200 status to indicate that the data was received + successfully + x-github: + githubCloudOnly: false + category: webhooks + subcategory: branch-protection-configuration + supported-webhook-types: + - repository + - organization + - app + branch-protection-configuration-enabled: + post: + summary: |- + This event occurs when there is a change to branch protection configurations for a repository. + For more information, see "[About protected branches](https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches)." + For information about using the APIs to manage branch protection rules, see "[Branch protection rule](https://docs.github.com/graphql/reference/objects#branchprotectionrule)" in the GraphQL documentation or "[Branch protection](https://docs.github.com/rest/branches/branch-protection)" in the REST API documentation. + + To subscribe to this event, a GitHub App must have at least read-level access for the "Administration" repository permission. + description: All branch protections were enabled for a repository. + operationId: branch-protection-configuration/enabled + externalDocs: + url: https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#branch-protection-configuration + parameters: + - name: User-Agent + in: header + example: GitHub-Hookshot/123abc + schema: + type: string + - name: X-Github-Hook-Id + in: header + example: 12312312 + schema: + type: string + - name: X-Github-Event + in: header + example: issues + schema: + type: string + - name: X-Github-Hook-Installation-Target-Id + in: header + example: 123123 + schema: + type: string + - name: X-Github-Hook-Installation-Target-Type + in: header + example: repository + schema: + type: string + - name: X-GitHub-Delivery + in: header + example: 0b989ba4-242f-11e5-81e1-c7b6966d2516 + schema: + type: string + - name: X-Hub-Signature-256 + in: header + example: sha256=6dcb09b5b57875f334f61aebed695e2e4193db5e + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + "$ref": "#/components/schemas/webhook-branch-protection-configuration-enabled" + responses: + '200': + description: Return a 200 status to indicate that the data was received + successfully + x-github: + githubCloudOnly: false + category: webhooks + subcategory: branch-protection-configuration + supported-webhook-types: + - repository + - organization + - app branch-protection-rule-created: post: summary: |- @@ -52433,7 +52587,7 @@ webhooks: summary: |- This event occurs when there is activity relating to an organization-level project. For more information, see "[About Projects](https://docs.github.com/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)." For information about the Projects API, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#projectv2). - For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, project_card`, and `project_column` events instead. + For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, `project_card`, and `project_column` events instead. To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. @@ -52500,7 +52654,7 @@ webhooks: summary: |- This event occurs when there is activity relating to an organization-level project. For more information, see "[About Projects](https://docs.github.com/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)." For information about the Projects API, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#projectv2). - For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, project_card`, and `project_column` events instead. + For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, `project_card`, and `project_column` events instead. To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. @@ -52567,7 +52721,7 @@ webhooks: summary: |- This event occurs when there is activity relating to an organization-level project. For more information, see "[About Projects](https://docs.github.com/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)." For information about the Projects API, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#projectv2). - For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, project_card`, and `project_column` events instead. + For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, `project_card`, and `project_column` events instead. To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. @@ -52634,7 +52788,7 @@ webhooks: summary: |- This event occurs when there is activity relating to an organization-level project. For more information, see "[About Projects](https://docs.github.com/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)." For information about the Projects API, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#projectv2). - For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, project_card`, and `project_column` events instead. + For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, `project_card`, and `project_column` events instead. To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. @@ -53177,7 +53331,7 @@ webhooks: summary: |- This event occurs when there is activity relating to an organization-level project. For more information, see "[About Projects](https://docs.github.com/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)." For information about the Projects API, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#projectv2). - For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, project_card`, and `project_column` events instead. + For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, `project_card`, and `project_column` events instead. To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. @@ -66271,6 +66425,7 @@ components: - assign_all - assign_selected - disabled + - unconfigured required: - seat_breakdown - public_code_suggestions @@ -67502,7 +67657,11 @@ components: org-ruleset-conditions: title: Organization ruleset conditions type: object - 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. + +' oneOf: - type: object title: repository_name_and_ref_name @@ -84328,6 +84487,50 @@ components: format: date-time description: 'The time that push protection was bypassed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.' + webhook-branch-protection-configuration-disabled: + title: branch protection configuration disabled event + type: object + properties: + action: + type: string + enum: + - disabled + enterprise: + "$ref": "#/components/schemas/enterprise" + installation: + "$ref": "#/components/schemas/simple-installation" + organization: + "$ref": "#/components/schemas/organization-simple" + repository: + "$ref": "#/components/schemas/repository" + sender: + "$ref": "#/components/schemas/simple-user" + required: + - action + - repository + - sender + webhook-branch-protection-configuration-enabled: + title: branch protection configuration enabled event + type: object + properties: + action: + type: string + enum: + - enabled + enterprise: + "$ref": "#/components/schemas/enterprise" + installation: + "$ref": "#/components/schemas/simple-installation" + organization: + "$ref": "#/components/schemas/organization-simple" + repository: + "$ref": "#/components/schemas/repository" + sender: + "$ref": "#/components/schemas/simple-user" + required: + - action + - repository + - sender webhook-branch-protection-rule-created: title: branch protection rule created event type: object @@ -231672,6 +231875,14 @@ components: required: true schema: type: integer + artifact-name: + name: name + description: The name field of an artifact. When specified, only artifacts with + this name will be returned. + in: query + required: false + schema: + type: string artifact-id: name: artifact_id description: The unique identifier of the artifact. diff --git a/packages/openapi-typescript/examples/github-api.ts b/packages/openapi-typescript/examples/github-api.ts index 936ff82cd..fe9443383 100644 --- a/packages/openapi-typescript/examples/github-api.ts +++ b/packages/openapi-typescript/examples/github-api.ts @@ -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"]; }; @@ -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. */ @@ -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"]; }; @@ -8251,7 +8251,7 @@ export interface components { /** @description The package version that resolve the vulnerability. */ first_patched_version: string | null; /** @description The functions in the package that are affected by the vulnerability. */ - vulnerable_functions: (readonly string[]) | null; + vulnerable_functions: readonly string[] | null; })[]) | null; cvss: ({ /** @description The CVSS vector. */ @@ -8265,10 +8265,10 @@ export interface components { /** @description The name of the CWE. */ name: string; }[] | null; - credits: (readonly { + credits: readonly { user: components["schemas"]["simple-user"]; type: components["schemas"]["security-advisory-credit-types"]; - }[]) | null; + }[] | null; }; /** * Basic Error @@ -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; }; /** @@ -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"]); /** @@ -13572,12 +13572,12 @@ export interface components { /** @description The CVSS score. */ score: number | null; }) | null; - cwes: (readonly { + cwes: readonly { /** @description The Common Weakness Enumeration (CWE) identifier. */ cwe_id: string; /** @description The name of the CWE. */ name: string; - }[]) | null; + }[] | null; /** @description A list of only the CWE IDs. */ cwe_ids: string[] | null; credits: { @@ -13585,7 +13585,7 @@ export interface components { login?: string; type?: components["schemas"]["security-advisory-credit-types"]; }[] | null; - credits_detailed: (readonly components["schemas"]["repository-advisory-credit"][]) | null; + credits_detailed: readonly components["schemas"]["repository-advisory-credit"][] | null; /** @description A list of users that collaborate on the advisory. */ collaborating_users: components["schemas"]["simple-user"][] | null; /** @description A list of teams that collaborate on the advisory. */ @@ -17232,7 +17232,7 @@ export interface components { */ analyses_url?: string | null; /** @description Any errors that ocurred during processing of the delivery. */ - errors?: (readonly string[]) | null; + errors?: readonly string[] | null; }; /** * CODEOWNERS errors @@ -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} */ @@ -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/`. To reference a pull request use `refs/pull//merge`. */ @@ -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"]; @@ -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"]; @@ -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: { @@ -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"]; @@ -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. */ @@ -96718,7 +96742,7 @@ export interface operations { }; }; responses: { - /** @description if repository contains content */ + /** @description If repository contains content */ 200: { headers: { Link: components["headers"]["link"]; @@ -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: { @@ -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; }; }; diff --git a/packages/openapi-typescript/examples/github-api.yaml b/packages/openapi-typescript/examples/github-api.yaml index 6c8882f25..c3b3c3ee4 100644 --- a/packages/openapi-typescript/examples/github-api.yaml +++ b/packages/openapi-typescript/examples/github-api.yaml @@ -10411,6 +10411,13 @@ paths: - refs/heads/master exclude: - refs/heads/dev* + repository_name: + include: + - important_repository + - another_important_repository + exclude: + - unimportant_repository + protected: true rules: - type: commit_author_email_pattern parameters: @@ -10537,6 +10544,13 @@ paths: - refs/heads/master exclude: - refs/heads/dev* + repository_name: + include: + - important_repository + - another_important_repository + exclude: + - unimportant_repository + protected: true rules: - type: commit_author_email_pattern parameters: @@ -13932,12 +13946,7 @@ paths: - "$ref": "#/components/parameters/repo" - "$ref": "#/components/parameters/per-page" - "$ref": "#/components/parameters/page" - - name: name - description: Filters artifacts by exact match on their name field. - in: query - required: false - schema: - type: string + - "$ref": "#/components/parameters/artifact-name" responses: '200': description: Response @@ -15481,6 +15490,7 @@ paths: - "$ref": "#/components/parameters/run-id" - "$ref": "#/components/parameters/per-page" - "$ref": "#/components/parameters/page" + - "$ref": "#/components/parameters/artifact-name" responses: '200': description: Response @@ -20042,7 +20052,7 @@ paths: 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. tags: - checks operationId: checks/rerequest-suite @@ -21220,6 +21230,13 @@ paths: in: query schema: type: string + - name: ref + description: The branch or commit to check for prebuild availability and devcontainer + restrictions. + in: query + schema: + type: string + example: main responses: '200': description: Response @@ -22871,7 +22888,7 @@ paths: put: summary: 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. + 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. tags: @@ -23125,7 +23142,7 @@ paths: - "$ref": "#/components/parameters/page" responses: '200': - description: if repository contains content + description: If repository contains content content: application/json: schema: @@ -23952,7 +23969,7 @@ 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)." tags: - repos operationId: repos/delete-deployment @@ -35105,11 +35122,15 @@ paths: url: https://docs.github.com/rest/repos/repos#create-a-repository-using-a-template parameters: - name: template_owner + description: The account owner of the template repository. The name is not + case sensitive. in: path required: true schema: type: string - name: template_repo + description: The name of the template repository without the `.git` extension. + The name is not case sensitive. in: path required: true schema: @@ -43484,6 +43505,138 @@ paths: category: meta subcategory: meta x-webhooks: + branch-protection-configuration-disabled: + post: + summary: |- + This event occurs when there is a change to branch protection configurations for a repository. + For more information, see "[About protected branches](https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches)." + For information about using the APIs to manage branch protection rules, see "[Branch protection rule](https://docs.github.com/graphql/reference/objects#branchprotectionrule)" in the GraphQL documentation or "[Branch protection](https://docs.github.com/rest/branches/branch-protection)" in the REST API documentation. + + To subscribe to this event, a GitHub App must have at least read-level access for the "Administration" repository permission. + description: All branch protections were disabled for a repository. + operationId: branch-protection-configuration/disabled + externalDocs: + url: https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#branch-protection-configuration + parameters: + - name: User-Agent + in: header + example: GitHub-Hookshot/123abc + schema: + type: string + - name: X-Github-Hook-Id + in: header + example: 12312312 + schema: + type: string + - name: X-Github-Event + in: header + example: issues + schema: + type: string + - name: X-Github-Hook-Installation-Target-Id + in: header + example: 123123 + schema: + type: string + - name: X-Github-Hook-Installation-Target-Type + in: header + example: repository + schema: + type: string + - name: X-GitHub-Delivery + in: header + example: 0b989ba4-242f-11e5-81e1-c7b6966d2516 + schema: + type: string + - name: X-Hub-Signature-256 + in: header + example: sha256=6dcb09b5b57875f334f61aebed695e2e4193db5e + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + "$ref": "#/components/schemas/webhook-branch-protection-configuration-disabled" + responses: + '200': + description: Return a 200 status to indicate that the data was received + successfully + x-github: + githubCloudOnly: false + category: webhooks + subcategory: branch-protection-configuration + supported-webhook-types: + - repository + - organization + - app + branch-protection-configuration-enabled: + post: + summary: |- + This event occurs when there is a change to branch protection configurations for a repository. + For more information, see "[About protected branches](https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches)." + For information about using the APIs to manage branch protection rules, see "[Branch protection rule](https://docs.github.com/graphql/reference/objects#branchprotectionrule)" in the GraphQL documentation or "[Branch protection](https://docs.github.com/rest/branches/branch-protection)" in the REST API documentation. + + To subscribe to this event, a GitHub App must have at least read-level access for the "Administration" repository permission. + description: All branch protections were enabled for a repository. + operationId: branch-protection-configuration/enabled + externalDocs: + url: https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#branch-protection-configuration + parameters: + - name: User-Agent + in: header + example: GitHub-Hookshot/123abc + schema: + type: string + - name: X-Github-Hook-Id + in: header + example: 12312312 + schema: + type: string + - name: X-Github-Event + in: header + example: issues + schema: + type: string + - name: X-Github-Hook-Installation-Target-Id + in: header + example: 123123 + schema: + type: string + - name: X-Github-Hook-Installation-Target-Type + in: header + example: repository + schema: + type: string + - name: X-GitHub-Delivery + in: header + example: 0b989ba4-242f-11e5-81e1-c7b6966d2516 + schema: + type: string + - name: X-Hub-Signature-256 + in: header + example: sha256=6dcb09b5b57875f334f61aebed695e2e4193db5e + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + "$ref": "#/components/schemas/webhook-branch-protection-configuration-enabled" + responses: + '200': + description: Return a 200 status to indicate that the data was received + successfully + x-github: + githubCloudOnly: false + category: webhooks + subcategory: branch-protection-configuration + supported-webhook-types: + - repository + - organization + - app branch-protection-rule-created: post: summary: |- @@ -52265,7 +52418,7 @@ x-webhooks: summary: |- This event occurs when there is activity relating to an organization-level project. For more information, see "[About Projects](https://docs.github.com/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)." For information about the Projects API, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#projectv2). - For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, project_card`, and `project_column` events instead. + For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, `project_card`, and `project_column` events instead. To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. @@ -52332,7 +52485,7 @@ x-webhooks: summary: |- This event occurs when there is activity relating to an organization-level project. For more information, see "[About Projects](https://docs.github.com/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)." For information about the Projects API, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#projectv2). - For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, project_card`, and `project_column` events instead. + For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, `project_card`, and `project_column` events instead. To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. @@ -52399,7 +52552,7 @@ x-webhooks: summary: |- This event occurs when there is activity relating to an organization-level project. For more information, see "[About Projects](https://docs.github.com/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)." For information about the Projects API, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#projectv2). - For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, project_card`, and `project_column` events instead. + For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, `project_card`, and `project_column` events instead. To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. @@ -52466,7 +52619,7 @@ x-webhooks: summary: |- This event occurs when there is activity relating to an organization-level project. For more information, see "[About Projects](https://docs.github.com/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)." For information about the Projects API, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#projectv2). - For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, project_card`, and `project_column` events instead. + For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, `project_card`, and `project_column` events instead. To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. @@ -53009,7 +53162,7 @@ x-webhooks: summary: |- This event occurs when there is activity relating to an organization-level project. For more information, see "[About Projects](https://docs.github.com/issues/planning-and-tracking-with-projects/learning-about-projects/about-projects)." For information about the Projects API, see [the GraphQL documentation](https://docs.github.com/graphql/reference/objects#projectv2). - For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, project_card`, and `project_column` events instead. + For activity relating to a item on a project, use the `projects_v2_item` event. For activity relating to Projects (classic), use the `project`, `project_card`, and `project_column` events instead. To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. @@ -65640,6 +65793,7 @@ components: - assign_all - assign_selected - disabled + - unconfigured required: - seat_breakdown - public_code_suggestions @@ -67088,7 +67242,11 @@ components: org-ruleset-conditions: title: Organization ruleset conditions type: object - 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. + +' oneOf: - type: object title: repository_name_and_ref_name @@ -83543,6 +83701,50 @@ components: description: 'The time that push protection was bypassed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.' nullable: true + webhook-branch-protection-configuration-disabled: + title: branch protection configuration disabled event + type: object + properties: + action: + type: string + enum: + - disabled + enterprise: + "$ref": "#/components/schemas/enterprise" + installation: + "$ref": "#/components/schemas/simple-installation" + organization: + "$ref": "#/components/schemas/organization-simple" + repository: + "$ref": "#/components/schemas/repository" + sender: + "$ref": "#/components/schemas/simple-user" + required: + - action + - repository + - sender + webhook-branch-protection-configuration-enabled: + title: branch protection configuration enabled event + type: object + properties: + action: + type: string + enum: + - enabled + enterprise: + "$ref": "#/components/schemas/enterprise" + installation: + "$ref": "#/components/schemas/simple-installation" + organization: + "$ref": "#/components/schemas/organization-simple" + repository: + "$ref": "#/components/schemas/repository" + sender: + "$ref": "#/components/schemas/simple-user" + required: + - action + - repository + - sender webhook-branch-protection-rule-created: title: branch protection rule created event type: object @@ -227585,6 +227787,14 @@ components: required: true schema: type: integer + artifact-name: + name: name + description: The name field of an artifact. When specified, only artifacts with + this name will be returned. + in: query + required: false + schema: + type: string artifact-id: name: artifact_id description: The unique identifier of the artifact. diff --git a/packages/openapi-typescript/examples/stripe-api.ts b/packages/openapi-typescript/examples/stripe-api.ts index 642031b88..dd5673f9c 100644 --- a/packages/openapi-typescript/examples/stripe-api.ts +++ b/packages/openapi-typescript/examples/stripe-api.ts @@ -2833,10 +2833,10 @@ export interface components { /** @description If the transaction's net funds are available in the Stripe balance yet. Either `available` or `pending`. */ status: string; /** - * @description Transaction type: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `payment`, `payment_failure_refund`, `payment_refund`, `payment_reversal`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. [Learn more](https://stripe.com/docs/reports/balance-transaction-types) about balance transaction types and what they represent. If you are looking to classify transactions for accounting purposes, you might want to consider `reporting_category` instead. + * @description Transaction type: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_inbound`, `obligation_outbound`, `obligation_reversal_inbound`, `obligation_reversal_outbound`, `obligation_payout`, `obligation_payout_failure`, `payment`, `payment_failure_refund`, `payment_refund`, `payment_reversal`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. [Learn more](https://stripe.com/docs/reports/balance-transaction-types) about balance transaction types and what they represent. If you are looking to classify transactions for accounting purposes, you might want to consider `reporting_category` instead. * @enum {string} */ - type: "adjustment" | "advance" | "advance_funding" | "anticipation_repayment" | "application_fee" | "application_fee_refund" | "charge" | "connect_collection_transfer" | "contribution" | "issuing_authorization_hold" | "issuing_authorization_release" | "issuing_dispute" | "issuing_transaction" | "payment" | "payment_failure_refund" | "payment_refund" | "payment_reversal" | "payout" | "payout_cancel" | "payout_failure" | "refund" | "refund_failure" | "reserve_transaction" | "reserved_funds" | "stripe_fee" | "stripe_fx_fee" | "tax_fee" | "topup" | "topup_reversal" | "transfer" | "transfer_cancel" | "transfer_failure" | "transfer_refund"; + type: "adjustment" | "advance" | "advance_funding" | "anticipation_repayment" | "application_fee" | "application_fee_refund" | "charge" | "connect_collection_transfer" | "contribution" | "issuing_authorization_hold" | "issuing_authorization_release" | "issuing_dispute" | "issuing_transaction" | "obligation_inbound" | "obligation_outbound" | "obligation_payout" | "obligation_payout_failure" | "obligation_reversal_inbound" | "obligation_reversal_outbound" | "payment" | "payment_failure_refund" | "payment_refund" | "payment_reversal" | "payout" | "payout_cancel" | "payout_failure" | "refund" | "refund_failure" | "reserve_transaction" | "reserved_funds" | "stripe_fee" | "stripe_fx_fee" | "tax_fee" | "topup" | "topup_reversal" | "transfer" | "transfer_cancel" | "transfer_failure" | "transfer_refund"; }; /** * BankAccount @@ -2871,7 +2871,7 @@ export interface components { default_for_currency?: boolean | null; /** @description Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. */ fingerprint?: string | null; - /** @description Information about upcoming new requirements for the bank account, including what information needs to be collected. */ + /** @description Information about the [upcoming new requirements for the bank account](https://stripe.com/docs/connect/custom-accounts/future-requirements), including what information needs to be collected, and by when. */ future_requirements?: components["schemas"]["external_account_requirements"] | null; /** @description Unique identifier for the object. */ id: string; @@ -3188,7 +3188,7 @@ export interface components { /** * @description Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number. * - * *Starting May 1, 2021, card fingerprint in India for Connect will change to allow two fingerprints for the same card --- one for India and one for the rest of the world.* + * *As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.* */ fingerprint?: string | null; /** @description Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. */ @@ -3462,7 +3462,7 @@ export interface components { custom_text: components["schemas"]["payment_pages_checkout_session_custom_text"]; /** * @description The ID of the customer for this Session. - * For Checkout Sessions in `payment` or `subscription` mode, Checkout + * For Checkout Sessions in `subscription` mode or Checkout Sessions with `customer_creation` set as `always` in `payment` mode, Checkout * will create a new customer object based on information provided * during the payment flow unless an existing customer was provided when * the Session was created. @@ -5684,6 +5684,8 @@ export interface components { object: "financial_connections.session"; /** @description Permissions requested for accounts collected during this session. */ permissions: ("balances" | "ownership" | "payment_method" | "transactions")[]; + /** @description Data features requested to be retrieved upon account creation. */ + prefetch?: (("balances" | "ownership")[]) | null; /** @description For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app. */ return_url?: string; }; @@ -6257,7 +6259,15 @@ export interface components { auto_advance?: boolean; automatic_tax: components["schemas"]["automatic_tax"]; /** - * @description Indicates the reason why the invoice was created. `subscription_cycle` indicates an invoice created by a subscription advancing into a new period. `subscription_create` indicates an invoice created due to creating a subscription. `subscription_update` indicates an invoice created due to updating a subscription. `subscription` is set for all old invoices to indicate either a change to a subscription or a period advancement. `manual` is set for all invoices unrelated to a subscription (for example: created via the invoice editor). The `upcoming` value is reserved for simulated invoices per the upcoming invoice endpoint. `subscription_threshold` indicates an invoice created due to a billing threshold being reached. + * @description Indicates the reason why the invoice was created. + * + * * `manual`: Unrelated to a subscription, for example, created via the invoice editor. + * * `subscription`: No longer in use. Applies to subscriptions from before May 2018 where no distinction was made between updates, cycles, and thresholds. + * * `subscription_create`: A new subscription was created. + * * `subscription_cycle`: A subscription advanced into a new period. + * * `subscription_threshold`: A subscription reached a billing threshold. + * * `subscription_update`: A subscription was updated. + * * `upcoming`: Reserved for simulated invoices, per the upcoming invoice endpoint. * @enum {string|null} */ billing_reason?: "automatic_pending_invoice_item_invoice" | "manual" | "quote_accept" | "subscription" | "subscription_create" | "subscription_cycle" | "subscription_threshold" | "subscription_update" | "upcoming" | null; @@ -6552,6 +6562,8 @@ export interface components { invoice_payment_method_options_us_bank_account_linked_account_options: { /** @description The list of permissions to request. The `payment_method` permission must be included. */ permissions?: ("balances" | "payment_method" | "transactions")[]; + /** @description Data features requested to be retrieved upon account creation. */ + prefetch?: "balances"[] | null; }; /** InvoiceSettingCustomField */ invoice_setting_custom_field: { @@ -6571,11 +6583,6 @@ export interface components { /** @description Default options for invoice PDF rendering for this customer. */ rendering_options?: components["schemas"]["invoice_setting_rendering_options"] | null; }; - /** InvoiceSettingPhaseSetting */ - invoice_setting_phase_setting: { - /** @description Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `billing=charge_automatically`. */ - days_until_due?: number | null; - }; /** InvoiceSettingQuoteSetting */ invoice_setting_quote_setting: { /** @description Number of days within which a customer must pay invoices generated by this quote. This value will be `null` for quotes where `collection_method=charge_automatically`. */ @@ -6586,6 +6593,11 @@ export interface components { /** @description How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. */ amount_tax_display?: string | null; }; + /** InvoiceSettingSubscriptionSchedulePhaseSetting */ + invoice_setting_subscription_schedule_phase_setting: { + /** @description Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `billing=charge_automatically`. */ + days_until_due?: number | null; + }; /** InvoiceSettingSubscriptionScheduleSetting */ invoice_setting_subscription_schedule_setting: { /** @description Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `billing=charge_automatically`. */ @@ -7900,6 +7912,8 @@ export interface components { linked_account_options_us_bank_account: { /** @description The list of permissions to request. The `payment_method` permission must be included. */ permissions?: ("balances" | "ownership" | "payment_method" | "transactions")[]; + /** @description Data features requested to be retrieved upon account creation. */ + prefetch?: "balances"[] | null; /** @description For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app. */ return_url?: string; }; @@ -8340,7 +8354,7 @@ export interface components { status: "canceled" | "processing" | "requires_action" | "requires_capture" | "requires_confirmation" | "requires_payment_method" | "succeeded"; /** @description The data with which to automatically create a Transfer when the payment is finalized. See the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts) for details. */ transfer_data?: components["schemas"]["transfer_data"] | null; - /** @description A string that identifies the resulting payment as part of a group. See the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts) for details. */ + /** @description A string that identifies the resulting payment as part of a group. See the PaymentIntents [use case for connected accounts](https://stripe.com/docs/connect/separate-charges-and-transfers) for details. */ transfer_group?: string | null; }; /** PaymentIntentCardProcessing */ @@ -8843,6 +8857,8 @@ export interface components { after_completion: components["schemas"]["payment_links_resource_after_completion"]; /** @description Whether user redeemable promotion codes are enabled. */ allow_promotion_codes: boolean; + /** @description The ID of the Connect application that created the Payment Link. */ + application?: (string | components["schemas"]["application"] | components["schemas"]["deleted_application"]) | null; /** @description The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. */ application_fee_amount?: number | null; /** @description This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. */ @@ -9233,7 +9249,7 @@ export interface components { /** * @description Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number. * - * *Starting May 1, 2021, card fingerprint in India for Connect will change to allow two fingerprints for the same card --- one for India and one for the rest of the world.* + * *As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.* */ fingerprint?: string | null; /** @description Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. */ @@ -9282,7 +9298,7 @@ export interface components { /** * @description Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number. * - * *Starting May 1, 2021, card fingerprint in India for Connect will change to allow two fingerprints for the same card --- one for India and one for the rest of the world.* + * *As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.* */ fingerprint?: string | null; /** @description Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. */ @@ -9532,7 +9548,7 @@ export interface components { /** * @description Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number. * - * *Starting May 1, 2021, card fingerprint in India for Connect will change to allow two fingerprints for the same card --- one for India and one for the rest of the world.* + * *As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.* */ fingerprint?: string | null; /** @description Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. */ @@ -9615,7 +9631,7 @@ export interface components { /** * @description Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number. * - * *Starting May 1, 2021, card fingerprint in India for Connect will change to allow two fingerprints for the same card --- one for India and one for the rest of the world.* + * *As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.* */ fingerprint?: string | null; /** @description Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. */ @@ -9805,7 +9821,7 @@ export interface components { /** * @description Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number. * - * *Starting May 1, 2021, card fingerprint in India for Connect will change to allow two fingerprints for the same card --- one for India and one for the rest of the world.* + * *As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.* */ fingerprint?: string | null; /** @description Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. */ @@ -10071,7 +10087,7 @@ export interface components { /** * @description Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number. * - * *Starting May 1, 2021, card fingerprint in India for Connect will change to allow two fingerprints for the same card --- one for India and one for the rest of the world.* + * *As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.* */ fingerprint?: string | null; /** @description Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. */ @@ -10932,7 +10948,7 @@ export interface components { metadata?: { [key: string]: string; } | null; - /** @description The method used to send this payout, which can be `standard` or `instant`. `instant` is only supported for payouts to debit cards. (See [Instant payouts for marketplaces](https://stripe.com/blog/instant-payouts-for-marketplaces) for more information.) */ + /** @description The method used to send this payout, which can be `standard` or `instant`. `instant` is supported for payouts to debit cards and bank accounts in certain countries. (See [Bank support for Instant Payouts](https://stripe.com/docs/payouts/instant-payouts-banks) for more information.) */ method: string; /** * @description String representing the object's type. Objects of the same type share the same value. @@ -11250,6 +11266,11 @@ export interface components { /** @description The URL the customer will be redirected to after the flow is completed. */ return_url: string; }; + /** PortalFlowsCouponOffer */ + portal_flows_coupon_offer: { + /** @description The ID of the coupon to be offered. */ + coupon: string; + }; /** PortalFlowsFlow */ portal_flows_flow: { after_completion: components["schemas"]["portal_flows_flow_after_completion"]; @@ -11279,6 +11300,8 @@ export interface components { }; /** PortalFlowsFlowSubscriptionCancel */ portal_flows_flow_subscription_cancel: { + /** @description Specify a retention strategy to be used in the cancellation flow. */ + retention?: components["schemas"]["portal_flows_retention"] | null; /** @description The ID of the subscription to be canceled. */ subscription: string; }; @@ -11296,6 +11319,16 @@ export interface components { /** @description The ID of the subscription to be updated. */ subscription: string; }; + /** PortalFlowsRetention */ + portal_flows_retention: { + /** @description Configuration when `retention.type=coupon_offer`. */ + coupon_offer?: components["schemas"]["portal_flows_coupon_offer"] | null; + /** + * @description Type of retention strategy that will be used. + * @enum {string} + */ + type: "coupon_offer"; + }; /** PortalFlowsSubscriptionUpdateConfirmDiscount */ portal_flows_subscription_update_confirm_discount: { /** @description The ID of the coupon to apply to this subscription update. */ @@ -12422,7 +12455,7 @@ export interface components { /** * @description Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number. * - * *Starting May 1, 2021, card fingerprint in India for Connect will change to allow two fingerprints for the same card --- one for India and one for the rest of the world.* + * *As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.* */ fingerprint?: string | null; /** @description Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. */ @@ -13757,7 +13790,7 @@ export interface components { */ end_date: number; /** @description The invoice settings applicable during this phase. */ - invoice_settings?: components["schemas"]["invoice_setting_phase_setting"] | null; + invoice_settings?: components["schemas"]["invoice_setting_subscription_schedule_phase_setting"] | null; /** @description Subscription items to configure the subscription to during this phase of the subscription schedule. */ items: components["schemas"]["subscription_schedule_configuration_item"][]; /** @description Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a phase. Metadata on a schedule's phase will update the underlying subscription's `metadata` when the phase is entered. Updating the underlying subscription's `metadata` directly will not affect the current phase's `metadata`. */ @@ -19536,7 +19569,7 @@ export interface operations { source?: string; /** @description A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. */ starting_after?: string; - /** @description Only returns transactions of the given type. One of: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `payment`, `payment_failure_refund`, `payment_refund`, `payment_reversal`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. */ + /** @description Only returns transactions of the given type. One of: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_inbound`, `obligation_outbound`, `obligation_reversal_inbound`, `obligation_reversal_outbound`, `obligation_payout`, `obligation_payout_failure`, `payment`, `payment_failure_refund`, `payment_refund`, `payment_reversal`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. */ type?: string; }; }; @@ -19634,7 +19667,7 @@ export interface operations { source?: string; /** @description A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. */ starting_after?: string; - /** @description Only returns transactions of the given type. One of: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `payment`, `payment_failure_refund`, `payment_refund`, `payment_reversal`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. */ + /** @description Only returns transactions of the given type. One of: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_inbound`, `obligation_outbound`, `obligation_reversal_inbound`, `obligation_reversal_outbound`, `obligation_payout`, `obligation_payout_failure`, `payment`, `payment_failure_refund`, `payment_refund`, `payment_reversal`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. */ type?: string; }; }; @@ -20010,6 +20043,15 @@ export interface operations { }; /** flow_data_subscription_cancel_param */ subscription_cancel?: { + /** retention_param */ + retention?: { + /** coupon_offer_param */ + coupon_offer: { + coupon: string; + }; + /** @enum {string} */ + type: "coupon_offer"; + }; subscription: string; }; /** flow_data_subscription_update_param */ @@ -20946,7 +20988,7 @@ export interface operations { * If the Customer already has a valid [email](https://stripe.com/docs/api/customers/object#customer_object-email) set, the email will be prefilled and not editable in Checkout. * If the Customer does not have a valid `email`, Checkout will set the email entered during the session on the Customer. * - * If blank for Checkout Sessions in `payment` or `subscription` mode, Checkout will create a new Customer object based on information provided during the payment flow. + * If blank for Checkout Sessions in `subscription` mode or with `customer_creation` set as `always` in `payment` mode, Checkout will create a new Customer object based on information provided during the payment flow. * * You can set [`payment_intent_data.setup_future_usage`](https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-setup_future_usage) to have Checkout automatically attach the payment method to the Customer you pass in for future reuse. */ @@ -21311,6 +21353,7 @@ export interface operations { /** linked_account_options_param */ financial_connections?: { permissions?: ("balances" | "ownership" | "payment_method" | "transactions")[]; + prefetch?: "balances"[]; }; /** @enum {string} */ setup_future_usage?: "none" | "off_session" | "on_session"; @@ -21368,7 +21411,7 @@ export interface operations { shipping_address_collection?: { allowed_countries: ("AC" | "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AQ" | "AR" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BR" | "BS" | "BT" | "BV" | "BW" | "BY" | "BZ" | "CA" | "CD" | "CF" | "CG" | "CH" | "CI" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CV" | "CW" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FO" | "FR" | "GA" | "GB" | "GD" | "GE" | "GF" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GP" | "GQ" | "GR" | "GS" | "GT" | "GU" | "GW" | "GY" | "HK" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MF" | "MG" | "MK" | "ML" | "MM" | "MN" | "MO" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NC" | "NE" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PM" | "PN" | "PR" | "PS" | "PT" | "PY" | "QA" | "RE" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SE" | "SG" | "SH" | "SI" | "SJ" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SZ" | "TA" | "TC" | "TD" | "TF" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "US" | "UY" | "UZ" | "VA" | "VC" | "VE" | "VG" | "VN" | "VU" | "WF" | "WS" | "XK" | "YE" | "YT" | "ZA" | "ZM" | "ZW" | "ZZ")[]; }; - /** @description The shipping rate options to apply to this Session. */ + /** @description The shipping rate options to apply to this Session. Up to a maximum of 5. */ shipping_options?: ({ shipping_rate?: string; /** method_params */ @@ -24371,6 +24414,7 @@ export interface operations { /** invoice_linked_account_options_param */ financial_connections?: { permissions?: ("balances" | "ownership" | "payment_method" | "transactions")[]; + prefetch?: "balances"[]; }; /** @enum {string} */ verification_method?: "automatic" | "instant" | "microdeposits"; @@ -24648,6 +24692,7 @@ export interface operations { /** invoice_linked_account_options_param */ financial_connections?: { permissions?: ("balances" | "ownership" | "payment_method" | "transactions")[]; + prefetch?: "balances"[]; }; /** @enum {string} */ verification_method?: "automatic" | "instant" | "microdeposits"; @@ -25898,6 +25943,8 @@ export interface operations { * Possible values are `balances`, `transactions`, `ownership`, and `payment_method`. */ permissions: ("balances" | "ownership" | "payment_method" | "transactions")[]; + /** @description List of data features that you would like to retrieve upon account creation. */ + prefetch?: ("balances" | "ownership")[]; /** @description For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app. */ return_url?: string; }; @@ -26807,6 +26854,7 @@ export interface operations { /** invoice_linked_account_options_param */ financial_connections?: { permissions?: ("balances" | "ownership" | "payment_method" | "transactions")[]; + prefetch?: "balances"[]; }; /** @enum {string} */ verification_method?: "automatic" | "instant" | "microdeposits"; @@ -27499,6 +27547,7 @@ export interface operations { /** invoice_linked_account_options_param */ financial_connections?: { permissions?: ("balances" | "ownership" | "payment_method" | "transactions")[]; + prefetch?: "balances"[]; }; /** @enum {string} */ verification_method?: "automatic" | "instant" | "microdeposits"; @@ -29215,6 +29264,8 @@ export interface operations { * Possible values are `balances`, `transactions`, `ownership`, and `payment_method`. */ permissions: ("balances" | "ownership" | "payment_method" | "transactions")[]; + /** @description List of data features that you would like to retrieve upon account creation. */ + prefetch?: ("balances" | "ownership")[]; /** @description For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app. */ return_url?: string; }; @@ -29604,11 +29655,8 @@ export interface operations { expand?: string[]; /** @description ID of the mandate to be used for this payment. This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). */ mandate?: string; - /** - * secret_key_param - * @description This hash contains details about the Mandate to create. This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). - */ - mandate_data?: { + /** @description This hash contains details about the Mandate to create. This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). */ + mandate_data?: ({ /** customer_acceptance_param */ customer_acceptance: { /** Format: unix-time */ @@ -29623,7 +29671,7 @@ export interface operations { /** @enum {string} */ type: "offline" | "online"; }; - }; + }) | ""; /** @description Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. */ metadata?: { [key: string]: string; @@ -29995,6 +30043,7 @@ export interface operations { /** linked_account_options_param */ financial_connections?: { permissions?: ("balances" | "ownership" | "payment_method" | "transactions")[]; + prefetch?: "balances"[]; return_url?: string; }; /** networks_options_param */ @@ -30074,7 +30123,7 @@ export interface operations { amount?: number; destination: string; }; - /** @description A string that identifies the resulting payment as part of a group. See the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts) for details. */ + /** @description A string that identifies the resulting payment as part of a group. See the PaymentIntents [use case for connected accounts](https://stripe.com/docs/connect/separate-charges-and-transfers) for details. */ transfer_group?: string; /** @description Set to `true` when confirming server-side and using Stripe.js, iOS, or Android client-side SDKs to handle the next actions. */ use_stripe_sdk?: boolean; @@ -30590,6 +30639,7 @@ export interface operations { /** linked_account_options_param */ financial_connections?: { permissions?: ("balances" | "ownership" | "payment_method" | "transactions")[]; + prefetch?: "balances"[]; return_url?: string; }; /** networks_options_param */ @@ -30879,7 +30929,7 @@ export interface operations { /** @enum {string} */ type: "offline" | "online"; }; - }) | { + }) | "" | { /** customer_acceptance_param */ customer_acceptance: { /** online_param */ @@ -31252,6 +31302,7 @@ export interface operations { /** linked_account_options_param */ financial_connections?: { permissions?: ("balances" | "ownership" | "payment_method" | "transactions")[]; + prefetch?: "balances"[]; return_url?: string; }; /** networks_options_param */ @@ -32559,7 +32610,7 @@ export interface operations { [key: string]: string; }; /** - * @description The method used to send this payout, which can be `standard` or `instant`. `instant` is only supported for payouts to debit cards. (See [Instant payouts for marketplaces for more information](https://stripe.com/blog/instant-payouts-for-marketplaces).) + * @description The method used to send this payout, which can be `standard` or `instant`. `instant` is supported for payouts to debit cards and bank accounts in certain countries. (See [Bank support for Instant Payouts](https://stripe.com/docs/payouts/instant-payouts-banks) for more information.) * @enum {string} */ method?: "instant" | "standard"; @@ -35128,7 +35179,7 @@ export interface operations { interval_start?: number; payout?: string; /** @enum {string} */ - reporting_category?: "advance" | "advance_funding" | "anticipation_repayment" | "charge" | "charge_failure" | "connect_collection_transfer" | "connect_reserved_funds" | "contribution" | "dispute" | "dispute_reversal" | "fee" | "financing_paydown" | "financing_paydown_reversal" | "financing_payout" | "financing_payout_reversal" | "issuing_authorization_hold" | "issuing_authorization_release" | "issuing_dispute" | "issuing_transaction" | "network_cost" | "other_adjustment" | "partial_capture_reversal" | "payout" | "payout_reversal" | "platform_earning" | "platform_earning_refund" | "refund" | "refund_failure" | "risk_reserved_funds" | "tax" | "topup" | "topup_reversal" | "transfer" | "transfer_reversal"; + reporting_category?: "advance" | "advance_funding" | "anticipation_repayment" | "charge" | "charge_failure" | "connect_collection_transfer" | "connect_reserved_funds" | "contribution" | "dispute" | "dispute_reversal" | "fee" | "financing_paydown" | "financing_paydown_reversal" | "financing_payout" | "financing_payout_reversal" | "issuing_authorization_hold" | "issuing_authorization_release" | "issuing_dispute" | "issuing_transaction" | "network_cost" | "obligation" | "other_adjustment" | "partial_capture_reversal" | "payout" | "payout_reversal" | "platform_earning" | "platform_earning_refund" | "refund" | "refund_failure" | "risk_reserved_funds" | "tax" | "topup" | "topup_reversal" | "transfer" | "transfer_reversal"; /** @enum {string} */ timezone?: "Africa/Abidjan" | "Africa/Accra" | "Africa/Addis_Ababa" | "Africa/Algiers" | "Africa/Asmara" | "Africa/Asmera" | "Africa/Bamako" | "Africa/Bangui" | "Africa/Banjul" | "Africa/Bissau" | "Africa/Blantyre" | "Africa/Brazzaville" | "Africa/Bujumbura" | "Africa/Cairo" | "Africa/Casablanca" | "Africa/Ceuta" | "Africa/Conakry" | "Africa/Dakar" | "Africa/Dar_es_Salaam" | "Africa/Djibouti" | "Africa/Douala" | "Africa/El_Aaiun" | "Africa/Freetown" | "Africa/Gaborone" | "Africa/Harare" | "Africa/Johannesburg" | "Africa/Juba" | "Africa/Kampala" | "Africa/Khartoum" | "Africa/Kigali" | "Africa/Kinshasa" | "Africa/Lagos" | "Africa/Libreville" | "Africa/Lome" | "Africa/Luanda" | "Africa/Lubumbashi" | "Africa/Lusaka" | "Africa/Malabo" | "Africa/Maputo" | "Africa/Maseru" | "Africa/Mbabane" | "Africa/Mogadishu" | "Africa/Monrovia" | "Africa/Nairobi" | "Africa/Ndjamena" | "Africa/Niamey" | "Africa/Nouakchott" | "Africa/Ouagadougou" | "Africa/Porto-Novo" | "Africa/Sao_Tome" | "Africa/Timbuktu" | "Africa/Tripoli" | "Africa/Tunis" | "Africa/Windhoek" | "America/Adak" | "America/Anchorage" | "America/Anguilla" | "America/Antigua" | "America/Araguaina" | "America/Argentina/Buenos_Aires" | "America/Argentina/Catamarca" | "America/Argentina/ComodRivadavia" | "America/Argentina/Cordoba" | "America/Argentina/Jujuy" | "America/Argentina/La_Rioja" | "America/Argentina/Mendoza" | "America/Argentina/Rio_Gallegos" | "America/Argentina/Salta" | "America/Argentina/San_Juan" | "America/Argentina/San_Luis" | "America/Argentina/Tucuman" | "America/Argentina/Ushuaia" | "America/Aruba" | "America/Asuncion" | "America/Atikokan" | "America/Atka" | "America/Bahia" | "America/Bahia_Banderas" | "America/Barbados" | "America/Belem" | "America/Belize" | "America/Blanc-Sablon" | "America/Boa_Vista" | "America/Bogota" | "America/Boise" | "America/Buenos_Aires" | "America/Cambridge_Bay" | "America/Campo_Grande" | "America/Cancun" | "America/Caracas" | "America/Catamarca" | "America/Cayenne" | "America/Cayman" | "America/Chicago" | "America/Chihuahua" | "America/Ciudad_Juarez" | "America/Coral_Harbour" | "America/Cordoba" | "America/Costa_Rica" | "America/Creston" | "America/Cuiaba" | "America/Curacao" | "America/Danmarkshavn" | "America/Dawson" | "America/Dawson_Creek" | "America/Denver" | "America/Detroit" | "America/Dominica" | "America/Edmonton" | "America/Eirunepe" | "America/El_Salvador" | "America/Ensenada" | "America/Fort_Nelson" | "America/Fort_Wayne" | "America/Fortaleza" | "America/Glace_Bay" | "America/Godthab" | "America/Goose_Bay" | "America/Grand_Turk" | "America/Grenada" | "America/Guadeloupe" | "America/Guatemala" | "America/Guayaquil" | "America/Guyana" | "America/Halifax" | "America/Havana" | "America/Hermosillo" | "America/Indiana/Indianapolis" | "America/Indiana/Knox" | "America/Indiana/Marengo" | "America/Indiana/Petersburg" | "America/Indiana/Tell_City" | "America/Indiana/Vevay" | "America/Indiana/Vincennes" | "America/Indiana/Winamac" | "America/Indianapolis" | "America/Inuvik" | "America/Iqaluit" | "America/Jamaica" | "America/Jujuy" | "America/Juneau" | "America/Kentucky/Louisville" | "America/Kentucky/Monticello" | "America/Knox_IN" | "America/Kralendijk" | "America/La_Paz" | "America/Lima" | "America/Los_Angeles" | "America/Louisville" | "America/Lower_Princes" | "America/Maceio" | "America/Managua" | "America/Manaus" | "America/Marigot" | "America/Martinique" | "America/Matamoros" | "America/Mazatlan" | "America/Mendoza" | "America/Menominee" | "America/Merida" | "America/Metlakatla" | "America/Mexico_City" | "America/Miquelon" | "America/Moncton" | "America/Monterrey" | "America/Montevideo" | "America/Montreal" | "America/Montserrat" | "America/Nassau" | "America/New_York" | "America/Nipigon" | "America/Nome" | "America/Noronha" | "America/North_Dakota/Beulah" | "America/North_Dakota/Center" | "America/North_Dakota/New_Salem" | "America/Nuuk" | "America/Ojinaga" | "America/Panama" | "America/Pangnirtung" | "America/Paramaribo" | "America/Phoenix" | "America/Port-au-Prince" | "America/Port_of_Spain" | "America/Porto_Acre" | "America/Porto_Velho" | "America/Puerto_Rico" | "America/Punta_Arenas" | "America/Rainy_River" | "America/Rankin_Inlet" | "America/Recife" | "America/Regina" | "America/Resolute" | "America/Rio_Branco" | "America/Rosario" | "America/Santa_Isabel" | "America/Santarem" | "America/Santiago" | "America/Santo_Domingo" | "America/Sao_Paulo" | "America/Scoresbysund" | "America/Shiprock" | "America/Sitka" | "America/St_Barthelemy" | "America/St_Johns" | "America/St_Kitts" | "America/St_Lucia" | "America/St_Thomas" | "America/St_Vincent" | "America/Swift_Current" | "America/Tegucigalpa" | "America/Thule" | "America/Thunder_Bay" | "America/Tijuana" | "America/Toronto" | "America/Tortola" | "America/Vancouver" | "America/Virgin" | "America/Whitehorse" | "America/Winnipeg" | "America/Yakutat" | "America/Yellowknife" | "Antarctica/Casey" | "Antarctica/Davis" | "Antarctica/DumontDUrville" | "Antarctica/Macquarie" | "Antarctica/Mawson" | "Antarctica/McMurdo" | "Antarctica/Palmer" | "Antarctica/Rothera" | "Antarctica/South_Pole" | "Antarctica/Syowa" | "Antarctica/Troll" | "Antarctica/Vostok" | "Arctic/Longyearbyen" | "Asia/Aden" | "Asia/Almaty" | "Asia/Amman" | "Asia/Anadyr" | "Asia/Aqtau" | "Asia/Aqtobe" | "Asia/Ashgabat" | "Asia/Ashkhabad" | "Asia/Atyrau" | "Asia/Baghdad" | "Asia/Bahrain" | "Asia/Baku" | "Asia/Bangkok" | "Asia/Barnaul" | "Asia/Beirut" | "Asia/Bishkek" | "Asia/Brunei" | "Asia/Calcutta" | "Asia/Chita" | "Asia/Choibalsan" | "Asia/Chongqing" | "Asia/Chungking" | "Asia/Colombo" | "Asia/Dacca" | "Asia/Damascus" | "Asia/Dhaka" | "Asia/Dili" | "Asia/Dubai" | "Asia/Dushanbe" | "Asia/Famagusta" | "Asia/Gaza" | "Asia/Harbin" | "Asia/Hebron" | "Asia/Ho_Chi_Minh" | "Asia/Hong_Kong" | "Asia/Hovd" | "Asia/Irkutsk" | "Asia/Istanbul" | "Asia/Jakarta" | "Asia/Jayapura" | "Asia/Jerusalem" | "Asia/Kabul" | "Asia/Kamchatka" | "Asia/Karachi" | "Asia/Kashgar" | "Asia/Kathmandu" | "Asia/Katmandu" | "Asia/Khandyga" | "Asia/Kolkata" | "Asia/Krasnoyarsk" | "Asia/Kuala_Lumpur" | "Asia/Kuching" | "Asia/Kuwait" | "Asia/Macao" | "Asia/Macau" | "Asia/Magadan" | "Asia/Makassar" | "Asia/Manila" | "Asia/Muscat" | "Asia/Nicosia" | "Asia/Novokuznetsk" | "Asia/Novosibirsk" | "Asia/Omsk" | "Asia/Oral" | "Asia/Phnom_Penh" | "Asia/Pontianak" | "Asia/Pyongyang" | "Asia/Qatar" | "Asia/Qostanay" | "Asia/Qyzylorda" | "Asia/Rangoon" | "Asia/Riyadh" | "Asia/Saigon" | "Asia/Sakhalin" | "Asia/Samarkand" | "Asia/Seoul" | "Asia/Shanghai" | "Asia/Singapore" | "Asia/Srednekolymsk" | "Asia/Taipei" | "Asia/Tashkent" | "Asia/Tbilisi" | "Asia/Tehran" | "Asia/Tel_Aviv" | "Asia/Thimbu" | "Asia/Thimphu" | "Asia/Tokyo" | "Asia/Tomsk" | "Asia/Ujung_Pandang" | "Asia/Ulaanbaatar" | "Asia/Ulan_Bator" | "Asia/Urumqi" | "Asia/Ust-Nera" | "Asia/Vientiane" | "Asia/Vladivostok" | "Asia/Yakutsk" | "Asia/Yangon" | "Asia/Yekaterinburg" | "Asia/Yerevan" | "Atlantic/Azores" | "Atlantic/Bermuda" | "Atlantic/Canary" | "Atlantic/Cape_Verde" | "Atlantic/Faeroe" | "Atlantic/Faroe" | "Atlantic/Jan_Mayen" | "Atlantic/Madeira" | "Atlantic/Reykjavik" | "Atlantic/South_Georgia" | "Atlantic/St_Helena" | "Atlantic/Stanley" | "Australia/ACT" | "Australia/Adelaide" | "Australia/Brisbane" | "Australia/Broken_Hill" | "Australia/Canberra" | "Australia/Currie" | "Australia/Darwin" | "Australia/Eucla" | "Australia/Hobart" | "Australia/LHI" | "Australia/Lindeman" | "Australia/Lord_Howe" | "Australia/Melbourne" | "Australia/NSW" | "Australia/North" | "Australia/Perth" | "Australia/Queensland" | "Australia/South" | "Australia/Sydney" | "Australia/Tasmania" | "Australia/Victoria" | "Australia/West" | "Australia/Yancowinna" | "Brazil/Acre" | "Brazil/DeNoronha" | "Brazil/East" | "Brazil/West" | "CET" | "CST6CDT" | "Canada/Atlantic" | "Canada/Central" | "Canada/Eastern" | "Canada/Mountain" | "Canada/Newfoundland" | "Canada/Pacific" | "Canada/Saskatchewan" | "Canada/Yukon" | "Chile/Continental" | "Chile/EasterIsland" | "Cuba" | "EET" | "EST" | "EST5EDT" | "Egypt" | "Eire" | "Etc/GMT" | "Etc/GMT+0" | "Etc/GMT+1" | "Etc/GMT+10" | "Etc/GMT+11" | "Etc/GMT+12" | "Etc/GMT+2" | "Etc/GMT+3" | "Etc/GMT+4" | "Etc/GMT+5" | "Etc/GMT+6" | "Etc/GMT+7" | "Etc/GMT+8" | "Etc/GMT+9" | "Etc/GMT-0" | "Etc/GMT-1" | "Etc/GMT-10" | "Etc/GMT-11" | "Etc/GMT-12" | "Etc/GMT-13" | "Etc/GMT-14" | "Etc/GMT-2" | "Etc/GMT-3" | "Etc/GMT-4" | "Etc/GMT-5" | "Etc/GMT-6" | "Etc/GMT-7" | "Etc/GMT-8" | "Etc/GMT-9" | "Etc/GMT0" | "Etc/Greenwich" | "Etc/UCT" | "Etc/UTC" | "Etc/Universal" | "Etc/Zulu" | "Europe/Amsterdam" | "Europe/Andorra" | "Europe/Astrakhan" | "Europe/Athens" | "Europe/Belfast" | "Europe/Belgrade" | "Europe/Berlin" | "Europe/Bratislava" | "Europe/Brussels" | "Europe/Bucharest" | "Europe/Budapest" | "Europe/Busingen" | "Europe/Chisinau" | "Europe/Copenhagen" | "Europe/Dublin" | "Europe/Gibraltar" | "Europe/Guernsey" | "Europe/Helsinki" | "Europe/Isle_of_Man" | "Europe/Istanbul" | "Europe/Jersey" | "Europe/Kaliningrad" | "Europe/Kiev" | "Europe/Kirov" | "Europe/Kyiv" | "Europe/Lisbon" | "Europe/Ljubljana" | "Europe/London" | "Europe/Luxembourg" | "Europe/Madrid" | "Europe/Malta" | "Europe/Mariehamn" | "Europe/Minsk" | "Europe/Monaco" | "Europe/Moscow" | "Europe/Nicosia" | "Europe/Oslo" | "Europe/Paris" | "Europe/Podgorica" | "Europe/Prague" | "Europe/Riga" | "Europe/Rome" | "Europe/Samara" | "Europe/San_Marino" | "Europe/Sarajevo" | "Europe/Saratov" | "Europe/Simferopol" | "Europe/Skopje" | "Europe/Sofia" | "Europe/Stockholm" | "Europe/Tallinn" | "Europe/Tirane" | "Europe/Tiraspol" | "Europe/Ulyanovsk" | "Europe/Uzhgorod" | "Europe/Vaduz" | "Europe/Vatican" | "Europe/Vienna" | "Europe/Vilnius" | "Europe/Volgograd" | "Europe/Warsaw" | "Europe/Zagreb" | "Europe/Zaporozhye" | "Europe/Zurich" | "Factory" | "GB" | "GB-Eire" | "GMT" | "GMT+0" | "GMT-0" | "GMT0" | "Greenwich" | "HST" | "Hongkong" | "Iceland" | "Indian/Antananarivo" | "Indian/Chagos" | "Indian/Christmas" | "Indian/Cocos" | "Indian/Comoro" | "Indian/Kerguelen" | "Indian/Mahe" | "Indian/Maldives" | "Indian/Mauritius" | "Indian/Mayotte" | "Indian/Reunion" | "Iran" | "Israel" | "Jamaica" | "Japan" | "Kwajalein" | "Libya" | "MET" | "MST" | "MST7MDT" | "Mexico/BajaNorte" | "Mexico/BajaSur" | "Mexico/General" | "NZ" | "NZ-CHAT" | "Navajo" | "PRC" | "PST8PDT" | "Pacific/Apia" | "Pacific/Auckland" | "Pacific/Bougainville" | "Pacific/Chatham" | "Pacific/Chuuk" | "Pacific/Easter" | "Pacific/Efate" | "Pacific/Enderbury" | "Pacific/Fakaofo" | "Pacific/Fiji" | "Pacific/Funafuti" | "Pacific/Galapagos" | "Pacific/Gambier" | "Pacific/Guadalcanal" | "Pacific/Guam" | "Pacific/Honolulu" | "Pacific/Johnston" | "Pacific/Kanton" | "Pacific/Kiritimati" | "Pacific/Kosrae" | "Pacific/Kwajalein" | "Pacific/Majuro" | "Pacific/Marquesas" | "Pacific/Midway" | "Pacific/Nauru" | "Pacific/Niue" | "Pacific/Norfolk" | "Pacific/Noumea" | "Pacific/Pago_Pago" | "Pacific/Palau" | "Pacific/Pitcairn" | "Pacific/Pohnpei" | "Pacific/Ponape" | "Pacific/Port_Moresby" | "Pacific/Rarotonga" | "Pacific/Saipan" | "Pacific/Samoa" | "Pacific/Tahiti" | "Pacific/Tarawa" | "Pacific/Tongatapu" | "Pacific/Truk" | "Pacific/Wake" | "Pacific/Wallis" | "Pacific/Yap" | "Poland" | "Portugal" | "ROC" | "ROK" | "Singapore" | "Turkey" | "UCT" | "US/Alaska" | "US/Aleutian" | "US/Arizona" | "US/Central" | "US/East-Indiana" | "US/Eastern" | "US/Hawaii" | "US/Indiana-Starke" | "US/Michigan" | "US/Mountain" | "US/Pacific" | "US/Pacific-New" | "US/Samoa" | "UTC" | "Universal" | "W-SU" | "WET" | "Zulu"; }; @@ -35531,11 +35582,8 @@ export interface operations { * Include `inbound` if you intend to use the payment method as the origin to pull funds from. Include `outbound` if you intend to use the payment method as the destination to send funds to. You can include both if you intend to use the payment method for both purposes. */ flow_directions?: ("inbound" | "outbound")[]; - /** - * secret_key_param - * @description This hash contains details about the Mandate to create. This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/setup_intents/create#create_setup_intent-confirm). - */ - mandate_data?: { + /** @description This hash contains details about the Mandate to create. This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/setup_intents/create#create_setup_intent-confirm). */ + mandate_data?: ({ /** customer_acceptance_param */ customer_acceptance: { /** Format: unix-time */ @@ -35550,7 +35598,7 @@ export interface operations { /** @enum {string} */ type: "offline" | "online"; }; - }; + }) | ""; /** @description Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. */ metadata?: { [key: string]: string; @@ -35757,6 +35805,7 @@ export interface operations { /** linked_account_options_param */ financial_connections?: { permissions?: ("balances" | "ownership" | "payment_method" | "transactions")[]; + prefetch?: "balances"[]; return_url?: string; }; /** networks_options_param */ @@ -36079,6 +36128,7 @@ export interface operations { /** linked_account_options_param */ financial_connections?: { permissions?: ("balances" | "ownership" | "payment_method" | "transactions")[]; + prefetch?: "balances"[]; return_url?: string; }; /** networks_options_param */ @@ -36193,7 +36243,7 @@ export interface operations { /** @enum {string} */ type: "offline" | "online"; }; - }) | { + }) | "" | { /** customer_acceptance_param */ customer_acceptance: { /** online_param */ @@ -36405,6 +36455,7 @@ export interface operations { /** linked_account_options_param */ financial_connections?: { permissions?: ("balances" | "ownership" | "payment_method" | "transactions")[]; + prefetch?: "balances"[]; return_url?: string; }; /** networks_options_param */ @@ -38345,6 +38396,7 @@ export interface operations { /** invoice_linked_account_options_param */ financial_connections?: { permissions?: ("balances" | "ownership" | "payment_method" | "transactions")[]; + prefetch?: "balances"[]; }; /** @enum {string} */ verification_method?: "automatic" | "instant" | "microdeposits"; @@ -38675,6 +38727,7 @@ export interface operations { /** invoice_linked_account_options_param */ financial_connections?: { permissions?: ("balances" | "ownership" | "payment_method" | "transactions")[]; + prefetch?: "balances"[]; }; /** @enum {string} */ verification_method?: "automatic" | "instant" | "microdeposits"; @@ -41448,6 +41501,7 @@ export interface operations { currency?: string; routing_number?: string; }; + /** @description The card this token will represent. If you also pass in a customer, the card must be the ID of a card belonging to the customer. Otherwise, if you do not pass in a customer, this is a dictionary containing a user's credit card details, with the options described below. */ card?: { address_city?: string; address_country?: string; diff --git a/packages/openapi-typescript/examples/stripe-api.yaml b/packages/openapi-typescript/examples/stripe-api.yaml index 116812562..0e375320b 100644 --- a/packages/openapi-typescript/examples/stripe-api.yaml +++ b/packages/openapi-typescript/examples/stripe-api.yaml @@ -2176,12 +2176,15 @@ components: `application_fee_refund`, `charge`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, - `issuing_transaction`, `payment`, `payment_failure_refund`, - `payment_refund`, `payment_reversal`, `payout`, `payout_cancel`, - `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, - `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, - `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, - or `transfer_refund`. [Learn + `issuing_transaction`, `obligation_inbound`, `obligation_outbound`, + `obligation_reversal_inbound`, `obligation_reversal_outbound`, + `obligation_payout`, `obligation_payout_failure`, `payment`, + `payment_failure_refund`, `payment_refund`, `payment_reversal`, + `payout`, `payout_cancel`, `payout_failure`, `refund`, + `refund_failure`, `reserve_transaction`, `reserved_funds`, + `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, + `transfer`, `transfer_cancel`, `transfer_failure`, or + `transfer_refund`. [Learn more](https://stripe.com/docs/reports/balance-transaction-types) about balance transaction types and what they represent. If you are looking to classify transactions for accounting purposes, you might @@ -2200,6 +2203,12 @@ components: - issuing_authorization_release - issuing_dispute - issuing_transaction + - obligation_inbound + - obligation_outbound + - obligation_payout + - obligation_payout_failure + - obligation_reversal_inbound + - obligation_reversal_outbound - payment - payment_failure_refund - payment_refund @@ -2347,8 +2356,9 @@ components: anyOf: - $ref: '#/components/schemas/external_account_requirements' description: >- - Information about upcoming new requirements for the bank account, - including what information needs to be collected. + Information about the [upcoming new requirements for the bank + account](https://stripe.com/docs/connect/custom-accounts/future-requirements), + including what information needs to be collected, and by when. nullable: true id: description: Unique identifier for the object. @@ -3178,9 +3188,9 @@ components: number. - *Starting May 1, 2021, card fingerprint in India for Connect will - change to allow two fingerprints for the same card --- one for India - and one for the rest of the world.* + *As of May 1, 2021, card fingerprint in India for Connect changed to + allow two fingerprints for the same card---one for India and one for + the rest of the world.* maxLength: 5000 nullable: true type: string @@ -4028,7 +4038,8 @@ components: description: >- The ID of the customer for this Session. - For Checkout Sessions in `payment` or `subscription` mode, Checkout + For Checkout Sessions in `subscription` mode or Checkout Sessions + with `customer_creation` set as `always` in `payment` mode, Checkout will create a new customer object based on information provided @@ -9527,6 +9538,16 @@ components: type: string x-stripeBypassValidation: true type: array + prefetch: + description: Data features requested to be retrieved upon account creation. + items: + enum: + - balances + - ownership + type: string + x-stripeBypassValidation: true + nullable: true + type: array return_url: description: >- For webview integrations only. Upon completing OAuth login in the @@ -10842,17 +10863,26 @@ components: billing_reason: description: >- Indicates the reason why the invoice was created. - `subscription_cycle` indicates an invoice created by a subscription - advancing into a new period. `subscription_create` indicates an - invoice created due to creating a subscription. - `subscription_update` indicates an invoice created due to updating a - subscription. `subscription` is set for all old invoices to indicate - either a change to a subscription or a period advancement. `manual` - is set for all invoices unrelated to a subscription (for example: - created via the invoice editor). The `upcoming` value is reserved - for simulated invoices per the upcoming invoice endpoint. - `subscription_threshold` indicates an invoice created due to a - billing threshold being reached. + + + * `manual`: Unrelated to a subscription, for example, created via + the invoice editor. + + * `subscription`: No longer in use. Applies to subscriptions from + before May 2018 where no distinction was made between updates, + cycles, and thresholds. + + * `subscription_create`: A new subscription was created. + + * `subscription_cycle`: A subscription advanced into a new period. + + * `subscription_threshold`: A subscription reached a billing + threshold. + + * `subscription_update`: A subscription was updated. + + * `upcoming`: Reserved for simulated invoices, per the upcoming + invoice endpoint. enum: - automatic_pending_invoice_item_invoice - manual @@ -11731,6 +11761,15 @@ components: type: string x-stripeBypassValidation: true type: array + prefetch: + description: Data features requested to be retrieved upon account creation. + items: + enum: + - balances + type: string + x-stripeBypassValidation: true + nullable: true + type: array title: invoice_payment_method_options_us_bank_account_linked_account_options type: object x-expandableFields: [] @@ -11789,19 +11828,6 @@ components: - custom_fields - default_payment_method - rendering_options - invoice_setting_phase_setting: - description: '' - properties: - days_until_due: - description: >- - Number of days within which a customer must pay invoices generated - by this subscription schedule. This value will be `null` for - subscription schedules where `billing=charge_automatically`. - nullable: true - type: integer - title: InvoiceSettingPhaseSetting - type: object - x-expandableFields: [] invoice_setting_quote_setting: description: '' properties: @@ -11828,6 +11854,19 @@ components: title: InvoiceSettingRenderingOptions type: object x-expandableFields: [] + invoice_setting_subscription_schedule_phase_setting: + description: '' + properties: + days_until_due: + description: >- + Number of days within which a customer must pay invoices generated + by this subscription schedule. This value will be `null` for + subscription schedules where `billing=charge_automatically`. + nullable: true + type: integer + title: InvoiceSettingSubscriptionSchedulePhaseSetting + type: object + x-expandableFields: [] invoice_setting_subscription_schedule_setting: description: '' properties: @@ -17361,6 +17400,15 @@ components: - transactions type: string type: array + prefetch: + description: Data features requested to be retrieved upon account creation. + items: + enum: + - balances + type: string + x-stripeBypassValidation: true + nullable: true + type: array return_url: description: >- For webview integrations only. Upon completing OAuth login in the @@ -18471,8 +18519,8 @@ components: description: >- A string that identifies the resulting payment as part of a group. See the PaymentIntents [use case for connected - accounts](https://stripe.com/docs/payments/connected-accounts) for - details. + accounts](https://stripe.com/docs/connect/separate-charges-and-transfers) + for details. maxLength: 5000 nullable: true type: string @@ -19847,6 +19895,18 @@ components: allow_promotion_codes: description: Whether user redeemable promotion codes are enabled. type: boolean + application: + anyOf: + - maxLength: 5000 + type: string + - $ref: '#/components/schemas/application' + - $ref: '#/components/schemas/deleted_application' + description: The ID of the Connect application that created the Payment Link. + nullable: true + x-expansionResources: + oneOf: + - $ref: '#/components/schemas/application' + - $ref: '#/components/schemas/deleted_application' application_fee_amount: description: >- The amount of the application fee (if any) that will be requested to @@ -20094,6 +20154,7 @@ components: type: object x-expandableFields: - after_completion + - application - automatic_tax - consent_collection - custom_fields @@ -21189,9 +21250,9 @@ components: number. - *Starting May 1, 2021, card fingerprint in India for Connect will - change to allow two fingerprints for the same card --- one for India - and one for the rest of the world.* + *As of May 1, 2021, card fingerprint in India for Connect changed to + allow two fingerprints for the same card---one for India and one for + the rest of the world.* maxLength: 5000 nullable: true type: string @@ -21350,9 +21411,9 @@ components: number. - *Starting May 1, 2021, card fingerprint in India for Connect will - change to allow two fingerprints for the same card --- one for India - and one for the rest of the world.* + *As of May 1, 2021, card fingerprint in India for Connect changed to + allow two fingerprints for the same card---one for India and one for + the rest of the world.* maxLength: 5000 nullable: true type: string @@ -22055,9 +22116,9 @@ components: number. - *Starting May 1, 2021, card fingerprint in India for Connect will - change to allow two fingerprints for the same card --- one for India - and one for the rest of the world.* + *As of May 1, 2021, card fingerprint in India for Connect changed to + allow two fingerprints for the same card---one for India and one for + the rest of the world.* maxLength: 5000 nullable: true type: string @@ -22269,9 +22330,9 @@ components: number. - *Starting May 1, 2021, card fingerprint in India for Connect will - change to allow two fingerprints for the same card --- one for India - and one for the rest of the world.* + *As of May 1, 2021, card fingerprint in India for Connect changed to + allow two fingerprints for the same card---one for India and one for + the rest of the world.* maxLength: 5000 nullable: true type: string @@ -22886,9 +22947,9 @@ components: number. - *Starting May 1, 2021, card fingerprint in India for Connect will - change to allow two fingerprints for the same card --- one for India - and one for the rest of the world.* + *As of May 1, 2021, card fingerprint in India for Connect changed to + allow two fingerprints for the same card---one for India and one for + the rest of the world.* maxLength: 5000 nullable: true type: string @@ -23659,9 +23720,9 @@ components: number. - *Starting May 1, 2021, card fingerprint in India for Connect will - change to allow two fingerprints for the same card --- one for India - and one for the rest of the world.* + *As of May 1, 2021, card fingerprint in India for Connect changed to + allow two fingerprints for the same card---one for India and one for + the rest of the world.* maxLength: 5000 nullable: true type: string @@ -26148,10 +26209,10 @@ components: method: description: >- The method used to send this payout, which can be `standard` or - `instant`. `instant` is only supported for payouts to debit cards. - (See [Instant payouts for - marketplaces](https://stripe.com/blog/instant-payouts-for-marketplaces) - for more information.) + `instant`. `instant` is supported for payouts to debit cards and + bank accounts in certain countries. (See [Bank support for Instant + Payouts](https://stripe.com/docs/payouts/instant-payouts-banks) for + more information.) maxLength: 5000 type: string object: @@ -27034,6 +27095,18 @@ components: title: PortalFlowsAfterCompletionRedirect type: object x-expandableFields: [] + portal_flows_coupon_offer: + description: '' + properties: + coupon: + description: The ID of the coupon to be offered. + maxLength: 5000 + type: string + required: + - coupon + title: PortalFlowsCouponOffer + type: object + x-expandableFields: [] portal_flows_flow: description: '' properties: @@ -27104,6 +27177,11 @@ components: portal_flows_flow_subscription_cancel: description: '' properties: + retention: + anyOf: + - $ref: '#/components/schemas/portal_flows_retention' + description: Specify a retention strategy to be used in the cancellation flow. + nullable: true subscription: description: The ID of the subscription to be canceled. maxLength: 5000 @@ -27112,7 +27190,8 @@ components: - subscription title: PortalFlowsFlowSubscriptionCancel type: object - x-expandableFields: [] + x-expandableFields: + - retention portal_flows_flow_subscription_update: description: '' properties: @@ -27158,6 +27237,25 @@ components: x-expandableFields: - discounts - items + portal_flows_retention: + description: '' + properties: + coupon_offer: + anyOf: + - $ref: '#/components/schemas/portal_flows_coupon_offer' + description: Configuration when `retention.type=coupon_offer`. + nullable: true + type: + description: Type of retention strategy that will be used. + enum: + - coupon_offer + type: string + required: + - type + title: PortalFlowsRetention + type: object + x-expandableFields: + - coupon_offer portal_flows_subscription_update_confirm_discount: description: '' properties: @@ -30059,9 +30157,9 @@ components: number. - *Starting May 1, 2021, card fingerprint in India for Connect will - change to allow two fingerprints for the same card --- one for India - and one for the rest of the world.* + *As of May 1, 2021, card fingerprint in India for Connect changed to + allow two fingerprints for the same card---one for India and one for + the rest of the world.* maxLength: 5000 nullable: true type: string @@ -33651,7 +33749,8 @@ components: type: integer invoice_settings: anyOf: - - $ref: '#/components/schemas/invoice_setting_phase_setting' + - $ref: >- + #/components/schemas/invoice_setting_subscription_schedule_phase_setting description: The invoice settings applicable during this phase. nullable: true items: @@ -40093,7 +40192,6 @@ paths: - '' type: string url: - maxLength: 5000 type: string title: business_profile_specs type: object @@ -41260,7 +41358,6 @@ paths: - '' type: string url: - maxLength: 5000 type: string title: business_profile_specs type: object @@ -46702,13 +46799,15 @@ paths: `application_fee`, `application_fee_refund`, `charge`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, - `issuing_dispute`, `issuing_transaction`, `payment`, - `payment_failure_refund`, `payment_refund`, `payment_reversal`, - `payout`, `payout_cancel`, `payout_failure`, `refund`, - `refund_failure`, `reserve_transaction`, `reserved_funds`, - `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, - `transfer`, `transfer_cancel`, `transfer_failure`, or - `transfer_refund`. + `issuing_dispute`, `issuing_transaction`, `obligation_inbound`, + `obligation_outbound`, `obligation_reversal_inbound`, + `obligation_reversal_outbound`, `obligation_payout`, + `obligation_payout_failure`, `payment`, `payment_failure_refund`, + `payment_refund`, `payment_reversal`, `payout`, `payout_cancel`, + `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, + `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, + `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, + or `transfer_refund`. in: query name: type required: false @@ -46932,13 +47031,15 @@ paths: `application_fee`, `application_fee_refund`, `charge`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, - `issuing_dispute`, `issuing_transaction`, `payment`, - `payment_failure_refund`, `payment_refund`, `payment_reversal`, - `payout`, `payout_cancel`, `payout_failure`, `refund`, - `refund_failure`, `reserve_transaction`, `reserved_funds`, - `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, - `transfer`, `transfer_cancel`, `transfer_failure`, or - `transfer_refund`. + `issuing_dispute`, `issuing_transaction`, `obligation_inbound`, + `obligation_outbound`, `obligation_reversal_inbound`, + `obligation_reversal_outbound`, `obligation_payout`, + `obligation_payout_failure`, `payment`, `payment_failure_refund`, + `payment_refund`, `payment_reversal`, `payout`, `payout_cancel`, + `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, + `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, + `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, + or `transfer_refund`. in: query name: type required: false @@ -47804,6 +47905,26 @@ paths: type: object subscription_cancel: properties: + retention: + properties: + coupon_offer: + properties: + coupon: + maxLength: 5000 + type: string + required: + - coupon + title: coupon_offer_param + type: object + type: + enum: + - coupon_offer + type: string + required: + - coupon_offer + - type + title: retention_param + type: object subscription: maxLength: 5000 type: string @@ -49996,10 +50117,10 @@ paths: set the email entered during the session on the Customer. - If blank for Checkout Sessions in `payment` or - `subscription` mode, Checkout will create a new Customer - object based on information provided during the payment - flow. + If blank for Checkout Sessions in `subscription` mode or + with `customer_creation` set as `always` in `payment` mode, + Checkout will create a new Customer object based on + information provided during the payment flow. You can set @@ -50839,6 +50960,13 @@ paths: type: string x-stripeBypassValidation: true type: array + prefetch: + items: + enum: + - balances + type: string + x-stripeBypassValidation: true + type: array title: linked_account_options_param type: object setup_future_usage: @@ -51226,7 +51354,9 @@ paths: title: shipping_address_collection_params type: object shipping_options: - description: The shipping rate options to apply to this Session. + description: >- + The shipping rate options to apply to this Session. Up to a + maximum of 5. items: properties: shipping_rate: @@ -57944,6 +58074,13 @@ paths: type: string x-stripeBypassValidation: true type: array + prefetch: + items: + enum: + - balances + type: string + x-stripeBypassValidation: true + type: array title: invoice_linked_account_options_param type: object verification_method: @@ -58873,6 +59010,13 @@ paths: type: string x-stripeBypassValidation: true type: array + prefetch: + items: + enum: + - balances + type: string + x-stripeBypassValidation: true + type: array title: invoice_linked_account_options_param type: object verification_method: @@ -61423,6 +61567,9 @@ paths: permissions: explode: true style: deepObject + prefetch: + explode: true + style: deepObject schema: additionalProperties: false properties: @@ -61480,6 +61627,17 @@ paths: type: string x-stripeBypassValidation: true type: array + prefetch: + description: >- + List of data features that you would like to retrieve upon + account creation. + items: + enum: + - balances + - ownership + type: string + x-stripeBypassValidation: true + type: array return_url: description: >- For webview integrations only. Upon completing OAuth login @@ -63597,6 +63755,13 @@ paths: type: string x-stripeBypassValidation: true type: array + prefetch: + items: + enum: + - balances + type: string + x-stripeBypassValidation: true + type: array title: invoice_linked_account_options_param type: object verification_method: @@ -65942,6 +66107,13 @@ paths: type: string x-stripeBypassValidation: true type: array + prefetch: + items: + enum: + - balances + type: string + x-stripeBypassValidation: true + type: array title: invoice_linked_account_options_param type: object verification_method: @@ -73602,6 +73774,9 @@ paths: permissions: explode: true style: deepObject + prefetch: + explode: true + style: deepObject schema: additionalProperties: false properties: @@ -73659,6 +73834,17 @@ paths: type: string x-stripeBypassValidation: true type: array + prefetch: + description: >- + List of data features that you would like to retrieve upon + account creation. + items: + enum: + - balances + - ownership + type: string + x-stripeBypassValidation: true + type: array return_url: description: >- For webview integrations only. Upon completing OAuth login @@ -74503,46 +74689,50 @@ paths: maxLength: 5000 type: string mandate_data: - description: >- - This hash contains details about the Mandate to create. This - parameter can only be used with - [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). - properties: - customer_acceptance: - properties: - accepted_at: - format: unix-time - type: integer - offline: - properties: {} - title: offline_param - type: object - online: + anyOf: + - properties: + customer_acceptance: properties: - ip_address: - type: string - user_agent: + accepted_at: + format: unix-time + type: integer + offline: + properties: {} + title: offline_param + type: object + online: + properties: + ip_address: + type: string + user_agent: + maxLength: 5000 + type: string + required: + - ip_address + - user_agent + title: online_param + type: object + type: + enum: + - offline + - online maxLength: 5000 type: string required: - - ip_address - - user_agent - title: online_param + - type + title: customer_acceptance_param type: object - type: - enum: - - offline - - online - maxLength: 5000 - type: string required: - - type - title: customer_acceptance_param + - customer_acceptance + title: secret_key_param type: object - required: - - customer_acceptance - title: secret_key_param - type: object + - enum: + - '' + type: string + description: >- + This hash contains details about the Mandate to create. This + parameter can only be used with + [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). metadata: additionalProperties: type: string @@ -75791,6 +75981,13 @@ paths: type: string x-stripeBypassValidation: true type: array + prefetch: + items: + enum: + - balances + type: string + x-stripeBypassValidation: true + type: array return_url: maxLength: 5000 type: string @@ -76013,7 +76210,7 @@ paths: description: >- A string that identifies the resulting payment as part of a group. See the PaymentIntents [use case for connected - accounts](https://stripe.com/docs/payments/connected-accounts) + accounts](https://stripe.com/docs/connect/separate-charges-and-transfers) for details. type: string use_stripe_sdk: @@ -77578,6 +77775,13 @@ paths: type: string x-stripeBypassValidation: true type: array + prefetch: + items: + enum: + - balances + type: string + x-stripeBypassValidation: true + type: array return_url: maxLength: 5000 type: string @@ -78246,6 +78450,9 @@ paths: - customer_acceptance title: secret_key_param type: object + - enum: + - '' + type: string - properties: customer_acceptance: properties: @@ -79494,6 +79701,13 @@ paths: type: string x-stripeBypassValidation: true type: array + prefetch: + items: + enum: + - balances + type: string + x-stripeBypassValidation: true + type: array return_url: maxLength: 5000 type: string @@ -83146,9 +83360,11 @@ paths: method: description: >- The method used to send this payout, which can be `standard` - or `instant`. `instant` is only supported for payouts to - debit cards. (See [Instant payouts for marketplaces for more - information](https://stripe.com/blog/instant-payouts-for-marketplaces).) + or `instant`. `instant` is supported for payouts to debit + cards and bank accounts in certain countries. (See [Bank + support for Instant + Payouts](https://stripe.com/docs/payouts/instant-payouts-banks) + for more information.) enum: - instant - standard @@ -88785,6 +89001,7 @@ paths: - issuing_dispute - issuing_transaction - network_cost + - obligation - other_adjustment - partial_capture_reversal - payout @@ -90229,46 +90446,50 @@ paths: type: string type: array mandate_data: - description: >- - This hash contains details about the Mandate to create. This - parameter can only be used with - [`confirm=true`](https://stripe.com/docs/api/setup_intents/create#create_setup_intent-confirm). - properties: - customer_acceptance: - properties: - accepted_at: - format: unix-time - type: integer - offline: - properties: {} - title: offline_param - type: object - online: + anyOf: + - properties: + customer_acceptance: properties: - ip_address: - type: string - user_agent: + accepted_at: + format: unix-time + type: integer + offline: + properties: {} + title: offline_param + type: object + online: + properties: + ip_address: + type: string + user_agent: + maxLength: 5000 + type: string + required: + - ip_address + - user_agent + title: online_param + type: object + type: + enum: + - offline + - online maxLength: 5000 type: string required: - - ip_address - - user_agent - title: online_param + - type + title: customer_acceptance_param type: object - type: - enum: - - offline - - online - maxLength: 5000 - type: string required: - - type - title: customer_acceptance_param + - customer_acceptance + title: secret_key_param type: object - required: - - customer_acceptance - title: secret_key_param - type: object + - enum: + - '' + type: string + description: >- + This hash contains details about the Mandate to create. This + parameter can only be used with + [`confirm=true`](https://stripe.com/docs/api/setup_intents/create#create_setup_intent-confirm). metadata: additionalProperties: type: string @@ -90871,6 +91092,13 @@ paths: type: string x-stripeBypassValidation: true type: array + prefetch: + items: + enum: + - balances + type: string + x-stripeBypassValidation: true + type: array return_url: maxLength: 5000 type: string @@ -91719,6 +91947,13 @@ paths: type: string x-stripeBypassValidation: true type: array + prefetch: + items: + enum: + - balances + type: string + x-stripeBypassValidation: true + type: array return_url: maxLength: 5000 type: string @@ -91937,6 +92172,9 @@ paths: - customer_acceptance title: secret_key_param type: object + - enum: + - '' + type: string - properties: customer_acceptance: properties: @@ -92551,6 +92789,13 @@ paths: type: string x-stripeBypassValidation: true type: array + prefetch: + items: + enum: + - balances + type: string + x-stripeBypassValidation: true + type: array return_url: maxLength: 5000 type: string @@ -97112,6 +97357,13 @@ paths: type: string x-stripeBypassValidation: true type: array + prefetch: + items: + enum: + - balances + type: string + x-stripeBypassValidation: true + type: array title: invoice_linked_account_options_param type: object verification_method: @@ -98186,6 +98438,13 @@ paths: type: string x-stripeBypassValidation: true type: array + prefetch: + items: + enum: + - balances + type: string + x-stripeBypassValidation: true + type: array title: invoice_linked_account_options_param type: object verification_method: @@ -103662,6 +103921,12 @@ paths: type: object - maxLength: 5000 type: string + description: >- + The card this token will represent. If you also pass in a + customer, the card must be the ID of a card belonging to the + customer. Otherwise, if you do not pass in a customer, this + is a dictionary containing a user's credit card details, + with the options described below. x-stripeBypassValidation: true customer: description: >- diff --git a/packages/openapi-typescript/scripts/download-schemas.ts b/packages/openapi-typescript/scripts/download-schemas.ts index eb3c16bd6..bc1b1719e 100644 --- a/packages/openapi-typescript/scripts/download-schemas.ts +++ b/packages/openapi-typescript/scripts/download-schemas.ts @@ -48,6 +48,7 @@ export async function download() { }), ]); console.log("Downloading schemas done."); // eslint-disable-line no-console + process.exit(0); // helps process close in npm script } download(); diff --git a/packages/openapi-typescript/scripts/update-examples.ts b/packages/openapi-typescript/scripts/update-examples.ts index 22afe7b4a..d280041e8 100644 --- a/packages/openapi-typescript/scripts/update-examples.ts +++ b/packages/openapi-typescript/scripts/update-examples.ts @@ -25,6 +25,7 @@ async function generateSchemas() { }), ]); console.log("Updating examples done."); // eslint-disable-line no-console + process.exit(0); // helps process close in npm script } generateSchemas(); diff --git a/packages/openapi-typescript/src/transform/components-object.ts b/packages/openapi-typescript/src/transform/components-object.ts index 660c41770..74cccceae 100644 --- a/packages/openapi-typescript/src/transform/components-object.ts +++ b/packages/openapi-typescript/src/transform/components-object.ts @@ -31,7 +31,7 @@ export default function transformComponentsObject(components: ComponentsObject, let key = escObjKey(name); if (ctx.immutableTypes) key = tsReadonly(key); if ("$ref" in responseObject) { - output.push(indent(`${key}": ${transformSchemaObject(responseObject, { path: `#/components/responses/${name}`, ctx })};`, indentLv)); + output.push(indent(`${key}: ${transformSchemaObject(responseObject, { path: `#/components/responses/${name}`, ctx })};`, indentLv)); } else { const responseType = transformResponseObject(responseObject, { path: `#/components/responses/${name}`, diff --git a/packages/openapi-typescript/test/components-object.test.ts b/packages/openapi-typescript/test/components-object.test.ts index 36db3dc6b..1ab7bd925 100644 --- a/packages/openapi-typescript/test/components-object.test.ts +++ b/packages/openapi-typescript/test/components-object.test.ts @@ -22,6 +22,11 @@ const options: GlobalContext = { const basicSchema: ComponentsObject = { schemas: { String: { type: "string" }, + Error: { + type: "object", + required: ["code", "message"], + properties: { code: { type: "string" }, message: { type: "string" } }, + }, }, responses: { OK: { @@ -37,6 +42,9 @@ const basicSchema: ComponentsObject = { NoContent: { description: "No Content", }, + ErrorResponse: { + $ref: 'components["schemas"]["Error"]', + }, }, parameters: { Search: { @@ -102,6 +110,10 @@ describe("Components Object", () => { expect(generated).toBe(`{ schemas: { String: string; + Error: { + code: string; + message: string; + }; }; responses: { /** @description OK */ @@ -114,6 +126,7 @@ describe("Components Object", () => { NoContent: { content: never; }; + ErrorResponse: components["schemas"]["Error"]; }; parameters: { Search: string; @@ -202,6 +215,10 @@ describe("Components Object", () => { expect(generated).toBe(`{ schemas: { readonly String: string; + readonly Error: { + readonly code: string; + readonly message: string; + }; }; responses: { /** @description OK */ @@ -214,6 +231,7 @@ describe("Components Object", () => { readonly NoContent: { content: never; }; + readonly ErrorResponse: components["schemas"]["Error"]; }; parameters: { readonly Search: string; @@ -266,9 +284,9 @@ describe("Components Object", () => { headers: never; pathItems: never; }`); - }); - }); }); + }); + }); test("parameters with required: false", () => { const generated = transformComponentsObject(optionalParamSchema, options); From eebe6a681d4af370d80f0c7a68c4cc763d3829f3 Mon Sep 17 00:00:00 2001 From: Drew Powers Date: Wed, 30 Aug 2023 10:53:10 -0600 Subject: [PATCH 2/3] Use Vitest .toMatchFileSnapshot() --- packages/openapi-typescript/test/cjs.test.ts | 7 ++---- packages/openapi-typescript/test/cli.test.ts | 22 +++++++------------ packages/openapi-typescript/test/helpers.ts | 12 ---------- .../openapi-typescript/test/index.test.ts | 11 +++++----- 4 files changed, 15 insertions(+), 37 deletions(-) delete mode 100644 packages/openapi-typescript/test/helpers.ts diff --git a/packages/openapi-typescript/test/cjs.test.ts b/packages/openapi-typescript/test/cjs.test.ts index e4067a5be..97416e2b1 100644 --- a/packages/openapi-typescript/test/cjs.test.ts +++ b/packages/openapi-typescript/test/cjs.test.ts @@ -2,17 +2,14 @@ // important: MUST use require()! const fs = require("node:fs"); -const { URL } = require("node:url"); +const { fileURLToPath, URL } = require("node:url"); const openapiTS = require("../dist/index.cjs"); const yaml = require("js-yaml"); -// note: this import is fine; it’s just a test helper -import { readFile } from "./helpers.js"; - describe("CJS bundle", () => { it("basic", async () => { const input = yaml.load(fs.readFileSync(new URL("../examples/stripe-api.yaml", import.meta.url), "utf8")); const output = await openapiTS(input); - expect(output).toBe(readFile(new URL("../examples/stripe-api.ts", import.meta.url))); + expect(output).toMatchFileSnapshot(fileURLToPath(new URL("../examples/stripe-api.ts", import.meta.url))); }); }); diff --git a/packages/openapi-typescript/test/cli.test.ts b/packages/openapi-typescript/test/cli.test.ts index 75964b827..8acf3537c 100644 --- a/packages/openapi-typescript/test/cli.test.ts +++ b/packages/openapi-typescript/test/cli.test.ts @@ -1,7 +1,7 @@ import { execa } from "execa"; +import fs from "node:fs"; import { URL, fileURLToPath } from "node:url"; import os from "node:os"; -import { readFile } from "./helpers.js"; const root = new URL("../", import.meta.url); const cwd = os.platform() === "win32" ? fileURLToPath(root) : root; // execa bug: fileURLToPath required on Windows @@ -14,36 +14,32 @@ describe("CLI", () => { test( "GitHub API", async () => { - const expected = readFile(new URL("./examples/github-api.ts", root)).trim(); const { stdout } = await execa(cmd, ["./examples/github-api.yaml"], { cwd }); - expect(stdout).toBe(expected); + expect(stdout).toMatchFileSnapshot(fileURLToPath(new URL("./examples/github-api.ts", root))); }, TIMEOUT, ); test( "GitHub API (next)", async () => { - const expected = readFile(new URL("./examples/github-api-next.ts", root)).trim(); const { stdout } = await execa(cmd, ["./examples/github-api-next.yaml"], { cwd }); - expect(stdout).toBe(expected); + expect(stdout).toMatchFileSnapshot(fileURLToPath(new URL("./examples/github-api-next.ts", root))); }, TIMEOUT, ); test( "Octokit GHES 3.6 Diff to API", async () => { - const expected = readFile(new URL("./examples/octokit-ghes-3.6-diff-to-api.ts", root)).trim(); const { stdout } = await execa(cmd, ["./examples/octokit-ghes-3.6-diff-to-api.json"], { cwd }); - expect(stdout).toBe(expected); + expect(stdout).toMatchFileSnapshot(fileURLToPath(new URL("./examples/octokit-ghes-3.6-diff-to-api.ts", root))); }, TIMEOUT, ); test( "Stripe API", async () => { - const expected = readFile(new URL("./examples/stripe-api.ts", root)).trim(); const { stdout } = await execa(cmd, ["./examples/stripe-api.yaml"], { cwd }); - expect(stdout).toBe(expected); + expect(stdout).toMatchFileSnapshot(fileURLToPath(new URL("./examples/stripe-api.ts", root))); }, TIMEOUT, ); @@ -51,21 +47,19 @@ describe("CLI", () => { test.skipIf(process.env.CI_ENV === "macos" || process.env.CI_ENV === "windows")( "DigitalOcean API (remote $refs)", async () => { - const expected = readFile(new URL("./examples/digital-ocean-api.ts", root)).trim(); const { stdout } = await execa(cmd, ["./examples/digital-ocean-api/DigitalOcean-public.v2.yaml"], { cwd, }); - expect(stdout).toBe(expected); + expect(stdout).toMatchFileSnapshot(fileURLToPath(new URL("./examples/digital-ocean-api.ts", root))); }, TIMEOUT, ); test( "stdin", async () => { - const expected = readFile(new URL("./examples/stripe-api.ts", root)).trim(); - const input = readFile(new URL("./examples/stripe-api.yaml", root)); + const input = fs.readFileSync(new URL("./examples/stripe-api.yaml", root)); const { stdout } = await execa(cmd, { input }); - expect(stdout).toBe(expected); + expect(stdout).toMatchFileSnapshot(fileURLToPath(new URL("./examples/stripe-api.ts", root))); }, TIMEOUT, ); diff --git a/packages/openapi-typescript/test/helpers.ts b/packages/openapi-typescript/test/helpers.ts deleted file mode 100644 index 43ee2b481..000000000 --- a/packages/openapi-typescript/test/helpers.ts +++ /dev/null @@ -1,12 +0,0 @@ -import fs from "node:fs"; - -export const CLRF_RE = /\r\n/g; - -/** Normalize all linebreaks to \n when reading files (for Windows tests) */ -export function readFile(filepath: fs.PathOrFileDescriptor): string { - const contents = fs.readFileSync(filepath, "utf8"); // Windows hack: fileURLToPath needed :/ - if (process.env.CI_ENV === "windows") { - return contents.replace(CLRF_RE, "\n"); // only do work on Windows - } - return contents; -} diff --git a/packages/openapi-typescript/test/index.test.ts b/packages/openapi-typescript/test/index.test.ts index 9e0b7a56b..2bde2f09f 100644 --- a/packages/openapi-typescript/test/index.test.ts +++ b/packages/openapi-typescript/test/index.test.ts @@ -3,7 +3,6 @@ import { URL, fileURLToPath } from "node:url"; import yaml from "js-yaml"; import openapiTS from "../dist/index.js"; import type { OpenAPI3 } from "../src/types.js"; -import { readFile } from "./helpers.js"; const BOILERPLATE = `/** * This file was auto-generated by openapi-typescript. @@ -1355,25 +1354,25 @@ export type operations = Record; describe("GitHub", () => { test("default options", async () => { const generated = await openapiTS(new URL("./github-api.yaml", EXAMPLES_DIR)); - expect(generated).toBe(readFile(new URL("./github-api.ts", EXAMPLES_DIR))); + expect(generated).toMatchFileSnapshot(fileURLToPath(new URL("./github-api.ts", EXAMPLES_DIR))); }, 30000); }); describe("GitHub (next)", () => { test("default options", async () => { const generated = await openapiTS(new URL("./github-api-next.yaml", EXAMPLES_DIR)); - expect(generated).toBe(readFile(new URL("./github-api-next.ts", EXAMPLES_DIR))); + expect(generated).toMatchFileSnapshot(fileURLToPath(new URL("./github-api-next.ts", EXAMPLES_DIR))); }, 30000); }); describe("Octokit GHES 3.6 Diff to API", () => { test("default options", async () => { const generated = await openapiTS(new URL("./octokit-ghes-3.6-diff-to-api.json", EXAMPLES_DIR)); - expect(generated).toBe(readFile(new URL("./octokit-ghes-3.6-diff-to-api.ts", EXAMPLES_DIR))); + expect(generated).toMatchFileSnapshot(fileURLToPath(new URL("./octokit-ghes-3.6-diff-to-api.ts", EXAMPLES_DIR))); }, 30000); }); describe("Stripe", () => { test("default options", async () => { const generated = await openapiTS(new URL("./stripe-api.yaml", EXAMPLES_DIR)); - expect(generated).toBe(readFile(new URL("./stripe-api.ts", EXAMPLES_DIR))); + expect(generated).toMatchFileSnapshot(fileURLToPath(new URL("./stripe-api.ts", EXAMPLES_DIR))); }, 30000); }); describe("DigitalOcean", () => { @@ -1382,7 +1381,7 @@ export type operations = Record; "default options", async () => { const generated = await openapiTS(new URL("./digital-ocean-api/DigitalOcean-public.v2.yaml", EXAMPLES_DIR)); - expect(generated).toBe(readFile(new URL("./digital-ocean-api.ts", EXAMPLES_DIR))); + expect(generated).toMatchFileSnapshot(fileURLToPath(new URL("./digital-ocean-api.ts", EXAMPLES_DIR))); }, 60000, ); From 7c0799e845601319a32aa409f1ac9b3e8de5df3c Mon Sep 17 00:00:00 2001 From: Drew Powers Date: Wed, 30 Aug 2023 10:54:14 -0600 Subject: [PATCH 3/3] Fix snapshots --- .../examples/digital-ocean-api.ts | 6 +++--- .../openapi-typescript/examples/github-api-next.ts | 14 +++++++------- packages/openapi-typescript/examples/github-api.ts | 14 +++++++------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/packages/openapi-typescript/examples/digital-ocean-api.ts b/packages/openapi-typescript/examples/digital-ocean-api.ts index e7f876169..c67299321 100644 --- a/packages/openapi-typescript/examples/digital-ocean-api.ts +++ b/packages/openapi-typescript/examples/digital-ocean-api.ts @@ -5522,10 +5522,10 @@ export interface external { * "doadmin" * ] */ - db_names?: readonly string[] | null; + db_names?: (readonly string[]) | null; connection?: external["resources/databases/models/database_connection.yml"]; private_connection?: external["resources/databases/models/database_connection.yml"]; - users?: readonly external["resources/databases/models/database_user.yml"][] | null; + users?: (readonly external["resources/databases/models/database_user.yml"][]) | null; maintenance_window?: external["resources/databases/models/database_maintenance_window.yml"]; /** * Format: uuid @@ -15392,7 +15392,7 @@ export interface external { * @description An array containing the IDs of the Droplets the volume is attached to. Note that at this time, a volume can only be attached to a single Droplet. * @example [] */ - droplet_ids?: readonly number[] | null; + droplet_ids?: (readonly number[]) | null; /** * @description A human-readable name for the block storage volume. Must be lowercase and be composed only of numbers, letters and "-", up to a limit of 64 characters. The name must begin with a letter. * @example example diff --git a/packages/openapi-typescript/examples/github-api-next.ts b/packages/openapi-typescript/examples/github-api-next.ts index 9d5616967..ab657b7c6 100644 --- a/packages/openapi-typescript/examples/github-api-next.ts +++ b/packages/openapi-typescript/examples/github-api-next.ts @@ -10766,7 +10766,7 @@ export interface components { /** @description The package version that resolve the vulnerability. */ first_patched_version: string | null; /** @description The functions in the package that are affected by the vulnerability. */ - vulnerable_functions: readonly string[] | null; + vulnerable_functions: (readonly string[]) | null; })[]) | null; cvss: ({ /** @description The CVSS vector. */ @@ -10780,10 +10780,10 @@ export interface components { /** @description The name of the CWE. */ name: string; }[] | null; - credits: readonly { + credits: (readonly { user: components["schemas"]["simple-user"]; type: components["schemas"]["security-advisory-credit-types"]; - }[] | null; + }[]) | null; }; /** * Basic Error @@ -14456,12 +14456,12 @@ export interface components { /** @description The CVSS score. */ score: number | null; }) | null; - cwes: readonly { + cwes: (readonly { /** @description The Common Weakness Enumeration (CWE) identifier. */ cwe_id: string; /** @description The name of the CWE. */ name: string; - }[] | null; + }[]) | null; /** @description A list of only the CWE IDs. */ cwe_ids: string[] | null; credits: { @@ -14469,7 +14469,7 @@ export interface components { login?: string; type?: components["schemas"]["security-advisory-credit-types"]; }[] | null; - credits_detailed: readonly components["schemas"]["repository-advisory-credit"][] | null; + credits_detailed: (readonly components["schemas"]["repository-advisory-credit"][]) | null; /** @description A list of users that collaborate on the advisory. */ collaborating_users: components["schemas"]["simple-user"][] | null; /** @description A list of teams that collaborate on the advisory. */ @@ -16540,7 +16540,7 @@ export interface components { */ analyses_url?: string | null; /** @description Any errors that ocurred during processing of the delivery. */ - errors?: readonly string[] | null; + errors?: (readonly string[]) | null; }; /** * CODEOWNERS errors diff --git a/packages/openapi-typescript/examples/github-api.ts b/packages/openapi-typescript/examples/github-api.ts index fe9443383..ae214cf8c 100644 --- a/packages/openapi-typescript/examples/github-api.ts +++ b/packages/openapi-typescript/examples/github-api.ts @@ -8251,7 +8251,7 @@ export interface components { /** @description The package version that resolve the vulnerability. */ first_patched_version: string | null; /** @description The functions in the package that are affected by the vulnerability. */ - vulnerable_functions: readonly string[] | null; + vulnerable_functions: (readonly string[]) | null; })[]) | null; cvss: ({ /** @description The CVSS vector. */ @@ -8265,10 +8265,10 @@ export interface components { /** @description The name of the CWE. */ name: string; }[] | null; - credits: readonly { + credits: (readonly { user: components["schemas"]["simple-user"]; type: components["schemas"]["security-advisory-credit-types"]; - }[] | null; + }[]) | null; }; /** * Basic Error @@ -13572,12 +13572,12 @@ export interface components { /** @description The CVSS score. */ score: number | null; }) | null; - cwes: readonly { + cwes: (readonly { /** @description The Common Weakness Enumeration (CWE) identifier. */ cwe_id: string; /** @description The name of the CWE. */ name: string; - }[] | null; + }[]) | null; /** @description A list of only the CWE IDs. */ cwe_ids: string[] | null; credits: { @@ -13585,7 +13585,7 @@ export interface components { login?: string; type?: components["schemas"]["security-advisory-credit-types"]; }[] | null; - credits_detailed: readonly components["schemas"]["repository-advisory-credit"][] | null; + credits_detailed: (readonly components["schemas"]["repository-advisory-credit"][]) | null; /** @description A list of users that collaborate on the advisory. */ collaborating_users: components["schemas"]["simple-user"][] | null; /** @description A list of teams that collaborate on the advisory. */ @@ -17232,7 +17232,7 @@ export interface components { */ analyses_url?: string | null; /** @description Any errors that ocurred during processing of the delivery. */ - errors?: readonly string[] | null; + errors?: (readonly string[]) | null; }; /** * CODEOWNERS errors