Skip to content

Commit 45a79cb

Browse files
committed
Improve oneOf and enum handling
1 parent 25080d4 commit 45a79cb

File tree

9 files changed

+244
-87
lines changed

9 files changed

+244
-87
lines changed

.changeset/rich-dodos-visit.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"openapi-typescript": patch
3+
---
4+
5+
Improve oneOf and enum handling

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

-45
This file was deleted.

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

-6
This file was deleted.

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

-16
This file was deleted.

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

+90-6
Original file line numberDiff line numberDiff line change
@@ -13711,7 +13711,9 @@ export interface components {
1371113711
* @description The assignee that has been granted access to GitHub Copilot.
1371213712
* @enum {object}
1371313713
*/
13714-
assignee: [object Object];
13714+
assignee: {
13715+
[key: string]: unknown;
13716+
} & (components["schemas"]["simple-user"] | components["schemas"]["team"] | components["schemas"]["organization"]);
1371513717
/** @description The team that granted access to GitHub Copilot to the assignee. This will be null if the user was assigned a seat individually. */
1371613718
assigning_team?: components["schemas"]["team"];
1371713719
/**
@@ -14124,7 +14126,7 @@ export interface components {
1412414126
* Organization ruleset conditions
1412514127
* @description Conditions for an organization ruleset
1412614128
*/
14127-
"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"]);
14129+
"org-ruleset-conditions": Record<string, never> & ((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"]));
1412814130
/**
1412914131
* creation
1413014132
* @description Only allow users with bypass permission to create matching refs.
@@ -14342,7 +14344,7 @@ export interface components {
1434214344
* Repository Rule
1434314345
* @description A repository rule.
1434414346
*/
14345-
"repository-rule": components["schemas"]["repository-rule-creation"] | components["schemas"]["repository-rule-update"] | components["schemas"]["repository-rule-deletion"] | components["schemas"]["repository-rule-required-linear-history"] | components["schemas"]["repository-rule-required-deployments"] | components["schemas"]["repository-rule-required-signatures"] | components["schemas"]["repository-rule-pull-request"] | components["schemas"]["repository-rule-required-status-checks"] | components["schemas"]["repository-rule-non-fast-forward"] | components["schemas"]["repository-rule-commit-message-pattern"] | components["schemas"]["repository-rule-commit-author-email-pattern"] | components["schemas"]["repository-rule-committer-email-pattern"] | components["schemas"]["repository-rule-branch-name-pattern"] | components["schemas"]["repository-rule-tag-name-pattern"];
14347+
"repository-rule": Record<string, never> & (components["schemas"]["repository-rule-creation"] | components["schemas"]["repository-rule-update"] | components["schemas"]["repository-rule-deletion"] | components["schemas"]["repository-rule-required-linear-history"] | components["schemas"]["repository-rule-required-deployments"] | components["schemas"]["repository-rule-required-signatures"] | components["schemas"]["repository-rule-pull-request"] | components["schemas"]["repository-rule-required-status-checks"] | components["schemas"]["repository-rule-non-fast-forward"] | components["schemas"]["repository-rule-commit-message-pattern"] | components["schemas"]["repository-rule-commit-author-email-pattern"] | components["schemas"]["repository-rule-committer-email-pattern"] | components["schemas"]["repository-rule-branch-name-pattern"] | components["schemas"]["repository-rule-tag-name-pattern"]);
1434614348
/**
1434714349
* Repository ruleset
1434814350
* @description A set of rules to apply when specified conditions are met.
@@ -19266,7 +19268,7 @@ export interface components {
1926619268
* Repository Rule
1926719269
* @description A repository rule with ruleset details.
1926819270
*/
19269-
"repository-rule-detailed": (components["schemas"]["repository-rule-creation"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-update"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-deletion"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-required-linear-history"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-required-deployments"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-required-signatures"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-pull-request"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-required-status-checks"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-non-fast-forward"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-commit-message-pattern"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-commit-author-email-pattern"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-committer-email-pattern"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-branch-name-pattern"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-tag-name-pattern"] & components["schemas"]["repository-rule-ruleset-info"]);
19271+
"repository-rule-detailed": Record<string, never> & ((components["schemas"]["repository-rule-creation"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-update"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-deletion"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-required-linear-history"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-required-deployments"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-required-signatures"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-pull-request"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-required-status-checks"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-non-fast-forward"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-commit-message-pattern"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-commit-author-email-pattern"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-committer-email-pattern"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-branch-name-pattern"] & components["schemas"]["repository-rule-ruleset-info"]) | (components["schemas"]["repository-rule-tag-name-pattern"] & components["schemas"]["repository-rule-ruleset-info"]));
1927019272
"secret-scanning-alert": {
1927119273
number?: components["schemas"]["alert-number"];
1927219274
created_at?: components["schemas"]["alert-created-at"];
@@ -90333,15 +90335,97 @@ export interface operations {
9033390335
};
9033490336
requestBody: {
9033590337
content: {
90336-
"application/json": OneOf<[{
90338+
"application/json": ({
90339+
/** @description The name of the check. For example, "code-coverage". */
90340+
name: string;
90341+
/** @description The SHA of the commit. */
90342+
head_sha: string;
90343+
/** @description The URL of the integrator's site that has the full details of the check. If the integrator does not provide this, then the homepage of the GitHub app is used. */
90344+
details_url?: string;
90345+
/** @description A reference for the run on the integrator's system. */
90346+
external_id?: string;
90347+
/**
90348+
* @description The current status.
90349+
* @default queued
90350+
* @enum {string}
90351+
*/
90352+
status?: "queued" | "in_progress" | "completed";
90353+
/**
90354+
* Format: date-time
90355+
* @description The time that the check run began. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.
90356+
*/
90357+
started_at?: string;
90358+
/**
90359+
* @description **Required if you provide `completed_at` or a `status` of `completed`**. The final conclusion of the check.
90360+
* **Note:** Providing `conclusion` will automatically set the `status` parameter to `completed`. You cannot change a check run conclusion to `stale`, only GitHub can set this.
90361+
* @enum {string}
90362+
*/
90363+
conclusion?: "action_required" | "cancelled" | "failure" | "neutral" | "success" | "skipped" | "stale" | "timed_out";
90364+
/**
90365+
* Format: date-time
90366+
* @description The time the check completed. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.
90367+
*/
90368+
completed_at?: string;
90369+
/** @description Check runs can accept a variety of data in the `output` object, including a `title` and `summary` and can optionally provide descriptive details about the run. */
90370+
output?: {
90371+
/** @description The title of the check run. */
90372+
title: string;
90373+
/** @description The summary of the check run. This parameter supports Markdown. **Maximum length**: 65535 characters. */
90374+
summary: string;
90375+
/** @description The details of the check run. This parameter supports Markdown. **Maximum length**: 65535 characters. */
90376+
text?: string;
90377+
/** @description Adds information from your analysis to specific lines of code. Annotations are visible on GitHub in the **Checks** and **Files changed** tab of the pull request. The Checks API limits the number of annotations to a maximum of 50 per API request. To create more than 50 annotations, you have to make multiple requests to the [Update a check run](https://docs.github.com/rest/checks/runs#update-a-check-run) endpoint. Each time you update the check run, annotations are appended to the list of annotations that already exist for the check run. GitHub Actions are limited to 10 warning annotations and 10 error annotations per step. For details about how you can view annotations on GitHub, see "[About status checks](https://docs.github.com/articles/about-status-checks#checks)". */
90378+
annotations?: ({
90379+
/** @description The path of the file to add an annotation to. For example, `assets/css/main.css`. */
90380+
path: string;
90381+
/** @description The start line of the annotation. Line numbers start at 1. */
90382+
start_line: number;
90383+
/** @description The end line of the annotation. */
90384+
end_line: number;
90385+
/** @description The start column of the annotation. Annotations only support `start_column` and `end_column` on the same line. Omit this parameter if `start_line` and `end_line` have different values. Column numbers start at 1. */
90386+
start_column?: number;
90387+
/** @description The end column of the annotation. Annotations only support `start_column` and `end_column` on the same line. Omit this parameter if `start_line` and `end_line` have different values. */
90388+
end_column?: number;
90389+
/**
90390+
* @description The level of the annotation.
90391+
* @enum {string}
90392+
*/
90393+
annotation_level: "notice" | "warning" | "failure";
90394+
/** @description A short description of the feedback for these lines of code. The maximum size is 64 KB. */
90395+
message: string;
90396+
/** @description The title that represents the annotation. The maximum size is 255 characters. */
90397+
title?: string;
90398+
/** @description Details about this annotation. The maximum size is 64 KB. */
90399+
raw_details?: string;
90400+
})[];
90401+
/** @description Adds images to the output displayed in the GitHub pull request UI. */
90402+
images?: {
90403+
/** @description The alternative text for the image. */
90404+
alt: string;
90405+
/** @description The full URL of the image. */
90406+
image_url: string;
90407+
/** @description A short image description. */
90408+
caption?: string;
90409+
}[];
90410+
};
90411+
/** @description Displays a button on GitHub that can be clicked to alert your app to do additional tasks. For example, a code linting app can display a button that automatically fixes detected errors. The button created in this object is displayed after the check run completes. When a user clicks the button, GitHub sends the [`check_run.requested_action` webhook](https://docs.github.com/webhooks/event-payloads/#check_run) to your app. Each action includes a `label`, `identifier` and `description`. A maximum of three actions are accepted. To learn more about check runs and requested actions, see "[Check runs and requested actions](https://docs.github.com/rest/reference/checks#check-runs-and-requested-actions)." */
90412+
actions?: {
90413+
/** @description The text to be displayed on a button in the web UI. The maximum size is 20 characters. */
90414+
label: string;
90415+
/** @description A short explanation of what this action would do. The maximum size is 40 characters. */
90416+
description: string;
90417+
/** @description A reference for the action on the integrator's system. The maximum size is 20 characters. */
90418+
identifier: string;
90419+
}[];
90420+
}) & (OneOf<[{
9033790421
/** @enum {unknown} */
9033890422
status: "completed";
9033990423
[key: string]: unknown;
9034090424
}, {
9034190425
/** @enum {unknown} */
9034290426
status?: "queued" | "in_progress";
9034390427
[key: string]: unknown;
90344-
}]>;
90428+
}]>);
9034590429
};
9034690430
};
9034790431
responses: {

0 commit comments

Comments
 (0)