Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Added new attribute ProducesResponseTypeAttribute to enable ApiExplor… #4269

Closed
wants to merge 1 commit into from

Conversation

kichalla
Copy link
Member

…er to expose response type and StatusCode.

[Fixes #4101] StatusCode Metadata

@rynowak

/// Will be null if the action returns no response, or if the response type is unclear. Use
/// <c>ProducesAttribute</c> on an action method to specify a response type.
/// </remarks>
public Type ResponseType { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rynowak
Copy link
Member

rynowak commented Mar 14, 2016

this is overall looking good ⌚

@kichalla kichalla force-pushed the kiran/responsetype branch 6 times, most recently from 3a7c44b to f41a511 Compare March 18, 2016 18:21
@kichalla
Copy link
Member Author

🆙 📅

// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.AspNetCore.Mvc.Formatters;

namespace Microsoft.AspNetCore.Mvc.ApiExplorer
{
/// <summary>
/// Represents a possible format for the body of a response.
/// </summary>
public class ApiResponseFormat
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs new docs yo

var responseType = Assert.Single(description.SupportedResponseTypes
.Where(respData => respData.ResponseType == type && respData.StatusCode == 200));
Assert.Equal(4, responseType.ResponseFormats.Count);
Assert.Single(responseType.ResponseFormats, frmt => frmt.MediaType == "text/json");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't abbreviate

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still here

@rynowak
Copy link
Member

rynowak commented Mar 18, 2016

Looking overall good, lots of little cleanup things to do ⌚

public int StatusCode { get; set; }

/// <inheritdoc />
public void SetContentTypes(MediaTypeCollection contentTypes)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to implement this at all? I understand that it causes no harm, but it's confusing that it has this here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ApiExplorer would currently look for IApitResponseMetadataProvider and probably you are suggesting to break this interface up into 2?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we're not changing this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make it an explicit implementation just so it doesn't show up in the regular API surface?

@kichalla kichalla force-pushed the kiran/responsetype branch 5 times, most recently from eb1d3dd to bef2a4f Compare March 25, 2016 17:23
@kichalla
Copy link
Member Author

🆙 📅

@@ -6,18 +6,18 @@
namespace Microsoft.AspNetCore.Mvc.ApiExplorer
{
/// <summary>
/// Represents a possible format for the body of a response.
/// Possible format for an <see cref="ApiResponseType"/>.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential format?

@pranavkm
Copy link
Contributor

@kichalla kichalla force-pushed the kiran/responsetype branch 2 times, most recently from 80b0069 to 0637080 Compare March 29, 2016 16:28
@kichalla
Copy link
Member Author

🆙 📅 @rynowak @pranavkm

/// Gets or sets the CLR data type of the response or null.
/// </summary>
/// <remarks>
/// Will be null if the action returns no response, or if the response type is unclear. Use
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<c>null</c> if the ...

@pranavkm
Copy link
Contributor

:shipit: when @rynowak is happy.

@rynowak
Copy link
Member

rynowak commented Mar 29, 2016

:shipit:

…er to expose response type and StatusCode.

[Fixes #4101] StatusCode Metadata
@kichalla kichalla force-pushed the kiran/responsetype branch from 0637080 to 3670144 Compare March 30, 2016 14:29
@kichalla
Copy link
Member Author

6e9a6a2

@kichalla kichalla closed this Mar 30, 2016
@kichalla kichalla deleted the kiran/responsetype branch September 8, 2016 15:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants