You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// EndpointMetadataApiDescriptionProvider performs a one way type check for discovering response types to match the description that's set in [ProducesResponseType]
469
+
/// The reason we do a one-way check instead of a bidirectional check is to prevent too many positive matches.
470
+
/// </summary>
471
+
/// <remarks>
472
+
/// Example: If we did a bidirectional check, we would match something scenarios like this, which can cause confusion:
473
+
/// [ProducesResponseType<string>(StatusCodes.Status200OK, Description = "Returned with a string")] -> TypedResults.Ok(new object())
474
+
/// This would match because object is assignable to string,
475
+
/// but it doesn't make sense to add the Description to the object type because the attribute says we should return a string.
476
+
///
477
+
/// This test documents this desired behavior and will fail if the behavior changes, so the developer can double check if their change is intentional.
Assert.Equal(typeof(IEnumerable<BaseClass>),okResponseType.Type);// We use IEnumerable<BaseClass> as the inferred type has higher priority than those set by metadata (attributes)
0 commit comments