Table of Contents

fabric.mod.json Specification

In all cases, the mod JSON, fabric.mod.json, is defined as either:

If a “schemaVersion” key is missing, assume version “0”.

It is important to remember that the Fabric mod JSON is authoritative. This means that Loader relies on it specifically to gather the necessary information - from the perspective of an external tool, its contents can be trusted and relied upon.

Version 1 (current)

Pertains to Loader 0.4.0 and above.

Types

ContactInformation

A string→string dictionary containing contact information.

The following keys are officially defined:

There are no mandatory keys.

The list is not exhaustive - mods may provide additional, non-standard keys (such as discord, slack, twitter) - if possible, they should be valid URLs.

EntrypointContainer

An EntrypointContainer is an object.

The keys match the getEntrypoints() “type” field, and are the type of the entrypoints to be listed - “main”, “client”, “server”. The values of those keys are arrays, containing either strings (of the object key “value”'s value) or objects of the following form:

Fabric, by default, will run all “main” entrypoints (type ModInitializer), and all “client” (type ClientModInitializer) or “server” (type DedicatedServerModInitializer) entrypoints after that.

NestedJarEntry

An object with the following keys, of which only “file” is mandatory:

Person

Can be in one of two forms:

In the case of an object, the following keys are defined:

VersionRange

A string or array of string declaring supported version ranges in the form <operator1><range1>[ <operator2><range2>]…. Multiple space separated ranges within the same string follow an “AND” relationship - they must all be satisfied. In the case of an array, an “OR” relationship is assumed between the array elements - that is, only one element has to match for the collective declaration to be satisfied.

In the case of all versions, * is a special string declaring that any version is matched by the range. Fabric Loader supports a https://semver.org/ semver 2.0.0 superset that allows an arbitrary amount of version components, empty pre-release and arbitrary build metadata. Version strings that are incompatible with this format are still accepted, but comparison support is limited to equality operators.

Versions compatible with the extended semver format are compared as defined by https://semver.org/ semver 2.0.0 with arbitrary version component comparisons beign done left to right for all components, treating absent components as 0. The empty pre-release is the earliest possible pre-release, making 1.2- the earliest possible version in the 1.2 series, intended for comparison operand declarations. Build metadata is ignored for comparison as usual.

The following declarations are supported for version strings compatible with this semver superset:

All operators always work the same regardless of the version they are matching against, there is no special casing for 0.x.

Mandatory fields

Optional fields (mod loading)

Optional fields (dependency resolution)

All of the following keys follow the format of a string→VersionRange dictionary, where the string key matches the desired ID.

Optional fields (metadata)

Custom fields

A custom field can be provided in the JSON. It is a dictionary of string keys to JSON elements, and the contents of said JSON elements are entirely arbitrary. The Fabric loader will make no effort to read its contents, aside from a situation in which custom features in older schema versions become official in future schema versions, as a compatibility measure - those will be adequately documented.

It is recommended that the keys be namespaced with the ID of the mod relying on them (if such a mod exists) to prevent conflicts.

Version 0

This version is utilized if the “schemaVersion” field is missing - where it is assumed to be 0. It was used by all Fabric Loader versions prior to 0.4.0. It was inspired by the craftson/spec specification.

TODO: Document me!