Last active
June 13, 2022 15:23
-
-
Save diegodlh/ad554bcef28d8bcb7d0ca1a7af64f47b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://json-schema.org/draft/2020-12/schema", | |
"$id": "https://gitlab.wikimedia.org/diegodlh/w2c-core/-/blob/main/tests.schema.json", | |
"title": "Domain translation tests configuration for Web2Cit", | |
"description": "Each translation test defines translation output goals for a specific test webpage (see https://meta.wikimedia.org/wiki/Web2Cit/Early_adopters#tests.json)", | |
"type": "array", | |
"format": "tabs-top", | |
"items": { | |
"title": "Translation test", | |
"type": "object", | |
"properties": { | |
"path": { | |
"title": "Path", | |
"description": "Path of the webpage used as translation test.", | |
"options": { | |
"infoText": "Do not include the hostname; just the path beginning with \"/\". You may also include query (?) and fragment (#) components. Duplicate translation tests for the same path will be ignored.", | |
"patternmessage": "Path must start with \"/\"" | |
}, | |
"type": "string", | |
"default": "/", | |
"pattern": "^\/.*" | |
}, | |
"fields": { | |
"title": "Fields", | |
"description": "Each test field specifies a translation output goal for a specific citation field (see https://meta.wikimedia.org/wiki/Web2Cit/Early_adopters#Translation_field_types)", | |
"options": { | |
"infoText": "Duplicate test fields with the same field name will be ignored.", | |
"disable_array_reorder": true | |
}, | |
"type": "array", | |
"format": "tabs-top", | |
"items": { | |
"title": "Test field", | |
"options": { "error_messages": { | |
"en": { "error_oneOf": "Invalid translation goal" } | |
}}, | |
"type": "object", | |
"properties": { | |
"fieldname": { | |
"type": "string", | |
"options": { "hidden": true } | |
}, | |
"goal": { | |
"title": "Translation goal", | |
"description": "A list of values representing the expected translation output for a test field.", | |
"options": { "infoText": "Provide an empty list to explicitly express that no output is expected." }, | |
"type": "array", | |
"format": "table", | |
"items": { | |
"title": "Output value", | |
"type": "string" | |
}, | |
"default": [""] | |
} | |
}, | |
"required": [ | |
"fieldname", | |
"goal" | |
], | |
"oneOf": [ | |
{ | |
"title": "Item type field", | |
"description": "Type of the cited resource", | |
"properties": { | |
"fieldname": { | |
"title": "Field name", | |
"enum": ["itemType"] | |
}, | |
"goal": { | |
"minItems": 1, | |
"options": { "infoText": "" }, | |
"maxItems": 1, | |
"items": { | |
"description": "One of the Citoid/Zotero supported types", | |
"enum": [ | |
"artwork", | |
"attachment", | |
"audioRecording", | |
"bill", | |
"blogPost", | |
"book", | |
"bookSection", | |
"case", | |
"computerProgram", | |
"conferencePaper", | |
"dictionaryEntry", | |
"document", | |
"email", | |
"encyclopediaArticle", | |
"film", | |
"forumPost", | |
"hearing", | |
"instantMessage", | |
"interview", | |
"journalArticle", | |
"letter", | |
"magazineArticle", | |
"manuscript", | |
"map", | |
"newspaperArticle", | |
"note", | |
"patent", | |
"podcast", | |
"presentation", | |
"radioBroadcast", | |
"report", | |
"statute", | |
"thesis", | |
"tvBroadcast", | |
"videoRecording", | |
"webpage" | |
] | |
} | |
} | |
} | |
}, | |
{ | |
"title": "Title field", | |
"description": "Title of the cited resource", | |
"properties": { | |
"fieldname": { | |
"title": "Field name", | |
"enum": ["title"] | |
}, | |
"goal": { | |
"minItems": 1, | |
"options": { "infoText": "" }, | |
"maxItems": 1, | |
"items": { | |
"description": "A non-empty string", | |
"pattern": "^.+$", | |
"options": { | |
"patternmessage": "Value must be a non-emtpy string" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"title": "Author last/full names field", | |
"description": "Authors' last or full names", | |
"properties": { | |
"fieldname": { | |
"title": "Field name", | |
"enum": ["authorLast"] | |
}, | |
"goal": { | |
"items": { | |
"description": "A non-empty string", | |
"pattern": "^.+$", | |
"options": { | |
"patternmessage": "Value must be a non-emtpy string" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"title": "Author first names field", | |
"description": "Authors' first names", | |
"properties": { | |
"fieldname": { | |
"title": "Field name", | |
"enum": ["authorFirst"] | |
}, | |
"goal": { | |
"items": { | |
"description": "An empty or non-empty string", | |
"pattern": "^.*$" | |
} | |
} | |
} | |
}, | |
{ | |
"title": "Date field", | |
"description": "Publishing date", | |
"properties": { | |
"fieldname": { | |
"title": "Field name", | |
"enum": ["date"] | |
}, | |
"goal": { | |
"maxItems": 1, | |
"items": { | |
"description": "A date matching yyyy-mm-dd, yyyy-mm or yyyy formats", | |
"pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$", | |
"options": { | |
"patternmessage": "Value must match one of yyyy-mm-dd, yyyy-mm or yyyy formats" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"title": "Published in field", | |
"description": "Work containing the cited resource", | |
"properties": { | |
"fieldname": { | |
"title": "Field name", | |
"enum": ["publishedIn"] | |
}, | |
"goal": { | |
"maxItems": 1, | |
"items": { | |
"description": "A non-empty string", | |
"pattern": "^.+$", | |
"options": { | |
"patternmessage": "Value must be a non-emtpy string" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"title": "Published by field", | |
"description": "Publisher of the cited resource", | |
"properties": { | |
"fieldname": { | |
"title": "Field name", | |
"enum": ["publishedBy"] | |
}, | |
"goal": { | |
"maxItems": 1, | |
"items": { | |
"description": "A non-empty string", | |
"pattern": "^.+$", | |
"options": { | |
"patternmessage": "Value must be a non-emtpy string" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"title": "Language field", | |
"description": "Publishing language", | |
"properties": { | |
"fieldname": { | |
"title": "Field name", | |
"enum": ["language"] | |
}, | |
"goal": { | |
"maxItems": 1, | |
"items": { | |
"description": "A language code matching xx or xx-xx* formats", | |
"pattern": "^[a-zA-Z]{2}(?:-?[a-zA-Z]{2,})*$" | |
} | |
} | |
} | |
} | |
] | |
} | |
} | |
}, | |
"required": [ | |
"path", | |
"fields" | |
] | |
}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment