Skip to main content

Dataset Schema 🧪

We use JSON datasets to generate MMDB files. The JSON dataset should follow a specific schema to be converted into an MMDB file. The schema is defined below:

Schema Definition

The dataset schema consists of three main fields:

FieldTypeDescriptionRequired
schemastringThe version of the schema (Current version is v1).Yes
metadataobjectMetadata about the dataset or MMDB fileYes
dataarrayAn array of objects containing the network and record dataYes
{
"schema": "v1",
"metadata": {},
"data": []
}

Schema Field

The schema field is used to define the version of the schema. Currently, the only supported version is v1, we may introduce new versions in the future in case of schema changes which are not backward compatible.

Metadata Field

The metadata field is an object that contains information about the dataset or MMDB file. The metadata object depends on whether it's generated by the dump command or manually created for the generate command, and will contain different fields.

FieldTypeAvailabilityDescriptionRequired
DatabaseTypestringgenerate dumpThe type of the database (e.g., GeoLite2-ASN)Yes
Descriptionobjectgenerate dumpA description of the database in different languagesNo
Languagesarraygenerate dumpAn array of languages supported by the databaseNo
BinaryFormatMajorVersionintegerdumpThe major version of the binary formatYes
BinaryFormatMinorVersionintegerdumpThe minor version of the binary formatYes
BuildEpochintegerdumpThe build epoch of the databaseYes
IPVersionintegergenerate dumpThe IP version of the databaseYes
NodeCountintegerdumpThe number of nodes in the databaseYes
RecordSizeintegergenerate dumpThe size of each record in bytesYes

Data Field

The data field is an array of objects that contain the network and record data. Each object in the array should have the following fields:

FieldTypeDescriptionRequired
networkstringThe network address in CIDR notation ( Both IPv4 and IPv6 are supported )Yes
recordobjectThe record data associated with the networkYes

Example:

{
"network": "1.1.1.1/32",
"record": {
"key_1": "value_1",
"key_2": "value_2",
"key_3": true,
"key_4": 123,
"key_5": [
"value_1",
"value_2"
],
"key_6": {
"sub_key_1": "value_1",
"sub_key_2": "value_2"
}
}