Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(openapi-typescript): handle nullable schemas #2059

Merged
merged 2 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/strange-cherries-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"openapi-typescript": minor
---

Allow all types except UNKNOWN to be nullable
6 changes: 3 additions & 3 deletions packages/openapi-typescript/examples/digital-ocean-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12439,7 +12439,7 @@ export interface components {
* @description The Droplet that the floating IP has been assigned to. When you query a floating IP, if it is assigned to a Droplet, the entire Droplet object will be returned. If it is not assigned, the value will be null.
* @example null
*/
droplet?: Record<string, never> | components["schemas"]["droplet"];
droplet?: (Record<string, never> | null) | components["schemas"]["droplet"];
/**
* @description A boolean value indicating whether or not the floating IP has pending actions preventing new ones from being submitted.
* @example true
Expand Down Expand Up @@ -12780,7 +12780,7 @@ export interface components {
* @description An object of key/value mappings specifying labels to apply to all nodes in a pool. Labels will automatically be applied to all existing nodes and any subsequent nodes added to the pool. Note that when a label is removed, it is not deleted from the nodes in the pool.
* @example null
*/
labels?: Record<string, never>;
labels?: Record<string, never> | null;
/** @description An array of taints to apply to all nodes in a pool. Taints will automatically be applied to all existing nodes and any subsequent nodes added to the pool. When a taint is removed, it is deleted from all nodes in the pool. */
taints?: components["schemas"]["kubernetes_node_pool_taint"][];
/**
Expand Down Expand Up @@ -14339,7 +14339,7 @@ export interface components {
* @description The Droplet that the reserved IP has been assigned to. When you query a reserved IP, if it is assigned to a Droplet, the entire Droplet object will be returned. If it is not assigned, the value will be null.
* @example null
*/
droplet?: Record<string, never> | components["schemas"]["droplet"];
droplet?: (Record<string, never> | null) | components["schemas"]["droplet"];
/**
* @description A boolean value indicating whether or not the reserved IP has pending actions preventing new ones from being submitted.
* @example true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41164,7 +41164,7 @@ export type components = {
readonly created_at: string;
/** @description The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. */
readonly dismissed_at: string | null;
readonly dismissed_by: Record<string, never>;
readonly dismissed_by: Record<string, never> | null;
/** @description The reason for dismissing or closing the alert. Can be one of: `false positive`, `won't fix`, and `used in tests`. */
readonly dismissed_reason: string | null;
/**
Expand Down Expand Up @@ -42189,7 +42189,7 @@ export type components = {
readonly display_title: string;
readonly event: string;
readonly head_branch: string;
readonly head_commit?: Record<string, never>;
readonly head_commit?: Record<string, never> | null;
readonly head_repository?: {
readonly archive_url?: string;
readonly assignees_url?: string;
Expand Down Expand Up @@ -42496,7 +42496,7 @@ export type components = {
readonly created_at: string;
readonly event: string;
readonly head_branch: string;
readonly head_commit?: Record<string, never>;
readonly head_commit?: Record<string, never> | null;
readonly head_repository?: {
readonly archive_url?: string;
readonly assignees_url?: string;
Expand Down Expand Up @@ -42844,7 +42844,7 @@ export type components = {
readonly created_at: string;
readonly event: string;
readonly head_branch: string;
readonly head_commit?: Record<string, never>;
readonly head_commit?: Record<string, never> | null;
readonly head_repository?: {
readonly archive_url?: string;
readonly assignees_url?: string;
Expand Down Expand Up @@ -44324,7 +44324,7 @@ export type components = {
readonly labels_url?: string;
readonly language?: unknown;
readonly languages_url?: string;
readonly license?: Record<string, never>;
readonly license?: Record<string, never> | null;
readonly merges_url?: string;
readonly milestones_url?: string;
readonly mirror_url?: unknown;
Expand Down Expand Up @@ -45131,7 +45131,7 @@ export type components = {
readonly url?: string;
readonly user_view_type?: string;
} | null;
readonly assignees?: readonly Record<string, never>[];
readonly assignees?: readonly (Record<string, never> | null)[];
readonly author_association?: string;
readonly body?: string | null;
readonly closed_at?: string | null;
Expand All @@ -45158,10 +45158,10 @@ export type components = {
}[];
readonly labels_url?: string;
readonly locked: boolean;
readonly milestone?: Record<string, never>;
readonly milestone?: Record<string, never> | null;
readonly node_id?: string;
readonly number?: number;
readonly performed_via_github_app?: Record<string, never>;
readonly performed_via_github_app?: Record<string, never> | null;
readonly reactions?: {
readonly "+1"?: number;
readonly "-1"?: number;
Expand Down Expand Up @@ -45675,7 +45675,7 @@ export type components = {
readonly url?: string;
readonly user_view_type?: string;
} | null;
readonly assignees?: readonly Record<string, never>[];
readonly assignees?: readonly (Record<string, never> | null)[];
readonly author_association?: string;
readonly body?: string | null;
readonly closed_at?: string | null;
Expand All @@ -45702,10 +45702,10 @@ export type components = {
}[];
readonly labels_url?: string;
readonly locked: boolean;
readonly milestone?: Record<string, never>;
readonly milestone?: Record<string, never> | null;
readonly node_id?: string;
readonly number?: number;
readonly performed_via_github_app?: Record<string, never>;
readonly performed_via_github_app?: Record<string, never> | null;
readonly reactions?: {
readonly "+1"?: number;
readonly "-1"?: number;
Expand Down Expand Up @@ -46221,7 +46221,7 @@ export type components = {
readonly url?: string;
readonly user_view_type?: string;
} | null;
readonly assignees?: readonly Record<string, never>[];
readonly assignees?: readonly (Record<string, never> | null)[];
readonly author_association?: string;
readonly body?: string | null;
readonly closed_at?: string | null;
Expand All @@ -46248,10 +46248,10 @@ export type components = {
}[];
readonly labels_url?: string;
readonly locked: boolean;
readonly milestone?: Record<string, never>;
readonly milestone?: Record<string, never> | null;
readonly node_id?: string;
readonly number?: number;
readonly performed_via_github_app?: Record<string, never>;
readonly performed_via_github_app?: Record<string, never> | null;
readonly reactions?: {
readonly "+1"?: number;
readonly "-1"?: number;
Expand Down Expand Up @@ -46744,8 +46744,8 @@ export type components = {
} | null;
} & {
readonly active_lock_reason?: string | null;
readonly assignee?: Record<string, never>;
readonly assignees?: readonly Record<string, never>[];
readonly assignee?: Record<string, never> | null;
readonly assignees?: readonly (Record<string, never> | null)[];
readonly author_association?: string;
readonly body?: string | null;
readonly closed_at: string | null;
Expand All @@ -46755,13 +46755,13 @@ export type components = {
readonly events_url?: string;
readonly html_url?: string;
readonly id?: number;
readonly labels?: readonly Record<string, never>[];
readonly labels?: readonly (Record<string, never> | null)[];
readonly labels_url?: string;
readonly locked?: boolean;
readonly milestone?: Record<string, never>;
readonly milestone?: Record<string, never> | null;
readonly node_id?: string;
readonly number?: number;
readonly performed_via_github_app?: Record<string, never>;
readonly performed_via_github_app?: Record<string, never> | null;
readonly reactions?: {
readonly "+1"?: number;
readonly "-1"?: number;
Expand Down Expand Up @@ -52843,8 +52843,8 @@ export type components = {
readonly body?: string | Record<string, never>;
readonly body_html?: string;
readonly container_metadata?: {
readonly labels?: Record<string, never>;
readonly manifest?: Record<string, never>;
readonly labels?: Record<string, never> | null;
readonly manifest?: Record<string, never> | null;
readonly tag?: {
readonly digest?: string;
readonly name?: string;
Expand All @@ -52869,19 +52869,19 @@ export type components = {
readonly name?: string;
readonly version?: string;
readonly npm_user?: string;
readonly author?: Record<string, never>;
readonly bugs?: Record<string, never>;
readonly author?: Record<string, never> | null;
readonly bugs?: Record<string, never> | null;
readonly dependencies?: Record<string, never>;
readonly dev_dependencies?: Record<string, never>;
readonly peer_dependencies?: Record<string, never>;
readonly optional_dependencies?: Record<string, never>;
readonly description?: string;
readonly dist?: Record<string, never>;
readonly dist?: Record<string, never> | null;
readonly git_head?: string;
readonly homepage?: string;
readonly license?: string;
readonly main?: string;
readonly repository?: Record<string, never>;
readonly repository?: Record<string, never> | null;
readonly scripts?: Record<string, never>;
readonly id?: string;
readonly node_version?: string;
Expand All @@ -52894,7 +52894,7 @@ export type components = {
readonly files?: readonly string[];
readonly bin?: Record<string, never>;
readonly man?: Record<string, never>;
readonly directories?: Record<string, never>;
readonly directories?: Record<string, never> | null;
readonly os?: readonly string[];
readonly cpu?: readonly string[];
readonly readme?: string;
Expand Down Expand Up @@ -82202,8 +82202,8 @@ export type components = {
readonly body?: string | Record<string, never>;
readonly body_html?: string;
readonly container_metadata?: {
readonly labels?: Record<string, never>;
readonly manifest?: Record<string, never>;
readonly labels?: Record<string, never> | null;
readonly manifest?: Record<string, never> | null;
readonly tag?: {
readonly digest?: string;
readonly name?: string;
Expand Down Expand Up @@ -82470,7 +82470,7 @@ export type components = {
readonly updated_at: string;
readonly version: string;
};
readonly registry: Record<string, never>;
readonly registry: Record<string, never> | null;
readonly updated_at: string;
};
readonly repository?: components["schemas"]["repository-webhooks"];
Expand Down Expand Up @@ -85136,7 +85136,7 @@ export type components = {
readonly head_branch?: string | null;
/** @description The name of the workflow. */
readonly workflow_name?: string | null;
readonly steps?: readonly Record<string, never>[];
readonly steps?: readonly (Record<string, never> | null)[];
readonly url?: string;
};
readonly deployment?: components["schemas"]["deployment"];
Expand Down
Loading
Loading