0

I am new to swagger and asp.net core. While executing an endpoint, instead showing jSon schema want to show sample data so that user can understand what exactly the API is looking for.

enter image description here

enter image description here

In my application it is showing like the 1st pic but I want like the 2nd pic. Can anyone help me doing this. Advance thanks.

Class used as below...

Public class Employee{
public string parameter1 { get; set; }
public string parameter2 { get; set; }
public string parameter3 { get; set; }
public string parameter4 { get; set; }
public int parameter5 { get; set; }
public int parameter6 { get; set; }
}
Helen
  • 87,344
  • 17
  • 243
  • 314
Monibrata
  • 427
  • 4
  • 10
  • 25
  • Most OpenAPI-based frameworks have annotations to specify example values for parameters and object properties. Do you use Swashbuckle, Swagger-Net, something else? How is this class defined in your code? (Please edit your question and add the code.) – Helen Sep 16 '21 at 11:45
  • Thanks @Helen, yes I am using Swashbuckle and the API version is 2.0 – Monibrata Sep 16 '21 at 11:48
  • You need to add XML comments with the `` tag, as explained in the [linked Q&A](https://stackoverflow.com/a/61955594/113116). – Helen Sep 16 '21 at 13:25

0 Answers0