Skip to content

Commit 6e9d3c8

Browse files
committed
Remove spaces in enum names
Enum values can be more than one word, so replace whitespace so that enum names are valid
1 parent c6a61fe commit 6e9d3c8

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/swagger-2.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ function capitalize(str: string) {
3131
}
3232

3333
function camelCase(name: string) {
34-
return name.replace(/(-|_|\.|\s)+[a-z]/g, letter =>
35-
letter.toUpperCase().replace(/[^0-9a-z]/gi, '')
36-
);
34+
return name.replace(/(-|_|\.|\s)+\w/g, letter => letter.toUpperCase().replace(/[^0-9a-z]/gi, ''));
3735
}
3836

3937
function parse(spec: Swagger2, namespace: string) {

0 commit comments

Comments
 (0)