← Schemas Academy

Build the solution · 2 / 5

Offer valid delivery states

Give producers a predictable status vocabulary.

YOUR TASK

Make this happen

3 steps
  1. Add a status property allowing dispatched or delivered, defaulting to dispatched. Preserve trackingId.

  2. Keep the working capabilities from the previous lesson and connect the new pieces to the same solution.

  3. Check the complete solution, then inspect any unmet requirements.

This step starts with the earlier solution and one new challenge. Each lesson keeps its own draft.

Read the starter files

main.cococo

external_schema "supplier" {
  name = "Supplier delivery contract"
  format = "JSON_SCHEMA"
  sourceText = file("contract.json")
}

contract.json

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Supplier delivery",
  "type": "object",
  "properties": {
    "trackingId": {
      "type": "string",
      "minLength": 1
    }
  },
  "required": [
    "trackingId"
  ],
  "additionalProperties": false
}

Reference: schemas · authoringschemas · external-schemas