Declarative-Languages / Declarative Language Practical 1 / Question 1 / courses_schema.json
courses_schema.json
Raw
{
  "$schema": "http://json-schema.org/2020-12/schema",
  "type": "object",
  "properties": {
    "student": {
      "type": "string"
    },
    "program": {
      "type": "string"
    },
    "level": {
      "type": "integer",
      "minimum": 1,
      "maximum": 8
    },
    "term": {
      "type": "string",
      "pattern": "^(W|S|F)\\d{4}$"
    },
    "courses": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "pattern": "^[A-Z]{4}-\\d{4}$"
          },
          "name": {
            "type": "string"
          },
          "delivery": {
            "type": "string",
            "enum": [ "in-person", "online", "hybrid" ]
          },
          "hours": {
            "type": "integer",
            "minimum": 1
          },
          "credits": {
            "type": "number",
            "minimum": 0
          }
        },
        "required": [ "code", "hours" ],
        "additionalProperties":  false
      }
    }
  },
  "required": [ "student", "term", "courses" ],
  "additionalProperties":  false
}