{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sweetvaluelab-com/json-schema/sweetvaluelab-com-post-schema.json",
  "title": "Post",
  "description": "A post as its author sees it. List responses omit `bodyMd` and `precheck`.",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sweetvaluelab-com-openapi.json#/components/schemas/Post",
  "type": "object",
  "additionalProperties": true,
  "properties": {
    "id": {
      "type": "integer"
    },
    "lang": {
      "type": "string",
      "enum": [
        "en",
        "zh"
      ]
    },
    "slug": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "draft",
        "in_review",
        "approved",
        "published",
        "rejected",
        "deleted"
      ]
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "stocks": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "heroSrc": {
      "type": [
        "string",
        "null"
      ]
    },
    "heroAlt": {
      "type": [
        "string",
        "null"
      ]
    },
    "shareText": {
      "type": [
        "string",
        "null"
      ],
      "description": "The frontmatter `share` line: what the Share button pre-fills. Null means the title is used."
    },
    "bodyMd": {
      "type": "string"
    },
    "precheck": {
      "oneOf": [
        {
          "$ref": "#/$defs/PrecheckReport"
        },
        {
          "type": "null"
        }
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "publishedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "decidedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "decidedNote": {
      "type": [
        "string",
        "null"
      ],
      "description": "The editor's note on a rejection."
    },
    "revisesId": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Set on a revision: the live post it changes."
    }
  },
  "$defs": {
    "PrecheckIssue": {
      "type": "object",
      "required": [
        "severity",
        "message"
      ],
      "description": "One finding. `error` blocks saving or submission; `warn` is reported and does not.",
      "properties": {
        "severity": {
          "type": "string",
          "enum": [
            "error",
            "warn"
          ]
        },
        "message": {
          "type": "string"
        },
        "line": {
          "type": "integer",
          "description": "1-based line in the document that was sent, when the finding has one."
        },
        "key": {
          "type": "string",
          "description": "The frontmatter field at fault, when it is one."
        }
      }
    },
    "PrecheckReport": {
      "type": "object",
      "required": [
        "ok",
        "issues"
      ],
      "properties": {
        "ok": {
          "type": "boolean",
          "description": "True when no issue is an error."
        },
        "issues": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PrecheckIssue"
          }
        },
        "checkedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    }
  }
}