Skip to content

Commit d11ca3c

Browse files
DanielVanNoordonekiloparsec
authored andcommitted
Moved HTML to it's own Swagger Document
1 parent 93580b4 commit d11ca3c

2 files changed

Lines changed: 7 additions & 15 deletions

File tree

ASCOM.Alpaca.Razor/StartupHelpers.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ public static void ConfigureSwagger(IServiceCollection services, string host_xml
3232
//This is off for now
3333
//c.UseOneOfForPolymorphism();
3434

35-
c.SwaggerDoc("Alpaca", new OpenApiInfo { Title = $"{DeviceManager.Configuration.ServerName}", Description = "Please note that the Alpaca API documentation on the ASCOM website is the canonical version. There are several issues with this auto generated version that will be resolved in future versions. This is currently provided only for testing..", Version = "v1" });
36-
c.SwaggerDoc("OmniSim", new OpenApiInfo { Title = "OmniSim Setup", Version = "v1" });
35+
c.SwaggerDoc("Alpaca", new OpenApiInfo { Title = $"{DeviceManager.Configuration.ServerName}", Description = "The Alpaca JSON API Specification. You can find the Alpaca HTML Specification and the OmniSim only configuration specification in the drop down. Please note that the Alpaca API documentation on the ASCOM website is the canonical version. There are several issues with this auto generated version that will be resolved in future versions. This is currently provided only for testing.", Version = "v1" });
36+
c.SwaggerDoc("AlpacaSetup", new OpenApiInfo { Title = $"{DeviceManager.Configuration.ServerName}", Description = "Alpaca HTML Setup API - These are used to give the end user a GUI to configure device specific settings.", Version = "v1" });
37+
c.SwaggerDoc("OmniSim", new OpenApiInfo { Title = "OmniSim JSON API", Description="API configuration that is unique to the OmniSim. These are not part of the Alpaca Spec but are helpful to automate testing with the OmniSim.", Version = "v1" });
3738

3839

3940
if (File.Exists(host_xml_file))
@@ -81,7 +82,9 @@ public static void ConfigureSwagger(IApplicationBuilder app)
8182
app.UseSwagger();
8283
app.UseSwaggerUI(c => {
8384
c.SwaggerEndpoint("/swagger/Alpaca/swagger.json",
84-
$"Alpaca Endpoints - v1");
85+
$"Alpaca JSON Endpoints - v1");
86+
c.SwaggerEndpoint("/swagger/AlpacaSetup/swagger.json",
87+
$"Alpaca HTML Endpoints - v1");
8588
c.SwaggerEndpoint("/swagger/OmniSim/swagger.json", "OmniSim Only Endpoints");
8689
c.DocExpansion(DocExpansion.None);
8790
});

ASCOM.Alpaca.Simulators/Controllers/SetupController.cs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
using Octokit;
99
using System.Xml;
1010
using OmniSim.BaseDriver;
11-
using static System.Runtime.InteropServices.JavaScript.JSType;
1211
using Microsoft.AspNetCore.Mvc.RazorPages;
1312
using System.IO;
1413

1514
namespace ASCOM.Alpaca.Simulators.Controllers
1615
{
16+
[ApiExplorerSettings(GroupName = "AlpacaSetup")]
1717
public class SetupController : Controller
1818
{
1919
/// <summary>
@@ -29,7 +29,6 @@ public class SetupController : Controller
2929
/// <response code="500" examples="Error message describing why the command cannot be processed">Server internal error, check error message</response>
3030
[HttpGet]
3131
[Produces(MediaTypeNames.Text.Html)]
32-
[ApiExplorerSettings(GroupName = "Alpaca")]
3332
[FeatureGate("HideAlpacaUI")]
3433
[Route("/setup")]
3534
public ActionResult<string> ServerSetup([Required][DefaultValue(0)][SwaggerSchema(Strings.DeviceIDDescription, Format = "uint32")][Range(0, 4294967295)] uint DeviceNumber)
@@ -50,7 +49,6 @@ public ActionResult<string> ServerSetup([Required][DefaultValue(0)][SwaggerSchem
5049
/// <response code="500" examples="Error message describing why the command cannot be processed">Server internal error, check error message</response>
5150
[HttpGet]
5251
[Produces(MediaTypeNames.Text.Html)]
53-
[ApiExplorerSettings(GroupName = "Alpaca")]
5452
[FeatureGate("HideAlpacaUI")]
5553
[Route("/setup/v1/camera/{DeviceNumber}/setup")]
5654
public ActionResult<string> CameraSetup([Required][DefaultValue(0)][SwaggerSchema(Strings.DeviceIDDescription, Format = "uint32")][Range(0, 4294967295)] uint DeviceNumber)
@@ -71,7 +69,6 @@ public ActionResult<string> CameraSetup([Required][DefaultValue(0)][SwaggerSchem
7169
/// <response code="500" examples="Error message describing why the command cannot be processed">Server internal error, check error message</response>
7270
[HttpGet]
7371
[Produces(MediaTypeNames.Text.Html)]
74-
[ApiExplorerSettings(GroupName = "Alpaca")]
7572
[FeatureGate("HideAlpacaUI")]
7673
[Route("/setup/v1/covercalibrator/{DeviceNumber}/setup")]
7774
public ActionResult<string> CoverCalibratorSetup([Required][DefaultValue(0)][SwaggerSchema(Strings.DeviceIDDescription, Format = "uint32")][Range(0, 4294967295)] uint DeviceNumber)
@@ -92,7 +89,6 @@ public ActionResult<string> CoverCalibratorSetup([Required][DefaultValue(0)][Swa
9289
/// <response code="500" examples="Error message describing why the command cannot be processed">Server internal error, check error message</response>
9390
[HttpGet]
9491
[Produces(MediaTypeNames.Text.Html)]
95-
[ApiExplorerSettings(GroupName = "Alpaca")]
9692
[FeatureGate("HideAlpacaUI")]
9793
[Route("/setup/v1/dome/{DeviceNumber}/setup")]
9894
public ActionResult<string> DomeSetup([Required][DefaultValue(0)][SwaggerSchema(Strings.DeviceIDDescription, Format = "uint32")][Range(0, 4294967295)] uint DeviceNumber)
@@ -113,7 +109,6 @@ public ActionResult<string> DomeSetup([Required][DefaultValue(0)][SwaggerSchema(
113109
/// <response code="500" examples="Error message describing why the command cannot be processed">Server internal error, check error message</response>
114110
[HttpGet]
115111
[Produces(MediaTypeNames.Text.Html)]
116-
[ApiExplorerSettings(GroupName = "Alpaca")]
117112
[FeatureGate("HideAlpacaUI")]
118113
[Route("/setup/v1/filterwheel/{DeviceNumber}/setup")]
119114
public ActionResult<string> FilterWheelSetup([Required][DefaultValue(0)][SwaggerSchema(Strings.DeviceIDDescription, Format = "uint32")][Range(0, 4294967295)] uint DeviceNumber)
@@ -134,7 +129,6 @@ public ActionResult<string> FilterWheelSetup([Required][DefaultValue(0)][Swagger
134129
/// <response code="500" examples="Error message describing why the command cannot be processed">Server internal error, check error message</response>
135130
[HttpGet]
136131
[Produces(MediaTypeNames.Text.Html)]
137-
[ApiExplorerSettings(GroupName = "Alpaca")]
138132
[FeatureGate("HideAlpacaUI")]
139133
[Route("/setup/v1/focuser/{DeviceNumber}/setup")]
140134
public ActionResult<string> FocuserSetup([Required][DefaultValue(0)][SwaggerSchema(Strings.DeviceIDDescription, Format = "uint32")][Range(0, 4294967295)] uint DeviceNumber)
@@ -155,7 +149,6 @@ public ActionResult<string> FocuserSetup([Required][DefaultValue(0)][SwaggerSche
155149
/// <response code="500" examples="Error message describing why the command cannot be processed">Server internal error, check error message</response>
156150
[HttpGet]
157151
[Produces(MediaTypeNames.Text.Html)]
158-
[ApiExplorerSettings(GroupName = "Alpaca")]
159152
[FeatureGate("HideAlpacaUI")]
160153
[Route("/setup/v1/observingconditions/{DeviceNumber}/setup")]
161154
public ActionResult<string> ObservingConditionsSetup([Required][DefaultValue(0)][SwaggerSchema(Strings.DeviceIDDescription, Format = "uint32")][Range(0, 4294967295)] uint DeviceNumber)
@@ -176,7 +169,6 @@ public ActionResult<string> ObservingConditionsSetup([Required][DefaultValue(0)]
176169
/// <response code="500" examples="Error message describing why the command cannot be processed">Server internal error, check error message</response>
177170
[HttpGet]
178171
[Produces(MediaTypeNames.Text.Html)]
179-
[ApiExplorerSettings(GroupName = "Alpaca")]
180172
[FeatureGate("HideAlpacaUI")]
181173
[Route("/setup/v1/rotator/{DeviceNumber}/setup")]
182174
public ActionResult<string> RotatorSetup([Required][DefaultValue(0)][SwaggerSchema(Strings.DeviceIDDescription, Format = "uint32")][Range(0, 4294967295)] uint DeviceNumber)
@@ -197,7 +189,6 @@ public ActionResult<string> RotatorSetup([Required][DefaultValue(0)][SwaggerSche
197189
/// <response code="500" examples="Error message describing why the command cannot be processed">Server internal error, check error message</response>
198190
[HttpGet]
199191
[Produces(MediaTypeNames.Text.Html)]
200-
[ApiExplorerSettings(GroupName = "Alpaca")]
201192
[FeatureGate("HideAlpacaUI")]
202193
[Route("/setup/v1/safetymonitor/{DeviceNumber}/setup")]
203194
public ActionResult<string> SafetyMonitorSetup([Required][DefaultValue(0)][SwaggerSchema(Strings.DeviceIDDescription, Format = "uint32")][Range(0, 4294967295)] uint DeviceNumber)
@@ -218,7 +209,6 @@ public ActionResult<string> SafetyMonitorSetup([Required][DefaultValue(0)][Swagg
218209
/// <response code="500" examples="Error message describing why the command cannot be processed">Server internal error, check error message</response>
219210
[HttpGet]
220211
[Produces(MediaTypeNames.Text.Html)]
221-
[ApiExplorerSettings(GroupName = "Alpaca")]
222212
[FeatureGate("HideAlpacaUI")]
223213
[Route("/setup/v1/switch/{DeviceNumber}/setup")]
224214
public ActionResult<string> SwitchSetup([Required][DefaultValue(0)][SwaggerSchema(Strings.DeviceIDDescription, Format = "uint32")][Range(0, 4294967295)] uint DeviceNumber)
@@ -239,7 +229,6 @@ public ActionResult<string> SwitchSetup([Required][DefaultValue(0)][SwaggerSchem
239229
/// <response code="500" examples="Error message describing why the command cannot be processed">Server internal error, check error message</response>
240230
[HttpGet]
241231
[Produces(MediaTypeNames.Text.Html)]
242-
[ApiExplorerSettings(GroupName = "Alpaca")]
243232
[FeatureGate("HideAlpacaUI")]
244233
[Route("/setup/v1/telescope/{DeviceNumber}/setup")]
245234
public ActionResult<string> TelescopeSetup([Required][DefaultValue(0)][SwaggerSchema(Strings.DeviceIDDescription, Format = "uint32")][Range(0, 4294967295)] uint DeviceNumber)

0 commit comments

Comments
 (0)