From 354a9505a8d12d10598988b535b6642f38d7999f Mon Sep 17 00:00:00 2001 From: Timo Ley Date: Wed, 16 Feb 2022 23:12:50 +0100 Subject: [PATCH] Update file schema spec --- docs/schema/file.md | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/docs/schema/file.md b/docs/schema/file.md index c901eaf..90d16d3 100644 --- a/docs/schema/file.md +++ b/docs/schema/file.md @@ -3,8 +3,9 @@ ```json { "id": "modfile", - "link": "https://example.com/mymod.jar", + "link": ["https://example.com/mymod.jar", "./mymod.jar"], "flags": [], + "maven": {}, "install": [], "sha1": "somesha1checksum", "conditions": {} @@ -17,32 +18,50 @@ This is the ID of the file. It should be written in the `kebab-case` format, meaning lowercase only and using `-` instead of spaces. - - - -If multiple file objects in the same array have the same ID, they are treated as the same file, -which means that the first one of them in the array will be used unless it can't be retrieved from the URL, -in which case the next one will be used as a fallback. +The file ID has to be unique to this addon version. ### link -This is a [link](../link.md), which points to the actual file. +This is an array of [links](../link.md), which are pointing to the actual file. All of these links must +have the same file type. Since AddonScript treats directories and zip files equally, +they can be mixed in the same link array. When downloading the file, +the first link in this array should be used with the other links as fallback, if the first doesn't work. +If none of the specified links works, the file should be downloaded by it's Maven +specifier from one of the specified repository, but only, if a `sha1` hash is specified, so that it can be +verified, that the downloaded file is correct. + +## Optional properties ### install This is an array of [install objects](install.md). They describe how the file should be installed to the game. The order in the array corresponds to the order in which the installation steps should be applied. -## Optional properties - ### flags This is an array of [flags](../flags.md) for this file. If this property is not present in a file object, the file will use the default flags. ### sha1 -This is the sha1 checksum of the file. Although the checksum is optional, it is recommended. +This is the sha1 checksum of the file. Although the checksum is optional, it is strongly recommended. ### conditions This is a [conditions object](conditions.md). It can only be used, if the [optional flag](../flags.md) was set. + +### maven + +```json +{ + "group": "com.example", + "artifact": "mymod", + "version": "1.0", + "qualifier": "" +} +``` + +Each file has a unique Maven specifier, consisting of a group ID, an artifact ID, a version, a file type and an optional qualifier. +By default, the group ID is equal to the addon namespace, the artifact ID to the addon ID, the version to the addon version and +the qualifier to file ID. Those values can be overwritten in this object. If the qualifier is set to an empty string, it will be +removed from the Maven specifier. The file type is always equal to the file type of the `link`. If the group ID, addon ID and version +all have their default values and the qualifier is an emptry string, the file type may not be `json`.