@qualisero/openapi-endpoint 0.19.1 → 0.20.0
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/dist/cli.js +3 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -324,8 +324,10 @@ function toEnumMemberName(value) {
|
|
|
324
324
|
// For non-identifier strings, replace special characters with underscores
|
|
325
325
|
const cleaned = toPascalCase(value.replace(/[^a-zA-Z0-9_$]/g, '_'));
|
|
326
326
|
// If the result is empty or still invalid, prefix with underscore to make it valid
|
|
327
|
+
// Sanitize the full value to ensure unique identifiers for enum members
|
|
327
328
|
if (cleaned.length === 0 || !/^[a-zA-Z_$]/.test(cleaned)) {
|
|
328
|
-
|
|
329
|
+
const sanitized = String(value).replace(/[^a-zA-Z0-9_$]/g, '_');
|
|
330
|
+
return sanitized.length > 0 ? `_${sanitized}` : '_Empty';
|
|
329
331
|
}
|
|
330
332
|
return cleaned;
|
|
331
333
|
}
|