@@ -247,26 +247,47 @@ private void CheckForChangedOutputType(
247
247
248
248
_typeMetadataHelper . CheckOutputType ( oldCmdlet , oldOutput . Type , newOutputType , issueLogger ) ;
249
249
}
250
- // If the output cannot be found by name, check if the old output can be mapped
251
- // to any of the new output types
252
250
else
253
251
{
254
- var foundOutput = outputDictionary . Values . Any ( o => _typeMetadataHelper . CompareTypeMetadata ( oldCmdlet , oldOutput . Type , o , null ) ) ;
255
- if ( ! foundOutput )
252
+ string oldOutputTypeName = RemoveApiVersionInTypeName ( oldOutput . Type . Name ) ;
253
+ bool foundTypeNameWithoutApiVersion = false ;
254
+ foreach ( var newOutput in outputDictionary . Values )
256
255
{
257
- issueLogger ? . LogBreakingChangeIssue (
258
- cmdlet : oldCmdlet ,
259
- severity : 0 ,
260
- problemId : ProblemIds . BreakingChangeProblemId . ChangedOutputType ,
261
- description : string . Format ( Resources . ChangedOutputTypeDescription ,
262
- oldCmdlet . Name , oldOutput . Type . Name ) ,
263
- remediation : string . Format ( Resources . ChangedOutputTypeRemediation ,
264
- oldCmdlet . Name , oldOutput . Type . Name ) ) ;
256
+ string newOutputTypeName = RemoveApiVersionInTypeName ( newOutput . Name ) ;
257
+ System . Console . WriteLine ( newOutputTypeName ) ;
258
+ if ( oldOutputTypeName . Equals ( newOutputTypeName , StringComparison . OrdinalIgnoreCase ) )
259
+ {
260
+ _typeMetadataHelper . CheckOutputType ( oldCmdlet , oldOutput . Type , newOutput , issueLogger ) ;
261
+ foundTypeNameWithoutApiVersion = true ;
262
+ break ;
263
+ }
264
+ }
265
+ if ( ! foundTypeNameWithoutApiVersion )
266
+ {
267
+ // If the output cannot be found by name, check if the old output can be mapped
268
+ // to any of the new output types
269
+ var foundOutput = outputDictionary . Values . Any ( o => _typeMetadataHelper . CompareTypeMetadata ( oldCmdlet , oldOutput . Type , o , null ) ) ;
270
+ if ( ! foundOutput )
271
+ {
272
+ issueLogger ? . LogBreakingChangeIssue (
273
+ cmdlet : oldCmdlet ,
274
+ severity : 0 ,
275
+ problemId : ProblemIds . BreakingChangeProblemId . ChangedOutputType ,
276
+ description : string . Format ( Resources . ChangedOutputTypeDescription ,
277
+ oldCmdlet . Name , oldOutput . Type . Name ) ,
278
+ remediation : string . Format ( Resources . ChangedOutputTypeRemediation ,
279
+ oldCmdlet . Name , oldOutput . Type . Name ) ) ;
280
+ }
265
281
}
266
282
}
267
283
}
268
284
}
269
285
286
+ private string RemoveApiVersionInTypeName ( string typeName )
287
+ {
288
+ return Regex . Replace ( typeName , @"\.Api\d+(Preview)?" , "" ) ;
289
+ }
290
+
270
291
/// <summary>
271
292
/// Check if the default parameter set has changed, and if so, make sure
272
293
/// that the parameters are the same
0 commit comments