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

Isto Intents Offer

offer.schema.json · raw JSON · JSON Schema 2020-12

One concrete item on the market (spec section 5). Never carries a private seller's contact.

$id: https://istointents.org/schemas/0.1/offer.schema.json

Fields#

fieldtyperequireddescription
specVersioncommon › versionyes
type"offer"yes
idcommon › idyes
createdcommon › timestampyes
sourceobjectyes
categorycommon › categoryyes
countrycommon › countryyes
currencycommon › currencyyes
pricecommon › amountyes
itemobjectyes
locationobject
sellerobjectyes
observedAtcommon › timestampyes
inReplyTocommon › id
extensionscommon › extensions

Examples#

Full schema#

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://istointents.org/schemas/0.1/offer.schema.json",
  "title": "Isto Intents Offer",
  "description": "One concrete item on the market (spec section 5). Never carries a private seller's contact.",
  "type": "object",
  "required": [
    "specVersion",
    "type",
    "id",
    "created",
    "source",
    "category",
    "country",
    "currency",
    "price",
    "item",
    "seller",
    "observedAt"
  ],
  "properties": {
    "specVersion": {
      "$ref": "common.schema.json#/$defs/version"
    },
    "type": {
      "const": "offer"
    },
    "id": {
      "$ref": "common.schema.json#/$defs/id"
    },
    "created": {
      "$ref": "common.schema.json#/$defs/timestamp"
    },
    "source": {
      "type": "object",
      "required": [
        "operator",
        "kind"
      ],
      "properties": {
        "operator": {
          "$ref": "common.schema.json#/$defs/party"
        },
        "kind": {
          "enum": [
            "listing",
            "feed",
            "reply"
          ]
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "feedFormat": {
          "type": "string",
          "description": "holder-defined identifier of the feed format the offer came from"
        }
      },
      "additionalProperties": false
    },
    "category": {
      "$ref": "common.schema.json#/$defs/category"
    },
    "country": {
      "$ref": "common.schema.json#/$defs/country"
    },
    "currency": {
      "$ref": "common.schema.json#/$defs/currency"
    },
    "price": {
      "$ref": "common.schema.json#/$defs/amount"
    },
    "item": {
      "type": "object",
      "minProperties": 1
    },
    "location": {
      "type": "object",
      "properties": {
        "geo": {
          "$ref": "common.schema.json#/$defs/geo"
        },
        "region": {
          "$ref": "common.schema.json#/$defs/region"
        },
        "locality": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "seller": {
      "type": "object",
      "required": [
        "kind",
        "pseudonym"
      ],
      "properties": {
        "kind": {
          "enum": [
            "dealer",
            "private",
            "agent"
          ]
        },
        "pseudonym": {
          "type": "string",
          "minLength": 4
        }
      },
      "additionalProperties": false
    },
    "observedAt": {
      "$ref": "common.schema.json#/$defs/timestamp"
    },
    "inReplyTo": {
      "$ref": "common.schema.json#/$defs/id"
    },
    "extensions": {
      "$ref": "common.schema.json#/$defs/extensions"
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "category": {
            "const": "vehicle"
          }
        }
      },
      "then": {
        "properties": {
          "item": {
            "$ref": "criteria-vehicle.schema.json"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "category": {
            "const": "property"
          }
        }
      },
      "then": {
        "properties": {
          "item": {
            "$ref": "criteria-property.schema.json"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "source": {
            "properties": {
              "kind": {
                "const": "reply"
              }
            }
          }
        }
      },
      "then": {
        "required": [
          "inReplyTo"
        ]
      }
    }
  ],
  "additionalProperties": false
}