diff --git a/src/Stratis.Features.Unity3dApi/Controllers/Unity3dController.cs b/src/Stratis.Features.Unity3dApi/Controllers/Unity3dController.cs
index a9cc196c89..97f028ccd1 100644
--- a/src/Stratis.Features.Unity3dApi/Controllers/Unity3dController.cs
+++ b/src/Stratis.Features.Unity3dApi/Controllers/Unity3dController.cs
@@ -187,7 +187,7 @@ public GetUTXOsResponseModel GetUTXOsForAddress([FromQuery] string address)
/// Unexpected exception occurred
[Route("getaddressbalance")]
[HttpGet]
- [ProducesResponseType((int)HttpStatusCode.OK)]
+ [ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(GetBalanceResponseModel))]
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
public IActionResult GetAddressBalance(string address)
{
@@ -304,10 +304,10 @@ public RawTxModel GetRawTransaction([FromQuery] string trxid)
/// Request is null
[Route("send-transaction")]
[HttpPost]
- [ProducesResponseType((int)HttpStatusCode.OK)]
- [ProducesResponseType((int)HttpStatusCode.BadRequest)]
- [ProducesResponseType((int)HttpStatusCode.Forbidden)]
- [ProducesResponseType((int)HttpStatusCode.InternalServerError)]
+ [ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(WalletSendTransactionModel))]
+ [ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(ErrorResult))]
+ [ProducesResponseType((int)HttpStatusCode.Forbidden, Type = typeof(ErrorResult))]
+ [ProducesResponseType((int)HttpStatusCode.InternalServerError, Type = typeof(ErrorResult))]
public async Task SendTransactionAsync([FromBody] SendTransactionRequest request,
CancellationToken cancellationToken = default(CancellationToken))
{
@@ -521,9 +521,9 @@ public ReceiptResponse GetReceiptAPI([FromQuery] string txHash)
/// Unable to deserialize method parameters
[Route("local-call")]
[HttpPost]
- [ProducesResponseType((int)HttpStatusCode.OK)]
- [ProducesResponseType((int)HttpStatusCode.BadRequest)]
- [ProducesResponseType((int)HttpStatusCode.InternalServerError)]
+ [ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(ILocalExecutionResult))]
+ [ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(ErrorResult))]
+ [ProducesResponseType((int)HttpStatusCode.InternalServerError, Type = typeof(ErrorResult))]
public IActionResult LocalCallSmartContractTransaction([FromBody] LocalCallContractRequest request)
{
if (!this.ModelState.IsValid)
diff --git a/src/Stratis.Features.Unity3dApi/Startup.cs b/src/Stratis.Features.Unity3dApi/Startup.cs
index 446a76afe0..b9aed389e3 100644
--- a/src/Stratis.Features.Unity3dApi/Startup.cs
+++ b/src/Stratis.Features.Unity3dApi/Startup.cs
@@ -8,6 +8,9 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
+using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Models;
+using NBitcoin;
using Newtonsoft.Json.Serialization;
using Stratis.Bitcoin;
using Stratis.Bitcoin.Features.Api;
@@ -128,7 +131,26 @@ public void ConfigureServices(IServiceCollection services)
services.AddTransient, ConfigureSwaggerOptions>();
// Register the Swagger generator. This will use the options we injected just above.
- services.AddSwaggerGen();
+ services.AddSwaggerGen(options => {
+ options.MapType(typeof(Money), () => new OpenApiSchema
+ {
+ Type = "integer",
+ Example = new OpenApiInteger(9999)
+ });
+
+ options.MapType(typeof(uint160), () => new OpenApiSchema
+ {
+ Type = "string",
+ Example = new OpenApiString("ffffffffffffffffffffffffffffffffffffffff")
+ });
+
+ options.MapType(typeof(uint256), () => new OpenApiSchema
+ {
+ Type = "string",
+ Example = new OpenApiString("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
+ });
+ });
+
services.AddSwaggerGenNewtonsoftSupport(); // Use Newtonsoft JSON serializer with swagger. Needs to be placed after AddSwaggerGen()
// Hack to be able to access and modify the options object