Skip to content

Generate config.schema.json file for validation inside mod managers #928

@erri120

Description

@erri120

SMAPI mods write config.json files into the mod folder. This is the usual modding process:

flowchart TD
    1[Install mod]
    2[Run game to generate config.json]
    3[Edit config.json]
    4[Run Game]
    5{Valid config?}
    1 --> 2 --> 3 --> 4 --> 5
    5 -- Yes --> Done
    5 -- No --> 3
Loading

To make modding easier and less error-prone, mod managers should be able to validate the config.json file without requiring the user to run the game and check the SMAPI logs:

flowchart TD
    1[Install mod]
    2[Run game to generate config.json]
    3[Edit config.json]
    5{Valid config?}
    1 --> 2 --> 3 --> 5
    5 -- Yes --> Done
    5 -- No --> 3
Loading

Currently, mod managers are only able to validate if the config.json file is valid JSON. For validation of properties, mod managers would need a JSON schema file config.schema.json. Such a file could be generated by SMAPI on startup.

Besides validation, a schema file would also allow mod managers to provide rich config editors without requiring users to open external tools like Notepad++ or VS Code. This makes modding even easier and will massively reduce support questions for broken config files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions