Skip to content
This repository was archived by the owner on Dec 19, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ public static AdminApiEndpointBuilder MapPost(IEndpointRouteBuilder endpoints, s
public static AdminApiEndpointBuilder MapPut(IEndpointRouteBuilder endpoints, string route, Delegate handler)
=> new(endpoints, HttpVerb.PUT, route, handler);

public static AdminApiEndpointBuilder MapPatch(IEndpointRouteBuilder endpoints, string route, Delegate handler)
=> new(endpoints, HttpVerb.PATCH, route, handler);

public static AdminApiEndpointBuilder MapDelete(IEndpointRouteBuilder endpoints, string route, Delegate handler)
=> new(endpoints, HttpVerb.DELETE, route, handler);

Expand Down Expand Up @@ -73,10 +70,10 @@ public AdminApiEndpointBuilder RequireAuthorization(PolicyDefinition authorizati

public void BuildForVersions(params AdminApiVersions.AdminApiVersion[] versions)
{
BuildForVersions(string.Empty, versions);
BuildForVersions(string.Empty, false, versions);
}

public void BuildForVersions(string authorizationPolicy, params AdminApiVersions.AdminApiVersion[] versions)
public void BuildForVersions(string authorizationPolicy, bool display409 = false, params AdminApiVersions.AdminApiVersion[] versions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavidJGapCR why would we hide 409 from the output?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only place where the Admin Api can actually return 409 is when the user is creating an Application and the name already exists

{
if (versions.Length == 0)
throw new ArgumentException("Must register for at least 1 version");
Expand All @@ -98,7 +95,6 @@ public void BuildForVersions(string authorizationPolicy, params AdminApiVersions
HttpVerb.POST => _endpoints.MapPost(versionedRoute, _handler),
HttpVerb.PUT => _endpoints.MapPut(versionedRoute, _handler),
HttpVerb.DELETE => _endpoints.MapDelete(versionedRoute, _handler),
HttpVerb.PATCH => _endpoints.MapPatch(versionedRoute, _handler),
_ => throw new ArgumentOutOfRangeException($"Unconfigured HTTP verb for mapping: {_verb}")
};

Expand All @@ -125,7 +121,8 @@ public void BuildForVersions(string authorizationPolicy, params AdminApiVersions
builder.WithGroupName(version.ToString());
builder.WithResponseCode(401, "Unauthorized. The request requires authentication");
builder.WithResponseCode(403, "Forbidden. The request is authenticated, but not authorized to access this resource");
builder.WithResponseCode(409, "Conflict. The request is authenticated, but it has a conflict with an existing element");
if (display409)
builder.WithResponseCode(409, "Conflict. The request is authenticated, but it has a conflict with an existing element");
builder.WithResponseCode(500, FeatureCommonConstants.InternalServerErrorResponseDescription);

if (_route.Contains("id", StringComparison.InvariantCultureIgnoreCase))
Expand Down Expand Up @@ -192,5 +189,5 @@ public AdminApiEndpointBuilder AllowAnonymous()
return this;
}

private enum HttpVerb { GET, POST, PUT, DELETE, PATCH }
private enum HttpVerb { GET, POST, PUT, DELETE }
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void MapEndpoints(IEndpointRouteBuilder endpoints)
AdminApiEndpointBuilder.MapPost(endpoints, "/applications", Handle)
.WithDefaultSummaryAndDescription()
.WithRouteOptions(b => b.WithResponse<ApplicationResult>(201))
.BuildForVersions(AdminApiVersions.V2);
.BuildForVersions(string.Empty, true, AdminApiVersions.V2);
}

public static async Task<IResult> Handle(Validator validator, IAddApplicationCommand addApplicationCommand, IMapper mapper, IUsersContext db, AddApplicationRequest request, IOptions<AppSettings> options)
Expand Down
25 changes: 0 additions & 25 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -227,21 +227,6 @@ function GenerateOpenAPI {
}
}

function GenerateOpenAPIAdminConsole {
Invoke-Execute {
Push-Location $solutionRoot/EdFi.Ods.AdminApi/
$outputOpenAPI = "../../docs/api-specifications/openapi-yaml/admin-api-console-$APIVersion.yaml"
$dllPath = "./bin/Release/net8.0/EdFi.Ods.AdminApi.dll"

try {
dotnet tool run swagger tofile --output $outputOpenAPI --yaml $dllPath adminconsole
}
finally {
Pop-Location
}
}
}

function GenerateDocumentation {
Invoke-Execute {
$outputOpenAPI = "docs/api-specifications/openapi-yaml/admin-api-$APIVersion.yaml"
Expand All @@ -250,14 +235,6 @@ function GenerateDocumentation {
}
}

function GenerateDocumentationAdminConsole {
Invoke-Execute {
$outputOpenAPI = "docs/api-specifications/openapi-yaml/admin-api-console-$APIVersion.yaml"
$outputMD = "docs/api-specifications/markdown/admin-api-console-$APIVersion-summary.md"
widdershins --search false --omitHeader true --code true --summary $outputOpenAPI -o $outputMD
}
}

function PublishAdminApi {
Invoke-Execute {
$project = "$solutionRoot/EdFi.Ods.AdminApi/"
Expand Down Expand Up @@ -433,9 +410,7 @@ function Invoke-GenerateOpenAPIAndMD {
Invoke-Step { Restore }
Invoke-Step { Compile }
Invoke-Step { GenerateOpenAPI }
Invoke-Step { GenerateOpenAPIAdminConsole }
Invoke-Step { GenerateDocumentation }
Invoke-Step { GenerateDocumentationAdminConsole }
}

function Invoke-SetAssemblyInfo {
Expand Down
6 changes: 3 additions & 3 deletions docs/api-specifications/openapi-yaml/admin-api-1.4.3.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
openapi: 3.0.1
info:
title: Admin API Documentation
description: 'The Ed-Fi Admin API is a REST API-based administrative interface for managing vendors, applications, client credentials, and authorization rules for accessing an Ed-Fi API.'
version: v1
version: 1.4.3
title: "Ed-Fi Admin API"
description: The Ed-Fi Admin API is a REST API-based administrative interface for managing vendors, applications, client credentials, and authorization rules for accessing an Ed-Fi API.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't realize that we have a copy of the specification file here as well as in the API-Specifications repository. The one in the other repository is the official standard. It should have title: "Ed-Fi Management API". But here in this AdminAPI repository, it is fine to leave "Ed-Fi Admin API" since it is now referring to the specific application.

paths:
/v1/vendors:
get:
Expand Down
Loading
Loading