mirror of
https://github.com/ferdikoomen/openapi-typescript-codegen.git
synced 2025-12-08 20:16:21 +00:00
Fixed #596
This commit is contained in:
parent
fb7caaeb78
commit
13bf29c198
@ -9,5 +9,6 @@ describe('escapeDescription', () => {
|
||||
expect(escapeDescription('')).toEqual('');
|
||||
expect(escapeDescription('fooBar')).toEqual('fooBar');
|
||||
expect(escapeDescription('foo \\`test\\` bar')).toEqual('foo \\`test\\` bar');
|
||||
expect(escapeDescription('foo */bar/*')).toEqual('foo *_/bar/*');
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
export function escapeDescription(value: string): string {
|
||||
return value.replace(/([^\\])`/g, '$1\\`');
|
||||
return value.replace(/([^\\])`/g, '$1\\`').replace(/(\*\/)/g, '*_/');
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ describe('getComment', () => {
|
||||
expect(getComment('')).toEqual(null);
|
||||
expect(getComment('Hello')).toEqual('Hello');
|
||||
expect(getComment('Hello World!')).toEqual('Hello World!');
|
||||
expect(getComment('Testing */escape/*')).toEqual('Testing *_/escape/*');
|
||||
expect(getComment('Testing multiline comments.\nThis must go to the next line.\n\nThis will contain a break.')).toEqual(multiline);
|
||||
expect(getComment('Testing multiline comments.\r\nThis must go to the next line.\r\n\r\nThis will contain a break.')).toEqual(multiline);
|
||||
});
|
||||
|
||||
@ -7,7 +7,7 @@ import { EOL } from 'os';
|
||||
*/
|
||||
export function getComment(comment?: string): string | null {
|
||||
if (comment) {
|
||||
return comment.replace(/\r?\n(.*)/g, (_, w) => `${EOL} * ${w.trim()}`);
|
||||
return comment.replace(/(\*\/)/g, '*_/').replace(/\r?\n(.*)/g, (_, w) => `${EOL} * ${w.trim()}`);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -9,5 +9,6 @@ describe('escapeDescription', () => {
|
||||
expect(escapeDescription('')).toEqual('');
|
||||
expect(escapeDescription('fooBar')).toEqual('fooBar');
|
||||
expect(escapeDescription('foo \\`test\\` bar')).toEqual('foo \\`test\\` bar');
|
||||
expect(escapeDescription('foo */bar/*')).toEqual('foo *_/bar/*');
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
export function escapeDescription(value: string): string {
|
||||
return value.replace(/([^\\])`/g, '$1\\`');
|
||||
return value.replace(/([^\\])`/g, '$1\\`').replace(/(\*\/)/g, '*_/');
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ describe('getComment', () => {
|
||||
expect(getComment('')).toEqual(null);
|
||||
expect(getComment('Hello')).toEqual('Hello');
|
||||
expect(getComment('Hello World!')).toEqual('Hello World!');
|
||||
expect(getComment('Testing */escape/*')).toEqual('Testing *_/escape/*');
|
||||
expect(getComment('Testing multiline comments.\nThis must go to the next line.\n\nThis will contain a break.')).toEqual(multiline);
|
||||
expect(getComment('Testing multiline comments.\r\nThis must go to the next line.\r\n\r\nThis will contain a break.')).toEqual(multiline);
|
||||
});
|
||||
|
||||
@ -7,7 +7,7 @@ import { EOL } from 'os';
|
||||
*/
|
||||
export function getComment(comment?: string): string | null {
|
||||
if (comment) {
|
||||
return comment.replace(/\r?\n(.*)/g, (_, w) => `${EOL} * ${w.trim()}`);
|
||||
return comment.replace(/(\*\/)/g, '*_/').replace(/\r?\n(.*)/g, (_, w) => `${EOL} * ${w.trim()}`);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user