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:
Field | Type | Description | Required |
---|---|---|---|
schema | string | The version of the schema (Current version is v1 ). | Yes |
metadata | object | Metadata about the dataset or MMDB file | Yes |
data | array | An array of objects containing the network and record data | Yes |
{
"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.
Field | Type | Availability | Description | Required |
---|---|---|---|---|
DatabaseType | string | generate dump | The type of the database (e.g., GeoLite2-ASN ) | Yes |
Description | object | generate dump | A description of the database in different languages | No |
Languages | array | generate dump | An array of languages supported by the database | No |
BinaryFormatMajorVersion | integer | dump | The major version of the binary format | Yes |
BinaryFormatMinorVersion | integer | dump | The minor version of the binary format | Yes |
BuildEpoch | integer | dump | The build epoch of the database | Yes |
IPVersion | integer | generate dump | The IP version of the database | Yes |
NodeCount | integer | dump | The number of nodes in the database | Yes |
RecordSize | integer | generate dump | The size of each record in bytes | Yes |
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:
Field | Type | Description | Required |
---|---|---|---|
network | string | The network address in CIDR notation ( Both IPv4 and IPv6 are supported ) | Yes |
record | object | The record data associated with the network | Yes |
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"
}
}