JSON Schema Definition
The complete JSON schema used to validate color palette entries:schema.json
Validation Rules Breakdown
Root Level Validation
string
default:"object"
The color palettes file must be a JSON object at the root level.
boolean
default:"false"
Only protocol entries matching the pattern are allowed. No extra top-level properties.
Protocol Name Pattern
object
Protocol names must match: Invalid Protocol Names:
^[A-Za-z0-9\\s\\-_().₮]+$Valid Protocol Names:Hex Color Validation
string
Pattern: Invalid Hex Codes:
^#[0-9A-Fa-f]{6}$Requirements:- Must start with
# - Must be followed by exactly 6 hexadecimal characters
- Accepts both uppercase (A-F) and lowercase (a-f)
- No alpha channel (8-character codes not allowed)
Aliases Array Validation
number
default:"1"
At least one alias is required.
boolean
default:"true"
All aliases in the array must be unique (no duplicates).
string
Pattern: Invalid Alias Examples:
^[a-zA-Z0-9_\\s.₮-]+$Valid Alias Examples:Required Properties
array
default:"[\"hex\", \"aliases\"]"
Both
hex and aliases are required for every protocol entry.Additional Properties
boolean
default:"false"
Protocol objects can only contain
hex and aliases properties. No additional fields allowed.Automated CI Validation
Every pull request triggers automated validation checks to ensure data quality and prevent conflicts.1
JSON Schema Validation
The CI pipeline validates the entire
color-palettes.json file against the schema definition.Checks performed:- Valid JSON syntax
- All protocol names match the allowed pattern
- All hex codes are valid 6-character hex colors
- All aliases arrays have at least one item
- All aliases match the allowed pattern
- No duplicate aliases within the same entry
- No additional properties present
2
Alias Conflict Detection
The CI system checks for duplicate aliases across different protocols.Error message:
Alias conflict detected: "bsc" is used by both "BNB" and "Basis Cash"3
Hex Color Format
Validates that all hex codes follow the correct format and contain valid hexadecimal characters.
4
Required Fields Check
Ensures every protocol entry includes both required fields:
hex and aliases.Validation Examples
Complete Valid Entry
Common Validation Errors
Missing # in Hex Code
Missing # in Hex Code
String does not match pattern "^#[0-9A-Fa-f]{6}$"Fix: Add # prefix to the hex code:Empty Aliases Array
Empty Aliases Array
Array must contain at least 1 item (minItems: 1)Fix: Add at least one alias:Invalid Hex Characters
Invalid Hex Characters
String does not match pattern "^#[0-9A-Fa-f]{6}$"Fix: Use only valid hexadecimal characters (0-9, A-F):Duplicate Aliases in Same Entry
Duplicate Aliases in Same Entry
Array items must be unique (uniqueItems: true)Fix: Remove duplicates:Additional Properties
Additional Properties
Additional properties not allowed (additionalProperties: false)Fix: Remove extra properties:Incorrect Hex Code Length
Incorrect Hex Code Length
String does not match pattern "^#[0-9A-Fa-f]{6}$"Fix: Use exactly 6 hexadecimal characters:Testing Validation Locally
Using Command Line Tools
IDE Integration
Modern code editors can validate JSON files against schemas automatically:Validation Best Practices
Validate Early
Test your changes locally before creating a pull request to catch errors immediately.
Use Schema-Aware Editors
Configure your IDE to validate against the schema for real-time feedback.
Check Alias Conflicts
Search the existing file for aliases before adding new ones to avoid conflicts.
Follow Patterns
Look at existing entries as examples when adding new protocols.
The automated CI validation is the final gate before merging. All validation checks must pass for a pull request to be approved.