Search code examples
asp.net-coreswaggerswagger-uiswashbuckle

How to show schema in json paramater in multipart/form-data in Swagger UI?


I'm using OpenApi 3.0 and Swagger UI.

(Swashbuckle and ASP.Net Core if it's important)

I have multipart/form-data which has 2 parameter:

  • ProductToAdd object description in JSON
  • Image as file.

I have schemas and examples defined.

For now I managed to do this My result

And I'm targeting something like this:

Target result

My question is how to render schemas and examples like in the second pictures? I didn't find anything helpful in swagger.json and so.

Ps. Execute work perfectly if you are curious.

@edit

I've made nuget package for that. You can find it here


Solution

  • Currently (as of August 2023) Swagger UI does not display the schemas of object-type fields in multipart/* requests, it only displays the example values for these fields. Here's the corresponding feature request:

    Display static documentation information for multipart properties in OpenAPI 3.0 files