Skip to content

Commit 7d762c4

Browse files
authored
Allow custom field generation for Enum types (#111)
Fixes #110 Extends the use of `handleFieldGeneration` into the Enum generation. This ensures any options which contain custom field generation are also applied there.
1 parent ffa7b90 commit 7d762c4

File tree

4 files changed

+445
-1
lines changed

4 files changed

+445
-1
lines changed

src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,11 @@ const getNamedType = (opts: Options<NamedTypeNode>): string | number | boolean =
274274
);
275275
const enumConverter = createNameConverter(opts.enumValuesConvention, opts.transformUnderscore);
276276
const value = foundType.values ? foundType.values[0] : '';
277-
return `${typenameConverter(foundType.name, opts.enumsPrefix)}.${enumConverter(value)}`;
277+
return handleValueGeneration(
278+
opts,
279+
undefined,
280+
() => `${typenameConverter(foundType.name, opts.enumsPrefix)}.${enumConverter(value)}`,
281+
);
278282
}
279283
case 'union':
280284
// Return the first union type node.

0 commit comments

Comments
 (0)