@orval/core 7.17.2 → 7.19.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/index.d.ts +2 -2
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1275,8 +1275,8 @@ declare const combineSchemas: ({
|
|
|
1275
1275
|
declare const resolveDiscriminators: (schemas: SchemasObject, context: ContextSpecs) => SchemasObject;
|
|
1276
1276
|
//#endregion
|
|
1277
1277
|
//#region src/getters/enum.d.ts
|
|
1278
|
-
declare
|
|
1279
|
-
declare
|
|
1278
|
+
declare function getEnumNames(schemaObject: SchemaObject | undefined): string[] | undefined;
|
|
1279
|
+
declare function getEnumDescriptions(schemaObject: SchemaObject | undefined): string[] | undefined;
|
|
1280
1280
|
declare const getEnum: (value: string, enumName: string, names: string[] | undefined, enumGenerationType: EnumGeneration, descriptions?: string[], enumNamingConvention?: NamingConvention) => string;
|
|
1281
1281
|
declare const getEnumImplementation: (value: string, names?: string[], descriptions?: string[], enumNamingConvention?: NamingConvention) => string;
|
|
1282
1282
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -974,12 +974,16 @@ const ibmOpenapiValidator = async (specs, validation) => {
|
|
|
974
974
|
|
|
975
975
|
//#endregion
|
|
976
976
|
//#region src/getters/enum.ts
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
977
|
+
function getEnumNames(schemaObject) {
|
|
978
|
+
const names = schemaObject?.["x-enumNames"] ?? schemaObject?.["x-enumnames"] ?? schemaObject?.["x-enum-varnames"];
|
|
979
|
+
if (!names) return;
|
|
980
|
+
return names.map((name) => jsStringEscape(name));
|
|
981
|
+
}
|
|
982
|
+
function getEnumDescriptions(schemaObject) {
|
|
983
|
+
const descriptions = schemaObject?.["x-enumDescriptions"] ?? schemaObject?.["x-enumdescriptions"] ?? schemaObject?.["x-enum-descriptions"];
|
|
984
|
+
if (!descriptions) return;
|
|
985
|
+
return descriptions.map((description) => jsStringEscape(description));
|
|
986
|
+
}
|
|
983
987
|
const getEnum = (value, enumName, names, enumGenerationType, descriptions, enumNamingConvention) => {
|
|
984
988
|
if (enumGenerationType === EnumGeneration.CONST) return getTypeConstEnum(value, enumName, names, descriptions, enumNamingConvention);
|
|
985
989
|
if (enumGenerationType === EnumGeneration.ENUM) return getNativeEnum(value, enumName, names, enumNamingConvention);
|