@@ -74,22 +74,22 @@ class DiscriminatorSchemaParser extends MonoSchemaParser {
74
74
} ) ;
75
75
76
76
if ( ableToCreateMappingType ) {
77
- mappingTypeName = this . schemaUtils . resolveTypeName (
78
- `${ abstractSchemaStruct . typeName } ${ discriminator . propertyName } ` ,
79
- {
80
- suffixes : this . config . extractingOptions . discriminatorMappingSuffix ,
81
- resolver :
82
- this . config . extractingOptions . discriminatorMappingNameResolver ,
83
- } ,
84
- ) ;
85
- this . schemaParserFabric . createSchema ( {
86
- linkedComponent : this . schemaComponentsMap . createComponent (
87
- this . schemaComponentsMap . createRef ( [
88
- 'components' ,
89
- 'schemas' ,
90
- mappingTypeName ,
91
- ] ) ,
77
+ const mappingTypeNameRef = this . schemaComponentsMap . createRef ( [
78
+ 'components' ,
79
+ 'schemas' ,
80
+ this . schemaUtils . resolveTypeName (
81
+ `${ abstractSchemaStruct . typeName } ${ discriminator . propertyName } ` ,
82
+ {
83
+ suffixes : this . config . extractingOptions . discriminatorMappingSuffix ,
84
+ resolver :
85
+ this . config . extractingOptions . discriminatorMappingNameResolver ,
86
+ } ,
92
87
) ,
88
+ ] ) ;
89
+ const mappingTypeNameComponent =
90
+ this . schemaComponentsMap . createComponent ( mappingTypeNameRef ) ;
91
+ const mappingTypeNameSchema = this . schemaParserFabric . createSchema ( {
92
+ linkedComponent : mappingTypeNameComponent ,
93
93
content : ts . IntersectionType ( [
94
94
ts . ObjectWrapper (
95
95
ts . TypeField ( {
@@ -102,6 +102,8 @@ class DiscriminatorSchemaParser extends MonoSchemaParser {
102
102
genericArgs : [ { name : 'Key' } , { name : 'Type' } ] ,
103
103
internal : true ,
104
104
} ) ;
105
+
106
+ mappingTypeName = mappingTypeNameSchema . typeData . name ;
105
107
}
106
108
107
109
/** returns (GenericType<"mapping_key", MappingType>) or ({ discriminatorProperty: "mapping_key" } & MappingType) */
0 commit comments