Skip to content

Swagger Query Parameter name prefix #1438

@ssghoda

Description

@ssghoda

I have a Request class as follows:

public class GetCareTypesRequest
    {
        /// <summary>Tpa Partition</summary>
        [Required]
        public string TpaPartition { get; set; }
    }

I am passing entire object as a single query parameter instead of individual in Controller method as follows:

public async Task<IHttpActionResult> Get([FromUri] GetCareTypesRequest request) {}

When I go to Swagger page, I am seeing "request" as a prefix for TpaPartition parameter:
image

Even Request URI is coming as: http://localhost:52354/api/CareTypes?request.tpaPartition=0000010000010001

I am expecting it to be like: http://localhost:52354/api/CareTypes?tpaPartition=0000010000010001 and I still want to send entire object as a single query parameter.

What should I do to achieve this? I came across few articles which suggest to create a custom Filter but any easy way would be very helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions