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 |
|---|---|
| string |
ExampleRequest
an example request object to be used in swagger/ openapi. multiple examples can be specified by setting this property multiple times or by adding to the RequestExamples collection.
Declaration
public object? ExampleRequest { get; set; }
Property Value
| Type | Description |
|---|---|
| object |
this[int]
indexer for the response descriptions
Declaration
public string this[int statusCode] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | statusCode | the status code of the response you want to access |
Property Value
| Type | Description |
|---|---|
| string | the text description |
Params
the descriptions for endpoint parameters. 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 |
|---|---|
| Dictionary<string, string> |
RequestExamples
specify multiple request examples by adding to this collection.
Declaration
public ICollection<RequestExample> RequestExamples { get; }
Property Value
| Type | Description |
|---|---|
| ICollection<RequestExample> |
ResponseExamples
the response examples for each status code
Declaration
public Dictionary<int, object> ResponseExamples { get; set; }
Property Value
| Type | Description |
|---|---|
| Dictionary<int, object> |
ResponseHeaders
Declaration
public List<ResponseHeader> ResponseHeaders { get; set; }
Property Value
| Type | Description |
|---|---|
| List<ResponseHeader> |
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 |
|---|---|
| Dictionary<int, string> |
Summary
the short summary of the endpoint
Declaration
public string Summary { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
Response(int, string?, string?)
add a response description that doesn't have a response dto to the swagger document NOTE: if you use 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 |
|---|---|---|
| int | statusCode | http status code |
| string | description | the description of the response |
| string | contentType | the media/content type of the response |
ResponseParam<TResponse>(int, 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 |
|---|---|---|
| int | statusCode | the status code of the response you want to add the descriptions for |
| Expression<Func<TResponse, object>> | property | a member expression for specifying which property the description is for |
| 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 |
|---|---|---|
| Expression<Func<TResponse, object>> | property | a member expression for specifying which property the description is for |
| string | description | the description text |
Type Parameters
| Name | Description |
|---|---|
| TResponse |
Response<TResponse>(int, string?, string, TResponse?)
add a response description to the swagger document
NOTE: if you use 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 = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | statusCode | http status code |
| string | description | the description of the response |
| 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 |