1

One of my action parameters is instance of class which have param1, param2, param3 parameters (with [FromUri] attribute and I can't replace it with [FromBody])
And that parameters are in routing too.

When asp.net web api help page generates parameters from action I am getting duplicates of them in URI parameters.
How can I ignore one of them?

Marco Bagiacchi
  • 334
  • 2
  • 20
Aren
  • 11
  • 2

1 Answers1

0

In Areas\HelpPage\HelpPageConfigurationExtensions.cs find the method GenerateUriParameters and comment out the else clause.

else
{
    Debug.Assert(parameterDescriptor == null);

    // If parameterDescriptor is null, this is an undeclared route parameter which only occurs
    // when source is FromUri. Ignored in request model and among resource parameters but listed
    // as a simple string here.
    ModelDescription modelDescription = modelGenerator.GetOrCreateModelDescription(typeof(string));
    AddParameterDescription(apiModel, apiParameter, modelDescription);
}

Note that this might remove too many parameters from your help pages if you don't consistently use [FromUri]

Arne
  • 145
  • 1
  • 9