Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger Query Parameter name prefix #1438

Open
ssghoda opened this issue Jan 26, 2023 · 0 comments
Open

Swagger Query Parameter name prefix #1438

ssghoda opened this issue Jan 26, 2023 · 0 comments

Comments

@ssghoda
Copy link

ssghoda commented Jan 26, 2023

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.

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

No branches or pull requests

1 participant