addonscript-spec/docs/concepts/namespaces.md

26 lines
1.3 KiB
Markdown
Raw Normal View History

2022-02-16 23:27:55 +01:00
# Namespaces
2022-08-04 16:53:33 +02:00
Namespaces are used in conjunction with addon IDs to uniquely identify an addon.
## Format
Namespaces MUST only contain lowercase alphanumeric characters, hyphens (SHOULD be avoided) and dots.
They SHOULD be in a reversed domain name format. A namespace SHOULD specify the distribution source
2022-08-04 16:53:33 +02:00
(i.e. `com.example.repository`) or the author (i.e. `com.author.website`) of the addon and
optionally also the addon type (i.e. `com.example.repository.mods`, `com.author.website.modpacks`).
## Canonical Namespaces
While an addon MAY have multiple namespaces, it MUST have exactly one canonical
2022-08-31 16:11:10 +02:00
namespace, which is defined in the [addon manifest](../schema/manifest.md#namespace).
An [API instance](../api/) MUST also return the canonical namespace of
2022-08-31 14:40:32 +02:00
the addon on the [addon endpoint](../api/features/addons.md#get-addon)
2022-08-04 16:53:33 +02:00
even if the addon was requested from another namespace. To check, if two addons
are the same addon, their canonical namespace and their ID MUST be equal.
2022-08-04 16:53:33 +02:00
## Default Namespaces
2022-08-31 14:40:32 +02:00
Each [API instance](../api/) has a default namespace. Addons in the
repository of that API instance SHOULD have that namespace, as long as there
2022-08-04 16:53:33 +02:00
are no ID conflicts in the repository. The default namespace does not need
to be the canonical namespace of these addons.