diff --git a/examples/expense.json b/examples/expense.json new file mode 100644 index 0000000..2d7e1ee --- /dev/null +++ b/examples/expense.json @@ -0,0 +1,9 @@ +{ + "title": "Server rent", + "description": "Dedicated server: andromeda.kosmos.org, April 2020", + "currency": "EUR", + "amount": 39.00, + "date": "2020-05-06", + "url": "https://wiki.kosmos.org/Infrastructure#Hetzner", + "tags": ["infrastructure", "server", "hetzner"] +} diff --git a/schemas/expense.json b/schemas/expense.json new file mode 100644 index 0000000..8979e2a --- /dev/null +++ b/schemas/expense.json @@ -0,0 +1,102 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "https://schema.kosmos.org/Expense", + "type": "object", + "title": "Expense", + "description": "Record of costs expended", + "default": {}, + "required": [ + "title", + "currency", + "amount" + ], + "additionalProperties": false, + "properties": { + "@context": { + "type": "string", + "enum": [ "https://schema.kosmos.org" ], + "default": "https://schema.kosmos.org" + }, + "@type": { + "type": "string", + "enum": [ "Expense" ], + "default": "Expense" + }, + "title": { + "type": "string", + "title": "Title", + "description": "A short description of the expense", + "default": "", + "examples": [ + "Server rent" + ] + }, + "description": { + "type": "string", + "title": "Description", + "description": "A longer description of the expense", + "default": "", + "examples": [ + "Dedicated server: andromeda.kosmos.org" + ] + }, + "currency": { + "type": "string", + "title": "Currency", + "description": "ISO 4217 (or other) code of the currency that the expense was paid with", + "default": "", + "examples": [ + "EUR", + "USD", + "BTC" + ] + }, + "amount": { + "type": "number", + "title": "Amount", + "description": "Expended amount of defined currency", + "default": 0, + "examples": [ + 42.0 + ] + }, + "date": { + "type": "string", + "format": "date", + "title": "Date", + "description": "Date of contribution (RFC 3339 full-date)" + }, + "url": { + "type": "string", + "format": "uri", + "title": "URL", + "description": "A URL pointing to more information about the expense or related items", + "default": "", + "examples": [ + "https://wiki.kosmos.org/Infrastructure#Hetzner" + ] + }, + "tags": { + "type": "array", + "title": "Tags", + "description": "Tags for organizing, filtering, sorting, etc.", + "default": [], + "items": { + "$id": "#/properties/tags/items", + "anyOf": [ + { + "$id": "#/properties/tags/items/anyOf/0", + "type": "string", + "title": "Tag", + "description": "A tag (lowercase dasherized)", + "default": "", + "examples": [ + "infrastructure", + "server" + ] + } + ] + } + } + } +}