From 2fafdea98330fec53b28574bec646d68a7cbbe54 Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Sat, 27 Nov 2021 10:52:20 -0600 Subject: [PATCH] =?UTF-8?q?feat(dir):=20=E2=9C=A8=20add=20example/default?= =?UTF-8?q?=20prop=20values=20for=20list=20create=20endpoint=20swagger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/575\#issuecomment-980675458 --- .../Commands/CreateList.cs | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/services/Directory/FilterLists.Directory.Application/Commands/CreateList.cs b/services/Directory/FilterLists.Directory.Application/Commands/CreateList.cs index 91d24edd7..ce9060945 100644 --- a/services/Directory/FilterLists.Directory.Application/Commands/CreateList.cs +++ b/services/Directory/FilterLists.Directory.Application/Commands/CreateList.cs @@ -1,4 +1,5 @@ -using FilterLists.Directory.Domain.Aggregates.FilterLists; +using System.ComponentModel; +using FilterLists.Directory.Domain.Aggregates.FilterLists; using FilterLists.Directory.Domain.Aggregates.Licenses; using FilterLists.Directory.Infrastructure.Persistence.Commands.Context; using FluentValidation; @@ -10,22 +11,25 @@ namespace FilterLists.Directory.Application.Commands; public static class CreateList { public record Command( - string Name, + [property: DefaultValue("EasyList")] string Name, IEnumerable ViewUrls, - string? Description = default, - long? LicenseId = default, - Uri? HomeUrl = default, - Uri? OnionUrl = default, - Uri? PolicyUrl = default, - Uri? SubmissionUrl = default, - Uri? IssuesUrl = default, - Uri? ForumUrl = default, - Uri? ChatUrl = default, - string? EmailAddress = default, - Uri? DonateUrl = default, - string? CreateReason = default) : IRequest; + [property: DefaultValue("EasyList is the primary filter list that removes most adverts from international web pages, including unwanted frames, images, and objects. It is the most popular list used by many ad blockers and forms the basis of over a dozen combination and supplementary filter lists.")] string? Description = default, + [property: DefaultValue(4)] long? LicenseId = default, + [property: DefaultValue("https://easylist.to/")] Uri? HomeUrl = default, + [property: DefaultValue(default(Uri))] Uri? OnionUrl = default, + [property: DefaultValue(default(Uri))] Uri? PolicyUrl = default, + [property: DefaultValue(default(Uri))] Uri? SubmissionUrl = default, + [property: DefaultValue("https://github.com/easylist/easylist/issues")] Uri? IssuesUrl = default, + [property: DefaultValue("https://forums.lanik.us/viewforum.php?f=23")] Uri? ForumUrl = default, + [property: DefaultValue(default(Uri))] Uri? ChatUrl = default, + [property: DefaultValue("easylist@protonmail.com")] string? EmailAddress = default, + [property: DefaultValue(default(Uri))] Uri? DonateUrl = default, + [property: DefaultValue("Adding EasyList because I did not see it on FilterLists.com yet.")] string? CreateReason = default) : IRequest; - public record FilterListViewUrl(short SegmentNumber, short Primariness, Uri Url); + public record FilterListViewUrl( + [property: DefaultValue(1)] short SegmentNumber, + [property: DefaultValue(1)] short Primariness, + [property: DefaultValue("https://easylist.to/easylist/easylist.txt")] Uri Url); internal class Validator : AbstractValidator {