Skip to content

Commit 7cc0d8e

Browse files
committed
Support x-enum-varname on $ref
1 parent 4ed90d6 commit 7cc0d8e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/openApi/v3/interfaces/OpenApiSchema.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,5 @@ export interface OpenApiSchema extends OpenApiReference, WithEnumExtension {
5555
externalDocs?: OpenApiExternalDocs;
5656
example?: any;
5757
deprecated?: boolean;
58+
['x-enum-varname']?: string;
5859
}

src/openApi/v3/parser/getModelProperties.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ export const getModelProperties = (
7474
const model = getType(property.$ref);
7575
models.push({
7676
export: 'reference',
77-
type: model.type,
78-
base: model.base,
77+
type: property['x-enum-varname'] ? `${model.type}.${property['x-enum-varname']}` : model.type,
78+
base: property['x-enum-varname'] ? `${model.base}.${property['x-enum-varname']}` : model.base,
7979
template: model.template,
8080
link: null,
8181
isNullable: model.isNullable || property.nullable === true,

0 commit comments

Comments
 (0)