Skip to content

Instantly share code, notes, and snippets.

@CoditCompany
Last active April 13, 2018 16:46
Show Gist options
  • Save CoditCompany/124c83c6194c66ab5ddb82665ae74cb5 to your computer and use it in GitHub Desktop.
Save CoditCompany/124c83c6194c66ab5ddb82665ae74cb5 to your computer and use it in GitHub Desktop.
Changes to OpenAPI interpretation in Azure API Management
/// <summary>
/// Gets the current health status of the API
/// </summary>
[HttpGet]
[Route("health")]
[SwaggerOperation("Get Health")]
[SwaggerResponse(HttpStatusCode.OK, "API is up & running")]
[SwaggerResponse(HttpStatusCode.InternalServerError, "API is not available")]
public IHttpActionResult Get()
{
return Ok();
}
{
"swagger": "2.0",
"info": { ... }
},
"host": "localhost:1337",
"schemes": ["https"],
"paths": {
"/api/v1/health": {
"get": {
"tags": ["Health"],
"summary": "Gets the current health status of the API",
"operationId": "Get Health",
"consumes": [],
"produces": ["application/json"],
"responses": {
"200": {
"description": "API is up & running"
},
"500": {
"description": "API is not available"
}
}
}
}
},
"definitions": { }
}
/// <summary>
/// Get Health
/// </summary>
/// <remarks>Gets the current health status of the API</remarks>
[HttpGet]
[Route("health")]
[SwaggerOperation("get-health")]
[SwaggerResponse(HttpStatusCode.OK, "API is up & running")]
[SwaggerResponse(HttpStatusCode.InternalServerError, "API is not available")]
public IHttpActionResult Get()
{
return Ok();
}
{
"swagger": "2.0",
"info": { ... }
},
"host": "localhost:1337",
"schemes": ["https"],
"paths": {
"/api/v1/health": {
"get": {
"tags": ["Health"],
"summary": "Get Health",
"description": "Gets the current health status of the API",
"operationId": "get-health",
"consumes": [],
"produces": ["application/json"],
"responses": {
"200": {
"description": "API is up & running"
},
"500": {
"description": "API is not available"
}
}
}
}
},
"definitions": { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment