Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: openapi documentation #14458

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
2 changes: 2 additions & 0 deletions backend/src/Designer/Controllers/AppDevelopmentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace Altinn.Studio.Designer.Controllers
/// Controller containing actions that concerns app-development
/// </summary>
[Authorize]
[ApiController]
[AutoValidateAntiforgeryToken]
[Route("designer/api/{org}/{app:regex(^(?!datamodels$)[[a-z]][[a-z0-9-]]{{1,28}}[[a-z0-9]]$)}/app-development")]
public class AppDevelopmentController : Controller
Expand Down Expand Up @@ -57,6 +58,7 @@ public AppDevelopmentController(IAppDevelopmentService appDevelopmentService, IR
/// Default action for the designer.
/// </summary>
/// <returns>default view for the app builder.</returns>
[HttpGet]
[Route("/editor/{org}/{app:regex(^[[a-z]]+[[a-zA-Z0-9-]]+[[a-zA-Z0-9]]$)}/{*AllValues}")]
public async Task<IActionResult> Index(string org, string app)
{
Expand Down
1 change: 1 addition & 0 deletions backend/src/Designer/Controllers/ConfigController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace Altinn.Studio.Designer.Controllers
/// <summary>
/// Controller exposing endpoints that handle metadata in config.json
/// </summary>
[ApiController]
Konrad-Simso marked this conversation as resolved.
Show resolved Hide resolved
[Authorize]
[AutoValidateAntiforgeryToken]
[Route("designer/api/{org}/{app:regex(^(?!datamodels$)[[a-z]][[a-z0-9-]]{{1,28}}[[a-z0-9]]$)}/config")]
Expand Down
1 change: 1 addition & 0 deletions backend/src/Designer/Controllers/DatamodelsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace Altinn.Studio.Designer.Controllers
/// <summary>
/// Controller containing all actions related to data modelling
/// </summary>
[ApiController]
[Authorize]
[AutoValidateAntiforgeryToken]
[Route("designer/api/{org}/{repository:regex(^(?!datamodels$)[[a-z]][[a-z0-9-]]{{1,28}}[[a-z0-9]]$)}/datamodels")]
Expand Down
1 change: 1 addition & 0 deletions backend/src/Designer/Controllers/EnvironmentsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace Altinn.Studio.Designer.Controllers
/// <summary>
/// This is the API controller for functionality related to environments.
/// </summary>
[ApiController]
[Authorize]
[AutoValidateAntiforgeryToken]

Expand Down
1 change: 0 additions & 1 deletion backend/src/Designer/Controllers/FeedbackFormController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Altinn.Studio.Designer.TypedHttpClients.Slack;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;

namespace Altinn.Studio.Designer.Controllers;

Expand Down
2 changes: 2 additions & 0 deletions backend/src/Designer/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ namespace Altinn.Studio.Designer.Controllers
/// <summary>
/// The default MVC controller in the application
/// </summary>
[ApiController]
[ApiExplorerSettings(IgnoreApi = true)]
[Route("[action]/{id?}")]
[Route("[controller]/[action]/{id?}")]
public class HomeController : Controller
Expand Down
1 change: 1 addition & 0 deletions backend/src/Designer/Controllers/ImageController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace Altinn.Studio.Designer.Controllers;
/// <summary>
/// Controller containing actions related to images
/// </summary>
[ApiController]
[Authorize]
[AutoValidateAntiforgeryToken]
[Route("designer/api/{org}/{app:regex(^(?!datamodels$)[[a-z]][[a-z0-9-]]{{1,28}}[[a-z0-9]]$)}/images")]
Expand Down
2 changes: 1 addition & 1 deletion backend/src/Designer/Controllers/OptionsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public async Task<ActionResult<List<RefToOptionListSpecifier>>> GetOptionListsRe
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[Route("{optionsListId}")]
public async Task<ActionResult<Dictionary<string, List<Option>>>> CreateOrOverwriteOptionsList(string org, string repo, [FromRoute] string optionsListId, [FromBody] List<Option> payload, CancellationToken cancellationToken = default)
public async Task<ActionResult<List<Option>>> CreateOrOverwriteOptionsList(string org, string repo, [FromRoute] string optionsListId, [FromBody] List<Option> payload, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext);
Expand Down
1 change: 1 addition & 0 deletions backend/src/Designer/Controllers/OrganizationController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace Altinn.Studio.Designer.Controllers
/// <summary>
/// This is the API controller for functionality related to repositories.
/// </summary>
[ApiController]
[Authorize]
[AutoValidateAntiforgeryToken]
[Route("designer/api/orgs")]
Expand Down
1 change: 1 addition & 0 deletions backend/src/Designer/Controllers/PolicyController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Altinn.Studio.Designer.Controllers
{
[ApiController]
[Route("/designer/api/{org}/{app:regex(^(?!datamodels$)[[a-z]][[a-z0-9-]]{{1,28}}[[a-z0-9]]$)}/policy")]
public class PolicyController : ControllerBase
{
Expand Down
2 changes: 2 additions & 0 deletions backend/src/Designer/Controllers/PreviewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ namespace Altinn.Studio.Designer.Controllers
/// <param name="appDevelopmentService">App Development Service</param>
/// Factory class that knows how to create types of <see cref="AltinnGitRepository"/>
[Authorize]
[ApiController]
[ApiExplorerSettings(IgnoreApi = true)]
[AutoValidateAntiforgeryToken]
// Uses regex to not match on designer since the call from frontend to get the iframe for app-frontend,
// `designer/html/preview.html`, will match on Image-endpoint which is a fetch-all route
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace Altinn.Studio.Designer.Controllers
/// Controller containing actions that concerns app-development
/// </summary>
[Authorize]
[ApiController]
[AutoValidateAntiforgeryToken]
[Route("designer/api/{org}/{repo:regex(^(?!datamodels$)[[a-z]][[a-z0-9-]]{{1,28}}[[a-z0-9]]$)}/process-modelling")]
public class ProcessModelingController : ControllerBase
Expand Down
5 changes: 3 additions & 2 deletions backend/src/Designer/Controllers/RepositoryController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace Altinn.Studio.Designer.Controllers
/// Initializes a new instance of the <see cref="RepositoryController"/> class.
/// </remarks>
[Authorize]
[ApiController]
[AutoValidateAntiforgeryToken]
[Route("designer/api/repos")]
public class RepositoryController : ControllerBase
Expand Down Expand Up @@ -57,12 +58,12 @@ public RepositoryController(IGitea giteaWrapper, ISourceControl sourceControl, I
/// <summary>
/// Returns a list over repositories
/// </summary>
/// <param name="searchOptions">The search params</param>
/// <returns>List of repositories that user has access to.</returns>
[HttpGet]
[Route("search")]
public async Task<SearchResults> Search(SearchOptions searchOptions)
public async Task<SearchResults> Search([FromQuery] string keyword, [FromQuery] int uId, [FromQuery] string sortBy, [FromQuery] string order, [FromQuery] int page, [FromQuery] int limit)
{
SearchOptions searchOptions = new SearchOptions { Keyword = keyword, UId = uId, SortBy = sortBy, Order = order, Page = page, Limit = limit };
SearchResults repositories = await _giteaApi.SearchRepo(searchOptions);
return repositories;
}
Expand Down
1 change: 1 addition & 0 deletions backend/src/Designer/Controllers/TextController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace Altinn.Studio.Designer.Controllers
/// Controller for resources
/// </summary>
[Authorize]
[ApiController]
Konrad-Simso marked this conversation as resolved.
Show resolved Hide resolved
[AutoValidateAntiforgeryToken]
[Route("designer/api/{org}/{app:regex(^(?!datamodels$)[[a-z]][[a-z0-9-]]{{1,28}}[[a-z0-9]]$)}/text")]
[Obsolete("TextController is deprecated, please use TextsController instead. Only in use until new texts format is implemented in apps.")]
Expand Down
1 change: 1 addition & 0 deletions backend/src/Designer/Controllers/UserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace Altinn.Studio.Designer.Controllers
/// API controller for User functionality
/// </summary>
[Authorize]
[ApiController]
[Route("designer/api/user")]
public class UserController : ControllerBase
{
Expand Down
Loading