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(webapi): Add missing 404 status code in activity list swagger schema #1924

Merged
merged 2 commits into from
Feb 20, 2025
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
24 changes: 22 additions & 2 deletions docs/schema/V1/swagger.verified.json
Original file line number Diff line number Diff line change
Expand Up @@ -5230,6 +5230,16 @@
},
"403": {
"description": "Unauthorized to get the supplied dialog (not owned by authenticated organization or has additional scope requirements defined in policy)."
},
"404": {
"content": {
"application/problem\u002Bjson": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "The given dialog ID was not found."
}
},
"security": [
Expand Down Expand Up @@ -5292,7 +5302,7 @@
}
}
},
"description": "The given dialog ID was not found or was deleted, or the given activity ID was not found."
"description": "The specified dialog ID or activity ID was not found."
}
},
"security": [
Expand Down Expand Up @@ -6694,6 +6704,16 @@
},
"403": {
"description": "Unauthorized to get the supplied dialog (not owned by authenticated organization or has additional scope requirements defined in policy)."
},
"404": {
"content": {
"application/problem\u002Bjson": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
},
"description": "The given dialog ID was not found."
}
},
"security": [
Expand Down Expand Up @@ -6876,7 +6896,7 @@
}
}
},
"description": "The given dialog ID was not found or was deleted, or the given activity ID was not found."
"description": "The specified dialog ID or activity ID was not found."
},
"410": {
"description": "Entity with the given key(s) is removed."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal static class SwaggerSummary
internal const string EndUserAuthenticationFailure = "Missing or invalid authentication token. Requires a Maskinporten-token with the scope \"digdir:dialogporten\".";
internal const string DialogNotFound = "The given dialog ID was not found.";
internal const string DialogDeleted = $"Entity with the given key(s) is removed.";
internal const string DialogActivityNotFound = "The given dialog ID was not found or was deleted, or the given activity ID was not found.";
internal const string DialogActivityNotFound = "The specified dialog ID or activity ID was not found.";
internal const string DialogTransmissionNotFound = "The given dialog ID was not found or was deleted, or the given transmission ID was not found.";
internal const string RevisionMismatch = "The supplied If-Match header did not match the current Revision value for the dialog. The request was not applied.";
internal const string AccessDeniedToDialog = "Unauthorized to {0} the supplied dialog (not owned by authenticated organization or has additional scope requirements defined in policy).";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogActivities.Queries.Search;
using Digdir.Domain.Dialogporten.WebApi.Common.Authorization;
using Digdir.Domain.Dialogporten.WebApi.Common.Extensions;
using Digdir.Domain.Dialogporten.WebApi.Endpoints.V1.Common.Extensions;
using FastEndpoints;
using MediatR;

Expand All @@ -20,6 +21,10 @@ public override void Configure()
Get("dialogs/{dialogId}/activities");
Policies(AuthorizationPolicy.EndUser);
Group<EndUserGroup>();

Description(b => b.ProducesOneOf<List<ActivityDto>>(
StatusCodes.Status200OK,
StatusCodes.Status404NotFound));
}

public override async Task HandleAsync(SearchActivityQuery req, CancellationToken ct)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.DialogActivities.Queries.Search;
using Digdir.Domain.Dialogporten.WebApi.Common.Authorization;
using Digdir.Domain.Dialogporten.WebApi.Common.Extensions;
using Digdir.Domain.Dialogporten.WebApi.Endpoints.V1.Common.Extensions;
using FastEndpoints;
using MediatR;

Expand All @@ -20,6 +21,10 @@ public override void Configure()
Get("dialogs/{dialogId}/activities");
Policies(AuthorizationPolicy.ServiceProvider);
Group<ServiceOwnerGroup>();

Description(b => b.ProducesOneOf<List<ActivityDto>>(
StatusCodes.Status200OK,
StatusCodes.Status404NotFound));
}

public override async Task HandleAsync(SearchActivityQuery req, CancellationToken ct)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,10 @@ public partial interface IServiceownerApi
/// <description>The given dialog ID was not found or is deleted</description>
/// </item>
/// <item>
/// <term>410</term>
/// <description>The dialog with the given key is removed</description>
/// </item>
/// <item>
/// <term>412</term>
/// <description>The supplied Revision does not match the current Revision of the dialog</description>
/// </item>
Expand Down Expand Up @@ -723,9 +727,13 @@ public partial interface IServiceownerApi
/// <term>403</term>
/// <description>Unauthorized to get the supplied dialog (not owned by authenticated organization or has additional scope requirements defined in policy).</description>
/// </item>
/// <item>
/// <term>404</term>
/// <description>The given dialog ID was not found.</description>
/// </item>
/// </list>
/// </returns>
[Headers("Accept: application/json")]
[Headers("Accept: application/json, application/problem+json")]
[Get("/api/v1/serviceowner/dialogs/{dialogId}/activities")]
Task<IApiResponse<ICollection<V1ServiceOwnerDialogActivitiesQueriesSearch_Activity>>> V1ServiceOwnerDialogActivitiesSearchSearchDialogActivity(System.Guid dialogId, CancellationToken cancellationToken = default);

Expand Down Expand Up @@ -835,7 +843,7 @@ public partial interface IServiceownerApi
/// </item>
/// <item>
/// <term>404</term>
/// <description>The given dialog ID was not found or was deleted, or the given activity ID was not found.</description>
/// <description>The specified dialog ID or activity ID was not found.</description>
/// </item>
/// <item>
/// <term>410</term>
Expand Down Expand Up @@ -1722,13 +1730,29 @@ public partial class V1ServiceOwnerDialogsCommandsUpdate_Content
[JsonPropertyName("title")]
public V1CommonContent_ContentValue Title { get; set; }

/// <summary>
/// An optional non-sensitive title of the dialog.
/// <br/>Used for search and list views if the user authorization does not meet the required eIDAS level
/// </summary>

[JsonPropertyName("nonSensitiveTitle")]
public V1CommonContent_ContentValue NonSensitiveTitle { get; set; }

/// <summary>
/// A short summary of the dialog and its current state. Must be text/plain.
/// </summary>

[JsonPropertyName("summary")]
public V1CommonContent_ContentValue Summary { get; set; }

/// <summary>
/// An optional non-sensitive summary of the dialog and its current state.
/// <br/>Used for search and list views if the user authorization does not meet the required eIDAS level
/// </summary>

[JsonPropertyName("nonSensitiveSummary")]
public V1CommonContent_ContentValue NonSensitiveSummary { get; set; }

/// <summary>
/// Overridden sender name. If not supplied, assume "org" as the sender name. Must be text/plain if supplied.
/// </summary>
Expand Down Expand Up @@ -2577,13 +2601,29 @@ public partial class V1ServiceOwnerDialogsQueriesSearch_Content
[JsonPropertyName("title")]
public V1CommonContent_ContentValue Title { get; set; }

/// <summary>
/// An optional non-sensitive title of the dialog.
/// <br/>Used for search and list views if the user authorization does not meet the required eIDAS level
/// </summary>

[JsonPropertyName("nonSensitiveTitle")]
public V1CommonContent_ContentValue NonSensitiveTitle { get; set; }

/// <summary>
/// A short summary of the dialog and its current state.
/// </summary>

[JsonPropertyName("summary")]
public V1CommonContent_ContentValue Summary { get; set; }

/// <summary>
/// An optional non-sensitive summary of the dialog and its current state.
/// <br/>Used for search and list views if the user authorization does not meet the required eIDAS level
/// </summary>

[JsonPropertyName("nonSensitiveSummary")]
public V1CommonContent_ContentValue NonSensitiveSummary { get; set; }

/// <summary>
/// Overridden sender name. If not supplied, assume "org" as the sender name.
/// </summary>
Expand Down Expand Up @@ -2871,13 +2911,29 @@ public partial class V1ServiceOwnerDialogsQueriesGet_Content
[JsonPropertyName("title")]
public V1CommonContent_ContentValue Title { get; set; }

/// <summary>
/// An optional non-sensitive title of the dialog.
/// <br/>Used for search and list views if the user authorization does not meet the required eIDAS level
/// </summary>

[JsonPropertyName("nonSensitiveTitle")]
public V1CommonContent_ContentValue NonSensitiveTitle { get; set; }

/// <summary>
/// A short summary of the dialog and its current state.
/// </summary>

[JsonPropertyName("summary")]
public V1CommonContent_ContentValue Summary { get; set; }

/// <summary>
/// An optional non-sensitive summary of the dialog and its current state.
/// <br/>Used for search and list views if the user authorization does not meet the required eIDAS level
/// </summary>

[JsonPropertyName("nonSensitiveSummary")]
public V1CommonContent_ContentValue NonSensitiveSummary { get; set; }

/// <summary>
/// Overridden sender name. If not supplied, assume "org" as the sender name.
/// </summary>
Expand Down Expand Up @@ -3633,6 +3689,14 @@ public partial class V1ServiceOwnerDialogsCommandsCreate_Content
[JsonPropertyName("title")]
public V1CommonContent_ContentValue Title { get; set; }

/// <summary>
/// An optional non-sensitive title of the dialog.
/// <br/>Used for search and list views if the user authorization does not meet the required eIDAS level
/// </summary>

[JsonPropertyName("nonSensitiveTitle")]
public V1CommonContent_ContentValue NonSensitiveTitle { get; set; }

/// <summary>
/// A short summary of the dialog and its current state.
/// <br/>Supported media types: text/plain
Expand All @@ -3641,6 +3705,14 @@ public partial class V1ServiceOwnerDialogsCommandsCreate_Content
[JsonPropertyName("summary")]
public V1CommonContent_ContentValue Summary { get; set; }

/// <summary>
/// An optional non-sensitive summary of the dialog and its current state.
/// <br/>Used for search and list views if the user authorization does not meet the required eIDAS level
/// </summary>

[JsonPropertyName("nonSensitiveSummary")]
public V1CommonContent_ContentValue NonSensitiveSummary { get; set; }

/// <summary>
/// Overridden sender name. If not supplied, assume "org" as the sender name. Must be text/plain if supplied.
/// <br/>Supported media types: text/plain
Expand Down