add descriptions to json schema

This commit is contained in:
Collin M. Barrett 2017-10-25 11:29:07 -05:00
parent 715b941ad5
commit 5da819f8a3
3 changed files with 43 additions and 8 deletions

View file

@ -2,6 +2,7 @@
"type": "object",
"properties": {
"Name": {
"description": "The name of the list as stated by the list maintainer(s) in title case.",
"type": [
"string",
"null"
@ -9,19 +10,24 @@
"maxLength": 126
},
"ViewUrl": {
"description": "The URL to the list in raw text format. zip files and other formats are acceptable if no text format is available.",
"type": "string",
"minLength": 6,
"maxLength": 2083
"maxLength": 2083,
"format": "uri"
},
"HomeUrl": {
"description": "The URL to the list's home page. Preferably, this is stated in the header of the list. Alternatively, it could be a custom domain, GitHub page, blog post, forum post, etc. that serves as a primary source of information for the list.",
"type": [
"string",
"null"
],
"minLength": 6,
"maxLength": 2083
"maxLength": 2083,
"format": "uri"
},
"Description": {
"description": "A brief description of the list's functionality. Preferably, this is quoted (if non-English, translate to English via translator or Google Translate for consistency) from the list's documentation or composed by a maintainer of the list. If neither are available, a generic description should be composed by the FilterLists contributor.",
"type": [
"string",
"null"
@ -29,14 +35,17 @@
"maxLength": 1022
},
"DescriptionSourceUrl": {
"description": "The URL to the list's documentation page from which the description was quoted if applicable.",
"type": [
"string",
"null"
],
"minLength": 6,
"maxLength": 2083
"maxLength": 2083,
"format": "uri"
},
"Author": {
"description": "The author (person or group) who maintains the list.",
"type": [
"string",
"null"
@ -44,22 +53,27 @@
"maxLength": 126
},
"ForumUrl": {
"description": "The URL to the list's forum where issues, change requests, etc. are discussed.",
"type": [
"string",
"null"
],
"minLength": 6,
"maxLength": 2083
"maxLength": 2083,
"format": "uri"
},
"IssuesUrl": {
"description": "The URL to the list's GitHub Issues.",
"type": [
"string",
"null"
],
"minLength": 6,
"maxLength": 2083
"maxLength": 2083,
"format": "uri"
},
"Email": {
"description": "The email address of the list's maintainer(s) if publicly available.",
"type": [
"string",
"null"
@ -68,12 +82,14 @@
"maxLength": 126
},
"DonateUrl": {
"description": "The URL to the list's donation page. This could be a custom PayPal or similar link, or a link to a web page discussing various donation options. Pull requests that include changes to this link will undergo further verification to prevent fraud.",
"type": [
"string",
"null"
],
"minLength": 6,
"maxLength": 2083
"maxLength": 2083,
"format": "uri"
},
"Id": {
"type": "integer"

View file

@ -1,4 +1,5 @@
using Microsoft.AspNetCore;
using FilterLists.Data.Schema;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
namespace FilterLists.Api
@ -7,6 +8,7 @@ public class Program
{
public static void Main(string[] args)
{
JsonSchemaGenerator.WriteSchemaToFiles();
BuildWebHost(args).Run();
}

View file

@ -1,44 +1,61 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using FilterLists.Data.Models.Contracts;
namespace FilterLists.Data.Models.Implementations
{
public class List : BaseEntity, IList
{
[Description(@"The name of the list as stated by the list maintainer(s) in title case.")]
[MaxLength(126)]
public string Name { get; set; }
[Description(@"The URL to the list in raw text format. zip files and other formats are acceptable if no text format is available.")]
[Url]
[Required]
[MaxLength(2083)]
[MinLength(6)]
public string ViewUrl { get; set; }
[Description(@"The URL to the list's home page. Preferably, this is stated in the header of the list. Alternatively, it could be a custom domain, GitHub page, blog post, forum post, etc. that serves as a primary source of information for the list.")]
[Url]
[MaxLength(2083)]
[MinLength(6)]
public string HomeUrl { get; set; }
[Description(@"A brief description of the list's functionality. Preferably, this is quoted (if non-English, translate to English via translator or Google Translate for consistency) from the list's documentation or composed by a maintainer of the list. If neither are available, a generic description should be composed by the FilterLists contributor.")]
[MaxLength(1022)]
public string Description { get; set; }
[Description(@"The URL to the list's documentation page from which the description was quoted if applicable.")]
[Url]
[MaxLength(2083)]
[MinLength(6)]
public string DescriptionSourceUrl { get; set; }
[Description(@"The author (person or group) who maintains the list.")]
[MaxLength(126)]
public string Author { get; set; }
[Description(@"The URL to the list's forum where issues, change requests, etc. are discussed.")]
[Url]
[MaxLength(2083)]
[MinLength(6)]
public string ForumUrl { get; set; }
[Description(@"The URL to the list's GitHub Issues.")]
[Url]
[MaxLength(2083)]
[MinLength(6)]
public string IssuesUrl { get; set; }
[Description(@"The email address of the list's maintainer(s) if publicly available.")]
[MaxLength(126)]
[MinLength(7)]
public string Email { get; set; }
[Description(@"The URL to the list's donation page. This could be a custom PayPal or similar link, or a link to a web page discussing various donation options. Pull requests that include changes to this link will undergo further verification to prevent fraud.")]
[Url]
[MaxLength(2083)]
[MinLength(6)]
public string DonateUrl { get; set; }