{
  "openapi": "3.1.0",
  "info": {
    "title": "Cedar Parcel API",
    "version": "1.0.0"
  },
  "tags": [
    {
      "name": "Parcels",
      "description": "Read parcel records."
    }
  ],
  "paths": {
    "/parcels/{parcelId}": {
      "servers": [
        {
          "url": "https://lookup.api.cedar-parcel.example/v1",
          "description": "Public lookup host"
        }
      ],
      "get": {
        "tags": [
          "Parcels"
        ],
        "summary": "Get a parcel",
        "description": "This lookup route does not use the API's default authentication.",
        "operationId": "getParcel",
        "parameters": [
          {
            "name": "parcelId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Parcel found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Parcel"
                }
              }
            }
          },
          "404": {
            "description": "No parcel has that identifier.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": []
      }
    }
  },
  "components": {
    "schemas": {
      "Parcel": {
        "type": "object",
        "required": [
          "parcelId",
          "status",
          "declaredValue",
          "recipient"
        ],
        "properties": {
          "parcelId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "label_created",
              "in_transit",
              "delivered",
              "exception"
            ]
          },
          "declaredValue": {
            "type": "number",
            "minimum": 0,
            "multipleOf": 0.01,
            "description": "Value in currency units, to the nearest cent."
          },
          "recipient": {
            "$ref": "#/components/schemas/Recipient"
          },
          "events": {
            "type": "array",
            "description": "Tracking history in chronological order.",
            "items": {
              "type": "object",
              "required": [
                "kind",
                "at"
              ],
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "pickup",
                    "scan",
                    "delivery"
                  ]
                },
                "at": {
                  "type": "string",
                  "format": "date-time"
                },
                "details": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          }
        }
      },
      "Problem": {
        "type": "object",
        "required": [
          "type",
          "title",
          "status"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          }
        }
      },
      "Recipient": {
        "type": "object",
        "required": [
          "city",
          "postalCode"
        ],
        "properties": {
          "city": {
            "type": "string"
          },
          "postalCode": {
            "type": "string"
          }
        }
      }
    }
  }
}
