Skip to content

Two suggestions for JSON Schema #1862

@SorYoshino

Description

@SorYoshino

1. In the current $defs, the colors schema is defined with the type string and an enum that restricts values to a fixed list of color names (e.g., "red", "bold_", etc.). However, in practical usage, Fastfetch supports more flexible color formats, including combined forms such as "bold_red" or "underline_blue", and possibly other custom values not listed in the enum. This makes the enum restriction semantically incorrect and leads to unnecessary errors or warnings from JSON Schema validators.

Image

It is recommended to remove the enum constraint, retain only "type": "string", and provide a detailed description that explains the supported color format or refers users to the official documentation.

2. Additionally, in the conditions schema, the system field is declared with "type": "string", but it also uses a "oneOf" clause to accept three different types: a single system name (via $ref), an array of system names, and null. This creates a semantic conflict, as "type": "string" contradicts the non-string types allowed in "oneOf" (i.e., arrays and null).

Image

The correct approach is to remove the type declaration and rely solely on the "oneOf" structure, allowing the schema to naturally accept all three intended formats without violating the JSON Schema specification.


These adjustments, though structural in nature, eliminate validator-level warnings and make the definitions more rigorous and semantically aligned.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions