{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/greenlitbooks-com/json-schema/greenlitbooks-com-book-detail-schema.json",
  "title": "BookDetail",
  "description": "The /books/{slug} response body.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/greenlitbooks-com-openapi.json#/components/schemas/BookDetail",
  "type": "object",
  "properties": {
    "meta": {
      "$ref": "#/$defs/Meta"
    },
    "book": {
      "$ref": "#/$defs/Book"
    },
    "chapters": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "number": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          }
        }
      }
    },
    "totalWords": {
      "type": [
        "integer",
        "null"
      ]
    },
    "claims": {
      "type": [
        "object",
        "null"
      ],
      "description": "Quotable claims from the book with the sources behind them, or null for a book with no ledger yet. Each item's `url` is an anchor on the book page that resolves to that exact claim: quote `claim`, cite `url`.",
      "properties": {
        "lastReviewed": {
          "type": "string",
          "format": "date"
        },
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "chapter": {
                "type": "integer"
              },
              "claim": {
                "type": "string"
              },
              "verbatim": {
                "type": "boolean",
                "description": "True when `claim` is the book's own sentence, word for word."
              },
              "basis": {
                "type": "string",
                "enum": [
                  "external",
                  "argument",
                  "method",
                  "author-experience"
                ],
                "description": "What kind of statement this is. A published result, a position the book argues, a method you run yourself, or something the author reports happening on his own system. They are not interchangeable and should not be quoted as if they were."
              },
              "basisLabel": {
                "type": "string"
              },
              "howToQuote": {
                "type": "string"
              },
              "basisNote": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "anchor": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "sources": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": "string"
                    },
                    "authors": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "publisher": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "date": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "establishes": {
                      "type": "string"
                    },
                    "doesNotEstablish": {
                      "type": "string",
                      "description": "What the claim would be overreaching to draw from this source. Read it before leaning on the citation."
                    },
                    "lastChecked": {
                      "type": "string",
                      "format": "date"
                    },
                    "checkNote": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "excerpt": {
      "type": "object",
      "description": "The free chapter-one excerpt, when published.",
      "properties": {
        "available": {
          "type": "boolean"
        },
        "chapterTitle": {
          "type": [
            "string",
            "null"
          ]
        },
        "words": {
          "type": [
            "integer",
            "null"
          ]
        },
        "minutes": {
          "type": [
            "integer",
            "null"
          ]
        },
        "url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "markdownUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        }
      }
    },
    "related": {
      "type": "object",
      "properties": {
        "guide": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "title": {
              "type": "string"
            },
            "slug": {
              "type": "string"
            },
            "url": {
              "type": "string",
              "format": "uri"
            }
          }
        },
        "fieldNotes": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        },
        "compares": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        },
        "seriesNeighbors": {
          "type": "object",
          "properties": {
            "previous": {
              "oneOf": [
                {
                  "$ref": "#/$defs/BookLink"
                },
                {
                  "type": "null"
                }
              ]
            },
            "next": {
              "oneOf": [
                {
                  "$ref": "#/$defs/BookLink"
                },
                {
                  "type": "null"
                }
              ]
            }
          }
        }
      }
    }
  },
  "$defs": {
    "Book": {
      "type": "object",
      "description": "One book. No publication date, page count, or ISBN: the catalog carries no verified source for them and nothing is invented. Amazon URLs are clean /dp/ links; every listed book is buyable there and free to read with Kindle Unlimited when kindleUnlimited is true.",
      "properties": {
        "slug": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "subtitle": {
          "type": [
            "string",
            "null"
          ]
        },
        "author": {
          "type": [
            "string",
            "null"
          ]
        },
        "series": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "name": {
              "type": "string"
            },
            "slug": {
              "type": "string"
            },
            "position": {
              "type": "integer",
              "description": "1-based reading order within the series."
            }
          }
        },
        "imprint": {
          "type": [
            "string",
            "null"
          ]
        },
        "readerLevel": {
          "type": "string",
          "enum": [
            "beginner",
            "operator",
            "engineer",
            "leader"
          ]
        },
        "flagship": {
          "type": "boolean"
        },
        "descriptions": {
          "type": "object",
          "properties": {
            "hook": {
              "type": [
                "string",
                "null"
              ],
              "description": "A quotable opening line."
            },
            "oneLiner": {
              "type": [
                "string",
                "null"
              ],
              "description": "Short description."
            },
            "targetReader": {
              "type": [
                "string",
                "null"
              ],
              "description": "Who the book is for."
            },
            "namedConcept": {
              "type": [
                "string",
                "null"
              ],
              "description": "The named idea the book teaches."
            }
          }
        },
        "concept": {
          "type": [
            "object",
            "null"
          ],
          "description": "The question-shaped concept page for this book.",
          "properties": {
            "name": {
              "type": "string"
            },
            "slug": {
              "type": "string"
            },
            "question": {
              "type": "string"
            },
            "url": {
              "type": "string",
              "format": "uri"
            }
          }
        },
        "amazon": {
          "type": "object",
          "properties": {
            "kindleAsin": {
              "type": [
                "string",
                "null"
              ]
            },
            "paperbackAsin": {
              "type": [
                "string",
                "null"
              ]
            },
            "kindleUrl": {
              "type": [
                "string",
                "null"
              ],
              "format": "uri"
            },
            "paperbackUrl": {
              "type": [
                "string",
                "null"
              ],
              "format": "uri"
            }
          }
        },
        "prices": {
          "type": "object",
          "properties": {
            "ebook": {
              "$ref": "#/$defs/Price"
            },
            "paperback": {
              "$ref": "#/$defs/Price"
            }
          }
        },
        "kindleUnlimited": {
          "type": "boolean"
        },
        "coverImage": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "Canonical book page."
        },
        "apiUrl": {
          "type": "string",
          "format": "uri"
        },
        "markdownUrl": {
          "type": "string",
          "format": "uri",
          "description": "Plain-markdown twin of the book page."
        },
        "readUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Free chapter one, when available."
        },
        "categories": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "companionRepo": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Public companion code repository, when the book ships code."
        }
      }
    },
    "BookLink": {
      "type": "object",
      "description": "Compact pointer to a book, with its reading-order position in its series.",
      "properties": {
        "slug": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "position": {
          "type": "integer",
          "description": "1-based reading order within the series."
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "apiUrl": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "Meta": {
      "type": "object",
      "description": "Envelope on every response.",
      "properties": {
        "version": {
          "type": "string",
          "const": "v1"
        },
        "generatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When this snapshot was produced. Static endpoints stamp it at deploy; search stamps it per request."
        },
        "source": {
          "type": "string",
          "format": "uri"
        },
        "docs": {
          "type": "string",
          "format": "uri"
        },
        "openapi": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "Price": {
      "type": [
        "object",
        "null"
      ],
      "description": "Price for one format. amount is parsed from the display string.",
      "properties": {
        "display": {
          "type": "string"
        },
        "amount": {
          "type": [
            "number",
            "null"
          ]
        },
        "currency": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}