fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #360 from hey-api/fix/uri-decoding

fix: handle decoding models with `%` in description

authored by

Jordan Shatford and committed by
GitHub
935270b8 7e7f44cc

+55 -1
+5
.changeset/thick-lemons-yell.md
··· 1 + --- 2 + "@hey-api/openapi-ts": patch 3 + --- 4 + 5 + fix: handle decoding models with `%` in description
+1 -1
packages/openapi-ts/src/compiler/utils.ts
··· 114 114 ts.addSyntheticLeadingComment( 115 115 node, 116 116 ts.SyntaxKind.MultiLineCommentTrivia, 117 - ['*', ...comments.map(row => ` * ${row}`), ' '].join('\n'), 117 + encodeURIComponent(['*', ...comments.map(row => ` * ${row}`), ' '].join('\n')), 118 118 hasTrailingNewLine 119 119 ); 120 120 return '';
+5
packages/openapi-ts/test/__snapshots__/test/generated/v3/models.ts.snap
··· 679 679 foo?: string; 680 680 } | null; 681 681 682 + /** 683 + * Some % character 684 + */ 685 + export type CharactersInDescription = string; 686 + 682 687 export type ModelWithNullableObject = { 683 688 data?: NullableObject; 684 689 };
+5
packages/openapi-ts/test/__snapshots__/test/generated/v3/schemas.ts.snap
··· 1383 1383 default: null, 1384 1384 } as const; 1385 1385 1386 + export const $CharactersInDescription = { 1387 + type: 'string', 1388 + description: 'Some % character', 1389 + } as const; 1390 + 1386 1391 export const $ModelWithNullableObject = { 1387 1392 type: 'object', 1388 1393 properties: {
+5
packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/models.ts.snap
··· 679 679 foo?: string; 680 680 } | null; 681 681 682 + /** 683 + * Some % character 684 + */ 685 + export type CharactersInDescription = string; 686 + 682 687 export type ModelWithNullableObject = { 683 688 data?: NullableObject; 684 689 };
+5
packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/schemas.ts.snap
··· 1383 1383 default: null, 1384 1384 } as const; 1385 1385 1386 + export const $CharactersInDescription = { 1387 + type: 'string', 1388 + description: 'Some % character', 1389 + } as const; 1390 + 1386 1391 export const $ModelWithNullableObject = { 1387 1392 type: 'object', 1388 1393 properties: {
+5
packages/openapi-ts/test/__snapshots__/test/generated/v3_client/models.ts.snap
··· 679 679 foo?: string; 680 680 } | null; 681 681 682 + /** 683 + * Some % character 684 + */ 685 + export type CharactersInDescription = string; 686 + 682 687 export type ModelWithNullableObject = { 683 688 data?: NullableObject; 684 689 };
+5
packages/openapi-ts/test/__snapshots__/test/generated/v3_date/schemas.ts.snap
··· 1383 1383 default: null, 1384 1384 } as const; 1385 1385 1386 + export const $CharactersInDescription = { 1387 + type: 'string', 1388 + description: 'Some % character', 1389 + } as const; 1390 + 1386 1391 export const $ModelWithNullableObject = { 1387 1392 type: 'object', 1388 1393 properties: {
+5
packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/models.ts.snap
··· 679 679 foo?: string; 680 680 } | null; 681 681 682 + /** 683 + * Some % character 684 + */ 685 + export type CharactersInDescription = string; 686 + 682 687 export type ModelWithNullableObject = { 683 688 data?: NullableObject; 684 689 };
+5
packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/schemas.ts.snap
··· 1383 1383 default: null, 1384 1384 } as const; 1385 1385 1386 + export const $CharactersInDescription = { 1387 + type: 'string', 1388 + description: 'Some % character', 1389 + } as const; 1390 + 1386 1391 export const $ModelWithNullableObject = { 1387 1392 type: 'object', 1388 1393 properties: {
+5
packages/openapi-ts/test/__snapshots__/test/generated/v3_models/models.ts.snap
··· 679 679 foo?: string; 680 680 } | null; 681 681 682 + /** 683 + * Some % character 684 + */ 685 + export type CharactersInDescription = string; 686 + 682 687 export type ModelWithNullableObject = { 683 688 data?: NullableObject; 684 689 };
+4
packages/openapi-ts/test/spec/v3.json
··· 2920 2920 }, 2921 2921 "default": null 2922 2922 }, 2923 + "CharactersInDescription": { 2924 + "type": "string", 2925 + "description": "Some % character" 2926 + }, 2923 2927 "ModelWithNullableObject": { 2924 2928 "type": "object", 2925 2929 "properties": {