{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://raw.githubusercontent.com/api-evangelist/isbndb/main/json-schema/book.json",
  "title": "Book",
  "description": "A book record returned by the ISBNdb API, containing bibliographic metadata for a single publication.",
  "type": "object",
  "required": [
    "title",
    "isbn13",
    "date_published"
  ],
  "properties": {
    "title": {
      "type": "string",
      "description": "Primary title of the book"
    },
    "title_long": {
      "type": "string",
      "description": "Long title of the book (deprecated)",
      "deprecated": true
    },
    "isbn": {
      "type": "string",
      "description": "ISBN-13 identifier (deprecated, use isbn13)",
      "deprecated": true
    },
    "isbn13": {
      "type": "string",
      "description": "ISBN-13 identifier",
      "pattern": "^\\d{13}$"
    },
    "isbn10": {
      "type": [
        "string",
        "null"
      ],
      "description": "ISBN-10 identifier, if available",
      "pattern": "^[0-9Xx]{10}$"
    },
    "binding": {
      "type": [
        "string",
        "null"
      ],
      "description": "Book binding type (e.g. Hardcover, Paperback, eBook)"
    },
    "publisher": {
      "type": [
        "string",
        "null"
      ],
      "description": "Name of the publisher"
    },
    "language": {
      "type": [
        "string",
        "null"
      ],
      "description": "Language of the book (ISO 639-1 code or full name)"
    },
    "date_published": {
      "type": "string",
      "description": "Publication date in YYYY-MM-DD, YYYY-MM, or YYYY format",
      "example": "2023-10-26"
    },
    "edition": {
      "type": [
        "string",
        "null"
      ],
      "description": "Edition of the book (e.g. 3rd, Revised)"
    },
    "pages": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Number of pages in the book",
      "minimum": 1
    },
    "dimensions": {
      "type": [
        "string",
        "null"
      ],
      "description": "Physical dimensions as a formatted string (deprecated)",
      "deprecated": true
    },
    "dimensions_structured": {
      "description": "Structured physical dimensions (height, width, weight, etc.)",
      "nullable": true,
      "oneOf": [
        {
          "type": "array"
        },
        {
          "type": "object"
        }
      ]
    },
    "overview": {
      "type": [
        "string",
        "null"
      ],
      "description": "Brief overview or description of the book (deprecated)",
      "deprecated": true
    },
    "image": {
      "type": [
        "string",
        "null"
      ],
      "description": "Cover image URL. Maximum height is 500px.",
      "format": "uri"
    },
    "image_original": {
      "type": [
        "string",
        "null"
      ],
      "description": "Original cover image URL. Temporary \u2014 expires 2 hours after API response.",
      "format": "uri"
    },
    "msrp": {
      "type": [
        "number",
        "null"
      ],
      "description": "Manufacturer's suggested retail price",
      "minimum": 0
    },
    "excerpt": {
      "type": [
        "string",
        "null"
      ],
      "description": "Short excerpt from the book"
    },
    "synopsis": {
      "type": [
        "string",
        "null"
      ],
      "description": "Full synopsis or summary of the book"
    },
    "authors": {
      "type": [
        "array",
        "null"
      ],
      "description": "List of authors of the book",
      "items": {
        "type": "string"
      }
    },
    "subjects": {
      "type": [
        "array",
        "null"
      ],
      "description": "List of subjects or categories the book belongs to",
      "items": {
        "type": "string"
      }
    },
    "reviews": {
      "type": [
        "array",
        "null"
      ],
      "description": "User or editorial reviews of the book (deprecated)",
      "items": {
        "type": "string"
      },
      "deprecated": true
    },
    "prices": {
      "type": [
        "array",
        "null"
      ],
      "description": "Available prices from various merchants",
      "items": {
        "$ref": "#/definitions/Price"
      }
    },
    "related": {
      "description": "Related books (deprecated)",
      "nullable": true,
      "deprecated": true
    },
    "other_isbns": {
      "type": [
        "array",
        "null"
      ],
      "description": "Other ISBNs associated with this book (different formats or editions)",
      "items": {
        "$ref": "#/definitions/RelatedIsbn"
      }
    }
  },
  "definitions": {
    "Point": {
      "type": "object",
      "required": [
        "x",
        "y"
      ],
      "properties": {
        "x": {
          "type": "string"
        },
        "y": {
          "type": "string"
        }
      }
    },
    "Price": {
      "type": "object",
      "required": [
        "condition",
        "merchant",
        "merchant_logo",
        "merchant_logo_offset",
        "shipping",
        "price",
        "total",
        "link"
      ],
      "properties": {
        "condition": {
          "type": "string",
          "description": "Condition of the book (e.g. new, used, digital)"
        },
        "merchant": {
          "type": "string",
          "description": "Name of the merchant offering this price"
        },
        "merchant_logo": {
          "type": "string",
          "description": "URL of the merchant logo image",
          "format": "uri"
        },
        "merchant_logo_offset": {
          "$ref": "#/definitions/Point"
        },
        "shipping": {
          "type": "string",
          "description": "Shipping cost for this offer"
        },
        "price": {
          "type": "string",
          "description": "Item price excluding shipping"
        },
        "total": {
          "type": "string",
          "description": "Total price including shipping"
        },
        "link": {
          "type": "string",
          "description": "URL to purchase the book from this merchant",
          "format": "uri"
        }
      }
    },
    "RelatedIsbn": {
      "type": "object",
      "required": [
        "isbn",
        "binding"
      ],
      "properties": {
        "isbn": {
          "type": "string",
          "description": "ISBN-13 of the related edition"
        },
        "binding": {
          "type": "string",
          "description": "Binding type of the related edition (e.g. Hardcover, Paperback)"
        }
      }
    }
  }
}
