Skip to content

Commit

Permalink
Merge branch 'release/swagger-2.0.0' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
justinyoo committed Jul 19, 2020
2 parents 91a020d + 97f0a02 commit 68f18a1
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions docs/openapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,16 +233,18 @@ public static async Task<IActionResult> PostSample(

* `ContentType`: defines the content type of the request body payload. eg) `application/json` or `text/xml`
* `BodyType`: defines the type of the request payload.
* `Description`: is the description of the request body payload.
* `Summary`: is the summary of the request payload.
* `Description`: is the description of the request payload.
* `Required`: indicates whether the request payload is mandatory or not.


### `OpenApiResponseBodyAttribute` ###
### `OpenApiResponseWithBodyAttribute` ###

This decorator implements the [Response object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#responseObject) spec.

```csharp
[FunctionName(nameof(PostSample))]
[OpenApiResponseBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(SampleResponseModel))]
[OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(SampleResponseModel))]
...
public static async Task<IActionResult> PostSample(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = "samples")] HttpRequest req,
Expand All @@ -253,10 +255,31 @@ public static async Task<IActionResult> PostSample(
```

* `StatusCode`: defines the HTTP status code. eg) `HttpStatusCode.OK`
* `ContentType`: defines the content type of the response body payload. eg) `application/json` or `text/xml`
* `ContentType`: defines the content type of the response payload. eg) `application/json` or `text/xml`
* `BodyType`: defines the type of the response payload.
* `Description`: is the description of the response body payload.
* `Summary`: is the summary of the response body payload.
* `Summary`: is the summary of the response.
* `Description`: is the description of the response.


### `OpenApiResponseWithoutBodyAttribute` ###

This decorator implements the [Response object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#responseObject) spec.

```csharp
[FunctionName(nameof(PostSample))]
[OpenApiResponseWithoutBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(SampleResponseModel))]
...
public static async Task<IActionResult> PostSample(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = "samples")] HttpRequest req,
ILogger log)
{
...
}
```

* `StatusCode`: defines the HTTP status code. eg) `HttpStatusCode.OK`
* `Summary`: is the summary of the response.
* `Description`: is the description of the response.


## Supported Json.NET Decorators ##
Expand Down

0 comments on commit 68f18a1

Please sign in to comment.