Convox Community

Validating convox.yml

Has anyone done work on linting/validating your convox.yml? Are there any tricks to do this with the CLI prior to running a convox deploy / workflow? I’d like to have this as a CI check and something to run locally when changing the configuration file.

I was just experimenting with https://www.npmjs.com/package/pajv, which converts JSON and uses https://json-schema.org/ to validate the structure of the file. Here’s an example that does some basic validation against the top level environment variables & timers:

{
  "definitions": {
    "timer": {
      "type": "object",
      "properties": {
        "command": {"type": "string"},
        "schedule": {"type": "string"},
        "service": {"type": "string"}
      },
      "required": ["command", "schedule", "service"],
      "additionalProperties": false
    }
  },
  "type": "object",
  "properties": {
    "environment": {
    "type": "array",
      "items": {
        "type": "string"
      },
      "uniqueItems": true
    },
    "timers": {
      "type": "object",
      "uniqueItems": true,
      "patternProperties": {
        "^[a-z_]*$": {
          "$ref": "#/definitions/timer"
        }
      }
    }
  }
}