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

feat: update swagger name generation #1350

Merged
merged 26 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4311391
Now removes all namespace from common and removes start of namespace …
Fargekritt Oct 25, 2024
afe3773
Cleaned the code, and using dict instead of set to report duplicates …
Fargekritt Oct 25, 2024
23216c4
Testing how to set the OperationId
Fargekritt Oct 25, 2024
770c71f
OpertationId WIP
Fargekritt Oct 25, 2024
ed11cc6
OperationId now uses TypeNameConverter
Fargekritt Oct 25, 2024
59d3703
Schemas and OperationId now works!
Fargekritt Oct 25, 2024
4e68ccb
Removed operationId
Fargekritt Oct 25, 2024
1515f51
Renamed Class names to be more concise GetDialogDialogTransmissionDto…
Fargekritt Oct 28, 2024
791074b
Updated swagger.verified.json
Fargekritt Oct 28, 2024
02bd379
Refactor TypeNameConverter.cs
MagnusSandgren Oct 28, 2024
7e5dcfc
Removed Http verb from dto names
Fargekritt Oct 28, 2024
0822af3
Update swagger verified
Fargekritt Oct 28, 2024
48a8032
Updated based on review
Fargekritt Oct 28, 2024
762a022
Only ashes remains
Fargekritt Oct 29, 2024
d637f30
removed DialogPrefixes
Fargekritt Oct 29, 2024
f905b8c
Dialog Acitvity needs prefix in Domain
Fargekritt Oct 29, 2024
be0fcb9
DialogDialogAcivity needs prefix
Fargekritt Oct 29, 2024
b7e0f97
DialogActivity
Fargekritt Oct 29, 2024
31f9872
Add EndpointNameMetadata globally.
MagnusSandgren Oct 29, 2024
2a35eab
Merge remote-tracking branch 'origin/feature/update-swagger-name-gene…
MagnusSandgren Oct 29, 2024
d0396ae
Fix
MagnusSandgren Oct 29, 2024
a8adcb1
Merge branch 'main' into feature/update-swagger-name-generation
Fargekritt Oct 29, 2024
f64a157
Updated swagger.verified.json
Fargekritt Oct 29, 2024
18f3daf
Cleaned up
Fargekritt Oct 30, 2024
6165411
Merge branch 'main' into feature/update-swagger-name-generation
Fargekritt Oct 31, 2024
113c817
chore: Remove unused usings (#1369)
oskogstad Oct 31, 2024
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
6,021 changes: 3,014 additions & 3,007 deletions docs/schema/V1/swagger.verified.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogActivities.Queries.Get;

public sealed class GetDialogActivityDto
public sealed class ActivityDto
{
public Guid Id { get; set; }
public DateTimeOffset? CreatedAt { get; set; }
Expand All @@ -14,11 +14,11 @@ public sealed class GetDialogActivityDto

public Guid? TransmissionId { get; set; }

public GetDialogActivityPerformedByActorDto PerformedBy { get; set; } = null!;
public PerformedByActorDto PerformedBy { get; set; } = null!;
public List<LocalizationDto> Description { get; set; } = [];
}

public sealed class GetDialogActivityPerformedByActorDto
public sealed class PerformedByActorDto
{
public Guid Id { get; set; }
public ActorType.Values ActorType { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@

namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogActivities.Queries.Get;

public sealed class GetDialogActivityQuery : IRequest<GetDialogActivityResult>
public sealed class GetActivityQuery : IRequest<GetActivityResult>
{
public Guid DialogId { get; set; }
public Guid ActivityId { get; set; }
}

[GenerateOneOf]
public sealed partial class GetDialogActivityResult : OneOfBase<GetDialogActivityDto, EntityNotFound, EntityDeleted>;
public sealed partial class GetActivityResult : OneOfBase<ActivityDto, EntityNotFound, EntityDeleted>;

internal sealed class GetDialogActivityQueryHandler : IRequestHandler<GetDialogActivityQuery, GetDialogActivityResult>
internal sealed class GetActivityQueryHandler : IRequestHandler<GetActivityQuery, GetActivityResult>
{
private readonly IMapper _mapper;
private readonly IAltinnAuthorization _altinnAuthorization;
private readonly IDialogDbContext _dbContext;

public GetDialogActivityQueryHandler(
public GetActivityQueryHandler(
IDialogDbContext dbContext,
IMapper mapper,
IAltinnAuthorization altinnAuthorization)
Expand All @@ -35,7 +35,7 @@ public GetDialogActivityQueryHandler(
_altinnAuthorization = altinnAuthorization ?? throw new ArgumentNullException(nameof(altinnAuthorization));
}

public async Task<GetDialogActivityResult> Handle(GetDialogActivityQuery request,
public async Task<GetActivityResult> Handle(GetActivityQuery request,
CancellationToken cancellationToken)
{
var dialog = await _dbContext.Dialogs
Expand Down Expand Up @@ -74,6 +74,6 @@ public async Task<GetDialogActivityResult> Handle(GetDialogActivityQuery request
return new EntityNotFound<DialogActivity>(request.ActivityId);
}

return _mapper.Map<GetDialogActivityDto>(activity);
return _mapper.Map<ActivityDto>(activity);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ internal sealed class MappingProfile : Profile
{
public MappingProfile()
{
CreateMap<DialogActivity, GetDialogActivityDto>()
CreateMap<DialogActivity, ActivityDto>()
.ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.TypeId));

CreateMap<DialogActivityPerformedByActor, GetDialogActivityPerformedByActorDto>()
CreateMap<DialogActivityPerformedByActor, PerformedByActorDto>()
.ForMember(dest => dest.ActorType, opt => opt.MapFrom(src => src.ActorTypeId))
.ForMember(dest => dest.ActorId, opt => opt.MapFrom(src => IdentifierMasker.GetMaybeMaskedIdentifier(src.ActorId)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogActivities.Queries.Search;

public sealed class SearchDialogActivityDto
public sealed class ActivityDto
{
public Guid Id { get; set; }
public DateTimeOffset CreatedAt { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ internal sealed class MappingProfile : Profile
{
public MappingProfile()
{
CreateMap<DialogActivity, SearchDialogActivityDto>()
CreateMap<DialogActivity, ActivityDto>()
.ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.TypeId));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@

namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogActivities.Queries.Search;

public sealed class SearchDialogActivityQuery : IRequest<SearchDialogActivityResult>
public sealed class SearchActivityQuery : IRequest<SearchActivityResult>
{
public Guid DialogId { get; set; }
}

[GenerateOneOf]
public sealed partial class SearchDialogActivityResult : OneOfBase<List<SearchDialogActivityDto>, EntityNotFound, EntityDeleted>;
public sealed partial class SearchActivityResult : OneOfBase<List<ActivityDto>, EntityNotFound, EntityDeleted>;

internal sealed class SearchDialogActivityQueryHandler : IRequestHandler<SearchDialogActivityQuery, SearchDialogActivityResult>
internal sealed class SearchActivityQueryHandler : IRequestHandler<SearchActivityQuery, SearchActivityResult>
{
private readonly IDialogDbContext _db;
private readonly IMapper _mapper;
private readonly IAltinnAuthorization _altinnAuthorization;

public SearchDialogActivityQueryHandler(
public SearchActivityQueryHandler(
IDialogDbContext db,
IMapper mapper,
IAltinnAuthorization altinnAuthorization)
Expand All @@ -33,7 +33,7 @@ public SearchDialogActivityQueryHandler(
_altinnAuthorization = altinnAuthorization ?? throw new ArgumentNullException(nameof(altinnAuthorization));
}

public async Task<SearchDialogActivityResult> Handle(SearchDialogActivityQuery request, CancellationToken cancellationToken)
public async Task<SearchActivityResult> Handle(SearchActivityQuery request, CancellationToken cancellationToken)
{
var dialog = await _db.Dialogs
.Include(x => x.Activities)
Expand Down Expand Up @@ -61,6 +61,6 @@ public async Task<SearchDialogActivityResult> Handle(SearchDialogActivityQuery r
return new EntityDeleted<DialogEntity>(request.DialogId);
}

return _mapper.Map<List<SearchDialogActivityDto>>(dialog.Activities);
return _mapper.Map<List<ActivityDto>>(dialog.Activities);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogLabelAssignmentLog.Queries.Search;

public sealed class SearchDialogLabelAssignmentLogDto
public sealed class LabelAssignmentLogDto
{
public DateTimeOffset CreatedAt { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public sealed class MappingProfile : Profile
{
public MappingProfile()
{
CreateMap<LabelAssignmentLog, SearchDialogLabelAssignmentLogDto>();
CreateMap<LabelAssignmentLog, LabelAssignmentLogDto>();
CreateMap<LabelAssignmentLogActor, LabelAssignmentLogActorDto>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,28 @@

namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogLabelAssignmentLog.Queries.Search;

public sealed class SearchDialogLabelAssignmentLogQuery : IRequest<SearchDialogLabelAssignmentLogResult>
public sealed class SearchLabelAssignmentLogQuery : IRequest<SearchLabelAssignmentLogResult>
{
public Guid DialogId { get; set; }
}

[GenerateOneOf]
public sealed partial class SearchDialogLabelAssignmentLogResult : OneOfBase<List<SearchDialogLabelAssignmentLogDto>, EntityNotFound, EntityDeleted>;
public sealed partial class SearchLabelAssignmentLogResult : OneOfBase<List<LabelAssignmentLogDto>, EntityNotFound, EntityDeleted>;

internal sealed class SearchDialogLabelAssignmentLogQueryHandler : IRequestHandler<SearchDialogLabelAssignmentLogQuery, SearchDialogLabelAssignmentLogResult>
internal sealed class SearchLabelAssignmentLogQueryHandler : IRequestHandler<SearchLabelAssignmentLogQuery, SearchLabelAssignmentLogResult>
{
private readonly IDialogDbContext _dialogDbContext;
private readonly IMapper _mapper;
private readonly IAltinnAuthorization _altinnAuthorization;

public SearchDialogLabelAssignmentLogQueryHandler(IDialogDbContext dialogDbContext, IMapper mapper, IAltinnAuthorization altinnAuthorization)
public SearchLabelAssignmentLogQueryHandler(IDialogDbContext dialogDbContext, IMapper mapper, IAltinnAuthorization altinnAuthorization)
{
_dialogDbContext = dialogDbContext ?? throw new ArgumentNullException(nameof(dialogDbContext));
_mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
_altinnAuthorization = altinnAuthorization ?? throw new ArgumentNullException(nameof(altinnAuthorization));
}

public async Task<SearchDialogLabelAssignmentLogResult> Handle(SearchDialogLabelAssignmentLogQuery request, CancellationToken cancellationToken)
public async Task<SearchLabelAssignmentLogResult> Handle(SearchLabelAssignmentLogQuery request, CancellationToken cancellationToken)
{
var dialog = await _dialogDbContext.Dialogs
.AsNoTracking()
Expand All @@ -55,6 +55,6 @@ public async Task<SearchDialogLabelAssignmentLogResult> Handle(SearchDialogLabel
return new EntityDeleted<DialogEntity>(request.DialogId);
}

return _mapper.Map<List<SearchDialogLabelAssignmentLogDto>>(dialog.DialogEndUserContext.LabelAssignmentLogs);
return _mapper.Map<List<LabelAssignmentLogDto>>(dialog.DialogEndUserContext.LabelAssignmentLogs);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@

namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogSeenLogs.Queries.Get;

public sealed class GetDialogSeenLogQuery : IRequest<GetDialogSeenLogResult>
public sealed class GetSeenLogQuery : IRequest<GetSeenLogResult>
{
public Guid DialogId { get; set; }
public Guid SeenLogId { get; set; }
}

[GenerateOneOf]
public sealed partial class GetDialogSeenLogResult : OneOfBase<GetDialogSeenLogDto, EntityNotFound, EntityDeleted, Forbidden>;
public sealed partial class GetSeenLogResult : OneOfBase<SeenLogDto, EntityNotFound, EntityDeleted, Forbidden>;

internal sealed class GetDialogSeenLogQueryHandler : IRequestHandler<GetDialogSeenLogQuery, GetDialogSeenLogResult>
internal sealed class GetSeenLogQueryHandler : IRequestHandler<GetSeenLogQuery, GetSeenLogResult>
{
private readonly IMapper _mapper;
private readonly IDialogDbContext _dbContext;
private readonly IAltinnAuthorization _altinnAuthorization;
private readonly IUserRegistry _userRegistry;

public GetDialogSeenLogQueryHandler(
public GetSeenLogQueryHandler(
IMapper mapper,
IDialogDbContext dbContext,
IAltinnAuthorization altinnAuthorization,
Expand All @@ -38,7 +38,7 @@ public GetDialogSeenLogQueryHandler(
_userRegistry = userRegistry ?? throw new ArgumentNullException(nameof(userRegistry));
}

public async Task<GetDialogSeenLogResult> Handle(GetDialogSeenLogQuery request,
public async Task<GetSeenLogResult> Handle(GetSeenLogQuery request,
CancellationToken cancellationToken)
{
var currentUserInformation = await _userRegistry.GetCurrentUserInformation(cancellationToken);
Expand Down Expand Up @@ -77,7 +77,7 @@ public async Task<GetDialogSeenLogResult> Handle(GetDialogSeenLogQuery request,
return new EntityNotFound<DialogSeenLog>(request.SeenLogId);
}

var dto = _mapper.Map<GetDialogSeenLogDto>(seenLog);
var dto = _mapper.Map<SeenLogDto>(seenLog);
dto.IsCurrentEndUser = currentUserInformation.UserId.ExternalIdWithPrefix == seenLog.SeenBy.ActorId;

return dto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ public sealed class MappingProfile : Profile
{
public MappingProfile()
{
CreateMap<DialogSeenLog, GetDialogSeenLogDto>()
CreateMap<DialogSeenLog, SeenLogDto>()
.ForMember(dest => dest.SeenAt, opt => opt.MapFrom(src => src.CreatedAt));

CreateMap<DialogSeenLogSeenByActor, GetDialogSeenLogSeenByActorDto>()
CreateMap<DialogSeenLogSeenByActor, SeenLogSeenByActorDto>()
.ForMember(dest => dest.ActorId,
opt => opt.MapFrom(src => IdentifierMasker.GetMaybeMaskedIdentifier(src.ActorId)));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogSeenLogs.Queries.Get;

public sealed class GetDialogSeenLogDto
public sealed class SeenLogDto
{
public Guid Id { get; set; }
public DateTimeOffset SeenAt { get; set; }
public GetDialogSeenLogSeenByActorDto SeenBy { get; set; } = null!;
public SeenLogSeenByActorDto SeenBy { get; set; } = null!;

public bool IsViaServiceOwner { get; set; }
public bool IsCurrentEndUser { get; set; }
}

public sealed class GetDialogSeenLogSeenByActorDto
public sealed class SeenLogSeenByActorDto
{
public Guid Id { get; set; }
public string ActorName { get; set; } = null!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ public sealed class MappingProfile : Profile
{
public MappingProfile()
{
CreateMap<DialogSeenLog, SearchDialogSeenLogDto>()
CreateMap<DialogSeenLog, SeenLogDto>()
.ForMember(dest => dest.SeenAt, opt => opt.MapFrom(src => src.CreatedAt));

CreateMap<DialogSeenLogSeenByActor, SearchDialogSeenLogSeenByActorDto>()
CreateMap<DialogSeenLogSeenByActor, SeenLogSeenByActorDto>()
.ForMember(dest => dest.ActorId, opt => opt.MapFrom(src => IdentifierMasker.GetMaybeMaskedIdentifier(src.ActorId)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@

namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogSeenLogs.Queries.Search;

public sealed class SearchDialogSeenLogQuery : IRequest<SearchDialogSeenLogResult>
public sealed class SearchSeenLogQuery : IRequest<SearchSeenLogResult>
{
public Guid DialogId { get; set; }
}

[GenerateOneOf]
public sealed partial class SearchDialogSeenLogResult : OneOfBase<List<SearchDialogSeenLogDto>, EntityNotFound, EntityDeleted, Forbidden>;
public sealed partial class SearchSeenLogResult : OneOfBase<List<SeenLogDto>, EntityNotFound, EntityDeleted, Forbidden>;

internal sealed class SearchDialogSeenLogQueryHandler : IRequestHandler<SearchDialogSeenLogQuery, SearchDialogSeenLogResult>
internal sealed class SearchSeenLogQueryHandler : IRequestHandler<SearchSeenLogQuery, SearchSeenLogResult>
{
private readonly IDialogDbContext _db;
private readonly IMapper _mapper;
private readonly IAltinnAuthorization _altinnAuthorization;
private readonly IUserRegistry _userRegistry;

public SearchDialogSeenLogQueryHandler(
public SearchSeenLogQueryHandler(
IDialogDbContext db,
IMapper mapper,
IAltinnAuthorization altinnAuthorization,
Expand All @@ -37,7 +37,7 @@ public SearchDialogSeenLogQueryHandler(
_userRegistry = userRegistry ?? throw new ArgumentNullException(nameof(userRegistry));
}

public async Task<SearchDialogSeenLogResult> Handle(SearchDialogSeenLogQuery request, CancellationToken cancellationToken)
public async Task<SearchSeenLogResult> Handle(SearchSeenLogQuery request, CancellationToken cancellationToken)
{
var currentUserInformation = await _userRegistry.GetCurrentUserInformation(cancellationToken);

Expand Down Expand Up @@ -72,7 +72,7 @@ public async Task<SearchDialogSeenLogResult> Handle(SearchDialogSeenLogQuery req
return dialog.SeenLog
.Select(x =>
{
var dto = _mapper.Map<SearchDialogSeenLogDto>(x);
var dto = _mapper.Map<SeenLogDto>(x);
dto.IsCurrentEndUser = currentUserInformation.UserId.ExternalIdWithPrefix == x.SeenBy.ActorId;
return dto;
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogSeenLogs.Queries.Search;

public sealed class SearchDialogSeenLogDto
public sealed class SeenLogDto
{
public Guid Id { get; set; }
public DateTimeOffset SeenAt { get; set; }

public SearchDialogSeenLogSeenByActorDto SeenBy { get; set; } = null!;
public SeenLogSeenByActorDto SeenBy { get; set; } = null!;

public bool IsViaServiceOwner { get; set; }
public bool IsCurrentEndUser { get; set; }
}

public sealed class SearchDialogSeenLogSeenByActorDto
public sealed class SeenLogSeenByActorDto
{
public Guid Id { get; set; }
public string ActorName { get; set; } = null!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogSystemLabels.Commands.Set;

public sealed class SetDialogSystemLabelCommandValidator : AbstractValidator<SetDialogSystemLabelCommand>
public sealed class SetDialogSystemLabelCommandValidator : AbstractValidator<SystemLabelCommand>
{
public SetDialogSystemLabelCommandValidator()
{
Expand Down
Loading
Loading