@ng-openapi/http-resource 0.0.23 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +5 -1
- package/index.js +5 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -47,6 +47,10 @@ function pascalCase(str2) {
|
|
|
47
47
|
return str2.replace(/[-_\s]+(.)?/g, (_, char) => char ? char.toUpperCase() : "").replace(/^./, (char) => char.toUpperCase());
|
|
48
48
|
}
|
|
49
49
|
__name(pascalCase, "pascalCase");
|
|
50
|
+
function pascalCaseForEnums(str2) {
|
|
51
|
+
return str2.replace(/[^a-zA-Z0-9]/g, "_").replace(/(?:^|_)([a-z])/g, (_, char) => char.toUpperCase()).replace(/^([0-9])/, "_$1");
|
|
52
|
+
}
|
|
53
|
+
__name(pascalCaseForEnums, "pascalCaseForEnums");
|
|
50
54
|
|
|
51
55
|
// ../../shared/src/utils/type.utils.ts
|
|
52
56
|
function getTypeScriptType(schemaOrType, config, formatOrNullable, isNullable, context = "type") {
|
|
@@ -67,7 +71,7 @@ function getTypeScriptType(schemaOrType, config, formatOrNullable, isNullable, c
|
|
|
67
71
|
}
|
|
68
72
|
if (schema2.$ref) {
|
|
69
73
|
const refName = schema2.$ref.split("/").pop();
|
|
70
|
-
return nullableType(
|
|
74
|
+
return nullableType(pascalCaseForEnums(refName), nullable);
|
|
71
75
|
}
|
|
72
76
|
if (schema2.type === "array") {
|
|
73
77
|
const itemType = schema2.items ? getTypeScriptType(schema2.items, config, void 0, void 0, context) : "unknown";
|
package/index.js
CHANGED
|
@@ -13,6 +13,10 @@ function pascalCase(str2) {
|
|
|
13
13
|
return str2.replace(/[-_\s]+(.)?/g, (_, char) => char ? char.toUpperCase() : "").replace(/^./, (char) => char.toUpperCase());
|
|
14
14
|
}
|
|
15
15
|
__name(pascalCase, "pascalCase");
|
|
16
|
+
function pascalCaseForEnums(str2) {
|
|
17
|
+
return str2.replace(/[^a-zA-Z0-9]/g, "_").replace(/(?:^|_)([a-z])/g, (_, char) => char.toUpperCase()).replace(/^([0-9])/, "_$1");
|
|
18
|
+
}
|
|
19
|
+
__name(pascalCaseForEnums, "pascalCaseForEnums");
|
|
16
20
|
|
|
17
21
|
// ../../shared/src/utils/type.utils.ts
|
|
18
22
|
function getTypeScriptType(schemaOrType, config, formatOrNullable, isNullable, context = "type") {
|
|
@@ -33,7 +37,7 @@ function getTypeScriptType(schemaOrType, config, formatOrNullable, isNullable, c
|
|
|
33
37
|
}
|
|
34
38
|
if (schema2.$ref) {
|
|
35
39
|
const refName = schema2.$ref.split("/").pop();
|
|
36
|
-
return nullableType(
|
|
40
|
+
return nullableType(pascalCaseForEnums(refName), nullable);
|
|
37
41
|
}
|
|
38
42
|
if (schema2.type === "array") {
|
|
39
43
|
const itemType = schema2.items ? getTypeScriptType(schema2.items, config, void 0, void 0, context) : "unknown";
|