Skip to content

Conversation

@KANAjetzt
Copy link
Member

@KANAjetzt KANAjetzt commented Oct 29, 2025

Added enum validation, so enums can be used in Mod Configs.
Useful to define drop down selections.

https://json-schema.org/understanding-json-schema/reference/enum

Example Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.com/sandwich-shop.schema.json",
  "title": "Sandwich Shop Menu",
  "description": "A schema representing sandwiches sold in a sandwich shop.",
  "type": "object",
  "properties": {
    "shopName": {
      "type": "string"
    },
    "location": {
      "type": "string"
    },
    "open": {
      "type": "boolean",
      "default": true
    },
    "menu": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "breadType": {
            "type": "string",
            "enum": ["white", "whole_wheat", "rye", "sourdough", "gluten_free"]
          },
          "size": {
            "description": "Can be a string size label or a numeric inch size.",
            "enum": ["small", "medium", "large", 6, 12],
            "default": "medium"
          },
          "ingredients": {
            "type": "array",
            "items": { "type": "string" },
            "minItems": 2
          },
          "price": {
            "type": "number",
            "minimum": 1.0
          },
          "available": {
            "type": "boolean",
            "default": true
          }
        },
        "required": ["name", "breadType", "ingredients", "price"]
      }
    }
  },
  "required": ["shopName", "menu"]
}

@KANAjetzt KANAjetzt self-assigned this Oct 29, 2025
@KANAjetzt KANAjetzt added the enhancement New feature or request label Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants