Skip to content

Commit 705f3e4

Browse files
committed
Don't remove null type if default is present (legacy)
1 parent 1e6f967 commit 705f3e4

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -12326,7 +12326,7 @@ export interface components {
1232612326
* "web"
1232712327
* ]
1232812328
*/
12329-
tags: string[];
12329+
tags: string[] | null;
1233012330
/**
1233112331
* @description A string containing 'user data' which may be used to configure the Droplet on first boot, often a 'cloud-config' file or Bash script. It must be plain text and may not exceed 64 KiB in size.
1233212332
* @example #cloud-config

packages/openapi-typescript/examples/github-api-export-type-immutable.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -108426,7 +108426,7 @@ export interface operations {
108426108426
/** @description The name of the task for the deployment (e.g., `deploy` or `deploy:migrations`). */
108427108427
readonly task?: string;
108428108428
/** @description The name of the environment that was deployed to (e.g., `staging` or `production`). */
108429-
readonly environment?: string;
108429+
readonly environment?: string | null;
108430108430
/** @description The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." */
108431108431
readonly per_page?: components["parameters"]["per-page"];
108432108432
/** @description The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." */

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -108426,7 +108426,7 @@ export interface operations {
108426108426
/** @description The name of the task for the deployment (e.g., `deploy` or `deploy:migrations`). */
108427108427
readonly task?: string;
108428108428
/** @description The name of the environment that was deployed to (e.g., `staging` or `production`). */
108429-
readonly environment?: string;
108429+
readonly environment?: string | null;
108430108430
/** @description The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." */
108431108431
readonly per_page?: components["parameters"]["per-page"];
108432108432
/** @description The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." */

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -108426,7 +108426,7 @@ export interface operations {
108426108426
/** @description The name of the task for the deployment (e.g., `deploy` or `deploy:migrations`). */
108427108427
task?: string;
108428108428
/** @description The name of the environment that was deployed to (e.g., `staging` or `production`). */
108429-
environment?: string;
108429+
environment?: string | null;
108430108430
/** @description The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." */
108431108431
per_page?: components["parameters"]["per-page"];
108432108432
/** @description The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." */

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -109453,7 +109453,7 @@ export interface operations {
109453109453
/** @description The name of the task for the deployment (e.g., `deploy` or `deploy:migrations`). */
109454109454
task?: string;
109455109455
/** @description The name of the environment that was deployed to (e.g., `staging` or `production`). */
109456-
environment?: string;
109456+
environment?: string | null;
109457109457
/** @description The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." */
109458109458
per_page?: components["parameters"]["per-page"];
109459109459
/** @description The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." */

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -108426,7 +108426,7 @@ export interface operations {
108426108426
/** @description The name of the task for the deployment (e.g., `deploy` or `deploy:migrations`). */
108427108427
task?: string;
108428108428
/** @description The name of the environment that was deployed to (e.g., `staging` or `production`). */
108429-
environment?: string;
108429+
environment?: string | null;
108430108430
/** @description The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." */
108431108431
per_page?: components["parameters"]["per-page"];
108432108432
/** @description The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." */

packages/openapi-typescript/src/transform/schema-object.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ export function transformSchemaObjectWithComposition(
263263
}
264264
}
265265

266-
if (finalType !== UNKNOWN && schemaObject.nullable && !schemaObject.default) {
266+
if (finalType !== UNKNOWN && schemaObject.nullable) {
267267
finalType = tsNullable([finalType]);
268268
}
269269

packages/openapi-typescript/test/transform/schema-object/string.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ describe("transformSchemaObject > string", () => {
116116
"default + nullable (deprecated syntax)",
117117
{
118118
given: { type: "string", default: "en", nullable: true },
119-
want: "string",
119+
want: "string | null",
120120
},
121121
],
122122
];

0 commit comments

Comments
 (0)