Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

C# Comment Samples

Shweta Patil edited this page Apr 27, 2018 · 8 revisions

Url

Example: <url>http://localhost:9000/V1/samples</url>

Path Parameter

Examples:

  • Type of parameter is a primitive type

<param name="samplePathParam1" cref="float" in="path">Path param 1</param>

  • Type of parameter is a custom type

<param name="samplePathParam1" cref="SampleObject1" in="path">Path param 1</param>

Query Parameter

  • Type of parameter is a primitive type

<param name="sampleQueryParam1" cref="float" in="query">Query param 1</param>

  • Type of parameter is a custom type

<param name="sampleQueryParam1" cref="SampleObject1" in="query">Query param 1</param>

Header

  • Type of parameter is a primitive type

<param name="sampleHeaderParam1" cref="float" in="header">Header param 1</param>

  • Type of parameter is a custom type

<param name="sampleHeaderParam1" cref="SampleObject1" in="header">Header param 1</param>

Request Body

  • Type of parameter is a primitive type

<param name="sampleRequestContract" in="body">see cref="string"/>Request contract</param>

  • Type of parameter is a custom type

<param name="sampleRequestContract" in="body">see cref="SampleObject1"/>Request contract</param>

  • Type of parameter is a collection of custom type
/// <param name="sampleRequestContract" in="body">
/// <see cref="List{T}"/>
/// where T is <see cref="SampleObject2"/>
/// Request contract
/// </param>
  • Type of parameter is a Dictionary of custom type
/// <param name="sampleRequestContract" in="body">
/// <see cref="Dictionary{TKey, TValue}"/>
/// where TKey is <see cref="SampleObject1"/>
/// where TValue is <see cref="SampleObject4"/>
/// Request contract
/// </param>
  • Type of parameter is something like List<ISampleObject4<SampleObject1, SampleObject4>>
/// <param name="sampleRequestContract" in="body">
/// <see cref="List{T}"/>
/// where T is <see cref="ISampleObject4{T1,T2}"/>
/// where T1 is <see cref="SampleObject1"/>
/// where T2 is <see cref="SampleObject4"/>
/// Request contract
/// </param>

Response

  • 200 response with Type a primitive type

<response code="200"><see cref="string"/>Success</param>

  • 200 response with custom type

<response code="200"><see cref="SampleResponseObject"/>Success</param>

  • Multiple response codes(200,400)
/// <response code="200">
/// <see cref="List{T}"/>
/// where T is <see cref="ISampleObject4{T1,T2}"/>
/// where T1 is <see cref="SampleObject1"/>
/// where T2 is <see cref="SampleObject4"/>
/// List of sample objects
/// </response>
/// <response code="400"><see cref="string"/>Bad request</response>
  • Polymorphic response code(i.e. if a response code can be of multiple types)
/// <response code="200"><see cref="string"/></response>
/// <response code="200">
/// <see cref="List{T}"/>/// where T is <see cref="SampleObject1"/>
/// List of sample objects
/// </response>
  • Response with complex types please refer to see cref examples for Requst Contract
Clone this wiki locally