@@ -74,22 +74,22 @@ class DiscriminatorSchemaParser extends MonoSchemaParser {
7474 } ) ;
7575
7676 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+ } ,
9287 ) ,
88+ ] ) ;
89+ const mappingTypeNameComponent =
90+ this . schemaComponentsMap . createComponent ( mappingTypeNameRef ) ;
91+ const mappingTypeNameSchema = this . schemaParserFabric . createSchema ( {
92+ linkedComponent : mappingTypeNameComponent ,
9393 content : ts . IntersectionType ( [
9494 ts . ObjectWrapper (
9595 ts . TypeField ( {
@@ -102,6 +102,8 @@ class DiscriminatorSchemaParser extends MonoSchemaParser {
102102 genericArgs : [ { name : 'Key' } , { name : 'Type' } ] ,
103103 internal : true ,
104104 } ) ;
105+
106+ mappingTypeName = mappingTypeNameSchema . typeData . name ;
105107 }
106108
107109 /** returns (GenericType<"mapping_key", MappingType>) or ({ discriminatorProperty: "mapping_key" } & MappingType) */
0 commit comments