daxu
daxu

Reputation: 4084

why swashbuckle not showing request schema link in my .net 6 web api project?

I use swashbuckle to generate a swagger page. In response part, I can see schema link: enter image description here

But at the request part, I only see example, but not schema link: enter image description here

This is my c# code

        [HttpPost]
        [ApiVersion("2.0")]
        [Route("v2.0/Data")]
        [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(FundInfoSimpleResponse))]  
        [SwaggerRequestExample(typeof(FundInfoSimpleRequestV11), typeof(FundInfoSimpleRequestExampleV11))]
        [SwaggerResponseExample((int)HttpStatusCode.OK, typeof(FundInfoSimpleResponseExample))]
        public async Task<HttpResponseMessageResult> FundInfoSimple([FromBody] FundInfoSimpleRequestV11 request)
        

What am I missing?

Upvotes: 0

Views: 344

Answers (1)

Loul G.
Loul G.

Reputation: 1105

The schema is only displayed when you are not in Try it out mode. By the way, one can change the default behavior by using:

app.UseSwaggerUI(options =>
{
    options.EnableTryItOutByDefault();
});

Upvotes: 0

Related Questions