Initial expense schema

This commit is contained in:
Basti 2020-05-06 11:24:02 +02:00
parent 98f5c3d1a6
commit d7dfb3dfd4
No known key found for this signature in database
GPG Key ID: BE4634D632D39B67
2 changed files with 111 additions and 0 deletions

9
examples/expense.json Normal file
View File

@ -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"]
}

102
schemas/expense.json Normal file
View File

@ -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"
]
}
]
}
}
}
}