Class EndpointSummary
a class used for providing a textual description about an endpoint for swagger
Inherited Members
Namespace: FastEndpoints
Assembly: FastEndpoints.dll
Syntax
public class EndpointSummary
Properties
Description
the long description of the endpoint
Declaration
public string Description { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ExampleRequest
an example request object to be used in swagger/ openapi.
Declaration
public object ExampleRequest { get; set; }
Property Value
Type | Description |
---|---|
System.Object |
Item[Int32]
indexer for the response descriptions
Declaration
public string this[int statusCode] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | statusCode | the status code of the response you want to access |
Property Value
Type | Description |
---|---|
System.String | the text description |
Params
the descriptions for endpoint paramaters. you can add descriptions for route/query params and request dto properties. what you specify here will take precedence over xml comments of dto classes (if they are also specified).
Declaration
public Dictionary<string, string> Params { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.String> |
ResponseExamples
the response examples for each status code
Declaration
public Dictionary<int, object> ResponseExamples { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.Int32, System.Object> |
Responses
the descriptions of the different responses/ status codes an endpoint can return
Declaration
public Dictionary<int, string> Responses { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.Int32, System.String> |
Summary
the short summary of the endpoint
Declaration
public string Summary { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
Response(Int32, String, String)
add a response description that doesn't have a response dto to the swagger document NOTE: if you use the this method, the default 200 response is automatically removed, and you'd have to specify the 200 response yourself if it applies to your endpoint.
Declaration
public void Response(int statusCode = 200, string description = null, string contentType = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | statusCode | http status code |
System.String | description | the description of the response |
System.String | contentType | the media/content type of the response |
Response<TResponse>(Int32, String, String, TResponse)
add a response description to the swagger document
NOTE: if you use the this method, the default 200 response is automatically removed, and you'd have to specify the 200 response yourself if it applies to your endpoint.
Declaration
public void Response<TResponse>(int statusCode = 200, string description = null, string contentType = "application/json", TResponse example = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | statusCode | http status code |
System.String | description | the description of the response |
System.String | contentType | the media/content type of the response |
TResponse | example | and example response dto instance |
Type Parameters
Name | Description |
---|---|
TResponse | the type of the response dto |
ResponseParam<TResponse>(Int32, Expression<Func<TResponse, Object>>, String)
add a description for a given property of a given response dto
Declaration
public void ResponseParam<TResponse>(int statusCode, Expression<Func<TResponse, object>> property, string description)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | statusCode | the status code of the response you want to add the descriptions for |
System.Linq.Expressions.Expression<System.Func<TResponse, System.Object>> | property | a member expression for specifying which property the description is for |
System.String | description | the description text |
Type Parameters
Name | Description |
---|---|
TResponse |
ResponseParam<TResponse>(Expression<Func<TResponse, Object>>, String)
add a description for a given property of the 200 response dto
Declaration
public void ResponseParam<TResponse>(Expression<Func<TResponse, object>> property, string description)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<TResponse, System.Object>> | property | a member expression for specifying which property the description is for |
System.String | description | the description text |
Type Parameters
Name | Description |
---|---|
TResponse |