Skip to content

Commit

Permalink
Merge pull request #2 from thunderbird/features/1-json-schema
Browse files Browse the repository at this point in the history
Add draft of schema file
  • Loading branch information
radishmouse authored Jul 11, 2024
2 parents 7f6a8a8 + 566caa4 commit f340d58
Show file tree
Hide file tree
Showing 2 changed files with 369 additions and 0 deletions.
244 changes: 244 additions & 0 deletions generated-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
{
"$defs": {
"ChannelEnum": {
"enum": [
"default",
"esr",
"release",
"beta",
"daily"
],
"title": "ChannelEnum",
"type": "string"
},
"Notification": {
"properties": {
"id": {
"format": "uuid",
"title": "Id",
"type": "string"
},
"start_at": {
"format": "date-time",
"title": "Start At",
"type": "string"
},
"end_at": {
"format": "date-time",
"title": "End At",
"type": "string"
},
"title": {
"title": "Title",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
},
"URL": {
"anyOf": [
{
"format": "uri",
"maxLength": 2083,
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Url"
},
"CTA": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Cta"
},
"severity": {
"$ref": "#/$defs/SeverityEnum"
},
"type": {
"$ref": "#/$defs/TypeEnum"
},
"targeting": {
"$ref": "#/$defs/Targeting"
}
},
"required": [
"id",
"start_at",
"end_at",
"title",
"description",
"severity",
"type",
"targeting"
],
"title": "Notification",
"type": "object"
},
"OperatingSystemEnum": {
"enum": [
"win",
"macosx",
"linux",
"freebsd",
"openbsd",
"netbsd",
"solaris",
"other"
],
"title": "OperatingSystemEnum",
"type": "string"
},
"Profile": {
"properties": {
"locales": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Locales"
},
"versions": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Versions"
},
"channels": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/ChannelEnum"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Channels"
},
"operating_systems": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/OperatingSystemEnum"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Operating Systems"
}
},
"title": "Profile",
"type": "object"
},
"SeverityEnum": {
"enum": [
1,
2,
3,
4,
5
],
"title": "SeverityEnum",
"type": "integer"
},
"Targeting": {
"properties": {
"percent_chance": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"title": "Percent Chance"
},
"exclude": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/Profile"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Exclude"
},
"include": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/Profile"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Include"
}
},
"title": "Targeting",
"type": "object"
},
"TypeEnum": {
"enum": [
"donation",
"message",
"security",
"blog"
],
"title": "TypeEnum",
"type": "string"
}
},
"items": {
"$ref": "#/$defs/Notification"
},
"title": "NotificationSchema",
"type": "array"
}
125 changes: 125 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Thunderbird In-App Notifications",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"description": "Unique ID set by the server"
},
"start_at": {
"type": "string",
"format": "date-time",
"description": "UTC Timestamp after which Thunderbird will show the event after startup."
},
"end_at": {
"type": "string",
"format": "date-time",
"description": "UTC Timestamp after which Thunderbird will never show the event, even if it has never been shown to the user."
},
"title": {
"type": "string",
"description": "Short sentence describing the event which will be displayed in the Thunderbird UI."
},
"description": {
"type": "string",
"description": "A short paragraph that can contain HTML and will be displayed in the Thunderbird UI."
},
"URL": {
"type": "string",
"format": "uri",
"description": "URL to open from the CTA, if any."
},
"CTA": {
"type": "string",
"description": "Link text to show for the URL."
},
"severity": {
"enum": [1, 2, 3, 4, 5],
"description": "Severity level, where 1 is the most important/urgent and 5 is the least."
},
"type": {
"enum": ["donation", "message", "security", "blog"],
"description": "Category of notification."
},
"targeting": {
"type": "object",
"properties": {
"percent_chance": {
"type": "number",
"minimum": 0,
"maximum": 100
},
"exclude": {
"type": "array",
"items": {
"$ref": "#/definitions/profile"
}
},
"include": {
"type": "array",
"items": {
"$ref": "#/definitions/profile"
}
}
}
}
},
"required": [
"id",
"start_at",
"end_at",
"title",
"description",
"severity",
"type",
"targeting"
],
"dependentRequired": { "CTA": ["URL"] }
},
"definitions": {
"profile": {
"type": "object",
"properties": {
"locales": {
"type": "array",
"items": {
"type": "string"
}
},
"versions": {
"type": "array",
"items": {
"type": "string"
}
},
"channels": {
"type": "array",
"items": {
"enum": ["default", "esr", "release", "beta", "daily"],
"description": "Channel"
}
},
"operating_systems": {
"type": "array",
"items": {
"enum": [
"win",
"macosx",
"linux",
"freebsd",
"openbsd",
"netbsd",
"solaris",
"other"
],
"description": "Operating System"
}
}
}
}
}
}

0 comments on commit f340d58

Please sign in to comment.