Draft v0.1 — published for review. Not final until approved; may change incompatibly before 1.0.

Isto Intents DemandSummary

demand-summary.schema.json · raw JSON · JSON Schema 2020-12

How many active intents fit a band of stock, never anything identifying (spec §6). Counts below the holder's anonymity threshold are withheld, not sent.

$id: https://istointents.org/schemas/0.1/demand-summary.schema.json

Fields#

fieldtyperequireddescription
specVersioncommon › versionyes
type"demand-summary"yes
idcommon › idyes
createdcommon › timestampyes
holdercommon › partyyes
categorycommon › categoryyes
countrycommon › countryyes
currencycommon › currencyyes
bandsobjectyes
buyersinteger (≥ 1)yes
asOfcommon › timestampyes
extensionscommon › extensions

Examples#

Full schema#

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://istointents.org/schemas/0.1/demand-summary.schema.json",
  "title": "Isto Intents DemandSummary",
  "description": "How many active intents fit a band of stock, never anything identifying (spec §6). Counts below the holder's anonymity threshold are withheld, not sent.",
  "type": "object",
  "required": [
    "specVersion",
    "type",
    "id",
    "created",
    "holder",
    "category",
    "country",
    "currency",
    "bands",
    "buyers",
    "asOf"
  ],
  "properties": {
    "specVersion": {
      "$ref": "common.schema.json#/$defs/version"
    },
    "type": {
      "const": "demand-summary"
    },
    "id": {
      "$ref": "common.schema.json#/$defs/id"
    },
    "created": {
      "$ref": "common.schema.json#/$defs/timestamp"
    },
    "holder": {
      "$ref": "common.schema.json#/$defs/party"
    },
    "category": {
      "$ref": "common.schema.json#/$defs/category"
    },
    "country": {
      "$ref": "common.schema.json#/$defs/country"
    },
    "currency": {
      "$ref": "common.schema.json#/$defs/currency"
    },
    "bands": {
      "type": "object",
      "properties": {
        "make": {
          "type": "string"
        },
        "model": {
          "type": "string"
        },
        "propertyType": {
          "type": "string"
        },
        "price": {
          "type": "object",
          "required": [
            "from",
            "to"
          ],
          "properties": {
            "from": {
              "$ref": "common.schema.json#/$defs/amount"
            },
            "to": {
              "$ref": "common.schema.json#/$defs/amount"
            }
          },
          "additionalProperties": false
        },
        "years": {
          "type": "object",
          "required": [
            "from",
            "to"
          ],
          "properties": {
            "from": {
              "type": "integer"
            },
            "to": {
              "type": "integer"
            }
          },
          "additionalProperties": false
        },
        "area": {
          "$ref": "common.schema.json#/$defs/area"
        },
        "transaction": {
          "enum": [
            "sale",
            "rent"
          ]
        },
        "rooms": {
          "type": "object",
          "required": [
            "from"
          ],
          "properties": {
            "from": {
              "type": "integer",
              "minimum": 0
            },
            "to": {
              "type": "integer",
              "minimum": 0
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "buyers": {
      "type": "integer",
      "minimum": 1
    },
    "asOf": {
      "$ref": "common.schema.json#/$defs/timestamp"
    },
    "extensions": {
      "$ref": "common.schema.json#/$defs/extensions"
    }
  },
  "additionalProperties": false,
  "allOf": [
    {
      "description": "A vehicle band is always a sale (spec §6).",
      "if": {
        "properties": {
          "category": {
            "const": "vehicle"
          }
        },
        "required": [
          "category"
        ]
      },
      "then": {
        "properties": {
          "bands": {
            "properties": {
              "transaction": {
                "const": "sale"
              }
            }
          }
        }
      }
    },
    {
      "description": "A property band with a price must say whether it is a sale or a monthly rent: the two are not on one grid (spec §6).",
      "if": {
        "properties": {
          "category": {
            "const": "property"
          },
          "bands": {
            "required": [
              "price"
            ]
          }
        },
        "required": [
          "category",
          "bands"
        ]
      },
      "then": {
        "properties": {
          "bands": {
            "required": [
              "transaction"
            ]
          }
        }
      }
    }
  ]
}