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

Add support for [Consumes] to ApiDescription #3818

Closed
rynowak opened this issue Dec 28, 2015 · 1 comment
Closed

Add support for [Consumes] to ApiDescription #3818

rynowak opened this issue Dec 28, 2015 · 1 comment
Assignees
Milestone

Comments

@rynowak
Copy link
Member

rynowak commented Dec 28, 2015

I'm thinking something like this

public IList<ApiRequestFormat> SupportedRequestFormats { get; set; }
public class ApiRequestFormat
{
    public MediaTypeHeaderValue ContentType { get; set; }

    public IInputFormatter Formatter { get; set; }
}
@rynowak rynowak added this to the 6.0.0-rc2 milestone Jan 7, 2016
@rynowak rynowak self-assigned this Jan 7, 2016
rynowak added a commit that referenced this issue Jan 8, 2016
This change adds a list of ApiRequestFormat objects to ApiDescription
object which include the content type and formatter for each supported
content type which can be understood by the action.

Computation is aware of the [Consumes] attribute via the
IApiRequestMetadataProvider metadata interface, and aware of Input
Formatters via the new IApiRequestFormatMetadataProvider interface.

This algorithm is essentially the same as what we do for
produces/output-formatters. We iterate the filters and ask them what
content types they think are supported. Then we cross check that list with
the formatters, and ask them which from that list are supported. If no
[Consumes] filters are used, the formatters will include everything they
support by default.

This feature and data is only available when an action has a [FromBody]
parameter, which will naturally exclude actions that handle GET or DELETE
and don't process the body.
rynowak added a commit that referenced this issue Jan 8, 2016
This change adds a list of ApiRequestFormat objects to ApiDescription
object which include the content type and formatter for each supported
content type which can be understood by the action.

Computation is aware of the [Consumes] attribute via the
IApiRequestMetadataProvider metadata interface, and aware of Input
Formatters via the new IApiRequestFormatMetadataProvider interface.

This algorithm is essentially the same as what we do for
produces/output-formatters. We iterate the filters and ask them what
content types they think are supported. Then we cross check that list with
the formatters, and ask them which from that list are supported. If no
[Consumes] filters are used, the formatters will include everything they
support by default.

This feature and data is only available when an action has a [FromBody]
parameter, which will naturally exclude actions that handle GET or DELETE
and don't process the body.
@rynowak
Copy link
Member Author

rynowak commented Jan 13, 2016

420f442

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant