We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1e33b1f commit 2891105Copy full SHA for 2891105
src/openApi/v3/parser/getType.ts
@@ -4,7 +4,9 @@ import { getMappedType } from './getMappedType';
4
import { stripNamespace } from './stripNamespace';
5
6
const encode = (value: string): string => {
7
- return value.replace(/^[^a-zA-Z_$]+/g, '').replace(/[^\w$]+/g, '_');
+ const res = value.replace(/^[^a-zA-Z_$]+/g, '').replace(/[^\w$]+/g, '_');
8
+ // for model names only containing number (e.g. 401), we have the fallback here:
9
+ return res || `_${value.replace(/^[^a-zA-Z0-9_$]+/g, '').replace(/[^\w$]+/g, '_')}`;
10
};
11
12
/**
0 commit comments