{
  "slug": "env-schema-validate",
  "name": "gizza-ai/env-schema-validate",
  "version": "0.1.0",
  "title": "Env Schema Validator — Check a .env Against Required Keys, Types & Allowed Values — gizza.ai",
  "description": "Paste a .env file and a schema to catch missing, mistyped and out-of-range variables before your app boots. Rules or JSON Schema. Runs in your browser.",
  "tags": [
    "env schema validator",
    "validate .env file",
    "dotenv schema",
    "required env variables",
    "env type check",
    "env allowed values",
    "env var linter",
    "env validation CI"
  ],
  "category": "data",
  "urls": {
    "page": "https://gizza.ai/tools/env-schema-validate/",
    "markdown": "https://gizza.ai/tools/env-schema-validate/index.md",
    "descriptor": "https://gizza.ai/tools/env-schema-validate/tool.json",
    "deep_link_example": "https://gizza.ai/tools/env-schema-validate/?env=%23%20staging%0Aexport%20NODE_ENV%3Dstaging%0APORT%3D99999%0ADATABASE_URL%3Dlocalhost%0AAPI_KEY%3Dshort%0ALEGACY_FLAG%3D1&schema=NODE_ENV%3Drequired%7Cenum%3Adevelopment%2Cstaging%2Cproduction%0APORT%3Drequired%7Cport%0ADATABASE_URL%3Drequired%7Curl%0AAPI_KEY%3Drequired%7Cmin%3A32%0ATIMEOUT%3Dnumber%7Cmin%3A1%7Cmax%3A60%7Cdefault%3A30&schema_format=auto&unknown_keys=warn&empty_is_missing=true&output=report"
  },
  "cli": "gizza tool env-schema-validate \"# staging\nexport NODE_ENV=staging\nPORT=99999\nDATABASE_URL=localhost\nAPI_KEY=short\nLEGACY_FLAG=1\" 'schema=NODE_ENV=required|enum:development,staging,production\nPORT=required|port\nDATABASE_URL=required|url\nAPI_KEY=required|min:32\nTIMEOUT=number|min:1|max:60|default:30'",
  "tool": {
    "description": "Check a .env (dotenv) file against a DECLARED schema and report every variable that is missing, mistyped or outside its allowed values — before the app starts and fails with a confusing runtime error. Pass the file text in `env` and the schema in `schema`. The rules dialect is one 'KEY=rule|rule:arg' line per variable: required/optional; the types string, number, integer, boolean, port, url, email, host and json; enum:a,b,c for allowed values; min:N/max:N (numeric bound for numeric types, character-length bound otherwise); pattern:REGEX; secure (mixed-case + digit + symbol, 8+ chars); and default:VALUE (documentation only — a missing key that documents a default is a warning, not an error). A bare 'KEY=' line means required, so a .env.example pastes straight in (or set schema_format='example' to treat every key of a template as required). A JSON Schema object is accepted as well (type/required/properties with enum, minimum/maximum, minLength/maxLength, pattern, format and default) — schema_format='auto' detects it. `unknown_keys` controls whether keys set in the file but absent from the schema warn (default), are ignored, or fail. `empty_is_missing` (default true) treats 'KEY=' as not set. `output` selects 'report' (default, human-readable with line numbers and severities) or 'json' (structured, for CI). Values of secret-looking keys (SECRET/TOKEN/PASSWORD/KEY/AUTH) are masked in the report. Runs locally; nothing is uploaded.",
    "parameters": {
      "additionalProperties": false,
      "properties": {
        "empty_is_missing": {
          "default": true,
          "description": "Treat an empty value ('KEY=') as not set, so a required key with a blank value is reported as missing. Turn off to validate the empty string against the declared type and rules instead. Default true.",
          "type": "boolean"
        },
        "env": {
          "description": "The .env file contents to check (KEY=VALUE lines; # comments, blank lines, quotes, inline comments and an 'export ' prefix are understood; duplicate keys are last-wins). Nothing is uploaded — the file is only read to produce the report.",
          "type": "string"
        },
        "output": {
          "default": "report",
          "description": "Output form: 'report' (default) a human-readable PASSED/FAILED summary plus one line per issue with the .env line number, severity and rule, or 'json' a structured {ok, declared_keys, file_keys, error_count, warning_count, issues[]} object for CI.",
          "enum": [
            "report",
            "json"
          ],
          "type": "string"
        },
        "schema": {
          "description": "The schema the .env must satisfy. Rules dialect: one 'KEY=rule|rule:arg' line per variable, e.g. 'PORT=required|port', 'NODE_ENV=required|enum:development,production', 'API_KEY=required|min:32', 'DB_PASSWORD=required|secure', 'RELEASE=pattern:^v[0-9]+$', 'TIMEOUT=number|min:1|max:60|default:30'. Rules: required, optional, string, number, integer, boolean, port, url, email, host, json, enum:a,b, min:N, max:N (value bound for numeric types, character-length bound otherwise), pattern:REGEX, secure, default:VALUE (documentation only). A bare 'KEY=' line just means required. JSON Schema is accepted too (see schema_format).",
          "type": "string"
        },
        "schema_format": {
          "default": "auto",
          "description": "How to read `schema`: 'auto' (default — text starting with '{' is JSON Schema, anything else is the rules dialect), 'rules', 'json-schema' (a JSON Schema object using type/required/properties with enum, minimum/maximum, minLength/maxLength, pattern, format uri|email|hostname and default), or 'example' (paste a .env.example — every key it lists becomes required and its placeholder values are ignored).",
          "enum": [
            "auto",
            "rules",
            "json-schema",
            "example"
          ],
          "type": "string"
        },
        "unknown_keys": {
          "default": "warn",
          "description": "What to do with keys set in the .env but not declared in the schema: 'warn' (default, listed as a warning), 'ignore' (say nothing), or 'error' (strict mode — an undeclared key fails the check).",
          "enum": [
            "warn",
            "ignore",
            "error"
          ],
          "type": "string"
        }
      },
      "required": [
        "env",
        "schema"
      ],
      "type": "object"
    }
  }
}