0

Below code for generating a endpoint and documentation in swagger.

I need to add description to the name property which is a part of DataObjectResponse. But cant find a way to do it.

        /// <summary>
        /// Get something
        /// </summary>
        /// <returns>An http action result</returns>
        public DataObjectResponse SomeMethod([FromQuery] DataObjectRequest core){
        }
      

        public class DataObjectRequest {
        public string Name {get; set;}
        }

Generally description can be added to query parameters using

       /// <summary>
       /// Get something
       /// </summary>
       /// <returns>An http action result</returns>
       /// <param name="name">Description for name</param>
       public DataObjectResponse SomeMethod(string Name){
       }

But am unable to find a way to add description for a property inside a object

Sunny
  • 754
  • 6
  • 19

1 Answers1

0

Does this help answer your question?

How to add method description in Swagger UI in WebAPI Application

There are annotations you can use to define a lot of the variables that your endpoints deal with.

Jeff B
  • 455
  • 4
  • 15
  • Nope. That page really talks about how to add comments to show up in swagger doc, That part is working for me. – Sunny Feb 11 '21 at 11:40