Skip to content

Commit f068091

Browse files
authored
Merge pull request #404 from DFE-Digital/trusts-v3-swagger
Trust endpoints annotations
2 parents e82d22e + 8fc2a64 commit f068091

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

TramsDataApi/Controllers/V3/TrustsController.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22
using System.Text.Json;
33
using Microsoft.AspNetCore.Mvc;
44
using Microsoft.Extensions.Logging;
5+
using Swashbuckle.AspNetCore.Annotations;
56
using TramsDataApi.ResponseModels;
67
using TramsDataApi.UseCases;
78

89
namespace TramsDataApi.Controllers.V3
910
{
11+
/// <summary>
12+
/// Manages operations related to trusts using the Master schema.
13+
/// </summary>
1014
[ApiVersion("3.0")]
1115
[ApiController]
1216
[Route("v{version:apiVersion}/")]
17+
[SwaggerTag("Operations related to Trusts using the Master schema")]
1318
public class TrustsController : ControllerBase
1419
{
1520
private readonly IGetMstrTrustByUkprn _getMstrTrustByUkPrn;
@@ -23,8 +28,16 @@ public TrustsController(IGetMstrTrustByUkprn getMstrTrustByUkPrn, IMstrSearchTru
2328
_logger = logger;
2429
}
2530

31+
/// <summary>
32+
/// Searches for trusts based on given criteria.
33+
/// </summary>
34+
/// <remarks>
35+
/// Search can be performed using the groupName, ukPrn, and companiesHouseNumber parameters.
36+
/// </remarks>
2637
[HttpGet("trusts")]
2738
[MapToApiVersion("3.0")]
39+
[SwaggerOperation(Summary = "Search Trusts", Description = "Search for trusts using the specified parameters, within the Master schema.")]
40+
[SwaggerResponse(200, "Successfully found and returned the list of trusts.")]
2841
public ActionResult<ApiResponseV2<TrustSummaryResponse>> SearchTrusts(string groupName, string ukPrn, string companiesHouseNumber,
2942
int page = 1, int count = 50, bool includeEstablishments = true)
3043
{
@@ -50,9 +63,15 @@ public ActionResult<ApiResponseV2<TrustSummaryResponse>> SearchTrusts(string gro
5063
return new OkObjectResult(response);
5164
}
5265

66+
/// <summary>
67+
/// Retrieves a specific trust by UKPRN.
68+
/// </summary>
5369
[HttpGet]
5470
[Route("trust/{ukprn}")]
5571
[MapToApiVersion("3.0")]
72+
[SwaggerOperation(Summary = "Get Trust By UKPRN", Description = "Retrieve a single trust by its UKPRN.")]
73+
[SwaggerResponse(200, "Successfully retrieved the trust.")]
74+
[SwaggerResponse(404, "The trust was not found.")]
5675
public ActionResult<ApiSingleResponseV2<MasterTrustResponse>> GetTrustByUkPrn(string ukprn)
5776
{
5877
_logger.LogInformation("Attempting to get trust by UKPRN {prn}", ukprn);

0 commit comments

Comments
 (0)