{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://imadoki-matome.pages.dev/api/v1/schema.json",
  "title": "いまどきまとめ Public Article API v1",
  "oneOf": [
    {
      "$ref": "#/$defs/catalog"
    },
    {
      "$ref": "#/$defs/article"
    }
  ],
  "$defs": {
    "summary": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
        },
        "canonicalUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "detailUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "title": {
          "type": "string"
        },
        "listTitle": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "language": {
          "const": "ja"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "canonicalUrl",
        "detailUrl",
        "title",
        "listTitle",
        "description",
        "language",
        "publishedAt",
        "updatedAt"
      ],
      "additionalProperties": false
    },
    "catalog": {
      "type": "object",
      "properties": {
        "schemaVersion": {
          "const": 1
        },
        "site": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string"
            },
            "url": {
              "type": "string",
              "format": "uri",
              "pattern": "^https://"
            },
            "language": {
              "const": "ja"
            }
          },
          "required": [
            "name",
            "url",
            "language"
          ],
          "additionalProperties": false
        },
        "total": {
          "type": "integer",
          "minimum": 0
        },
        "page": {
          "type": "integer",
          "minimum": 1
        },
        "pageSize": {
          "const": 100
        },
        "nextUrl": {
          "anyOf": [
            {
              "type": "string",
              "format": "uri",
              "pattern": "^https://"
            },
            {
              "type": "null"
            }
          ]
        },
        "articles": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/summary"
          },
          "maxItems": 100
        }
      },
      "required": [
        "schemaVersion",
        "site",
        "total",
        "page",
        "pageSize",
        "nextUrl",
        "articles"
      ],
      "additionalProperties": false
    },
    "article": {
      "type": "object",
      "properties": {
        "schemaVersion": {
          "const": 1
        },
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
        },
        "canonicalUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "detailUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "title": {
          "type": "string"
        },
        "listTitle": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "language": {
          "const": "ja"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        },
        "lead": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "bodyHtml": {
          "type": "string"
        },
        "bodyText": {
          "type": "string"
        },
        "keyPoints": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "unconfirmed": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "upcoming": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string"
              },
              "date": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "dateLabel": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "endDate": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "time": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "label",
              "date",
              "dateLabel",
              "endDate",
              "time"
            ],
            "additionalProperties": false
          }
        },
        "corrections": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "date": {
                "type": "string",
                "format": "date-time"
              },
              "before": {
                "type": "string"
              },
              "after": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            },
            "required": [
              "date",
              "before",
              "after",
              "reason"
            ],
            "additionalProperties": false
          }
        },
        "sources": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri",
                "pattern": "^https://"
              },
              "sourcePublishedAt": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sourceDateNote": {
                "type": "string"
              },
              "checkedAt": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "name",
              "title",
              "url",
              "sourcePublishedAt",
              "sourceDateNote",
              "checkedAt"
            ],
            "additionalProperties": false
          }
        },
        "media": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "type",
              "url",
              "caption"
            ],
            "properties": {
              "id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "type": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri",
                "pattern": "^https://"
              },
              "caption": {
                "type": "string"
              },
              "provider": {
                "enum": [
                  "x",
                  "youtube"
                ]
              },
              "sourceUrl": {
                "type": "string",
                "format": "uri",
                "pattern": "^https://"
              },
              "credit": {
                "type": "string"
              },
              "alt": {
                "type": "string"
              }
            }
          }
        }
      },
      "required": [
        "schemaVersion",
        "id",
        "canonicalUrl",
        "detailUrl",
        "title",
        "listTitle",
        "description",
        "language",
        "publishedAt",
        "updatedAt",
        "lead",
        "bodyHtml",
        "bodyText",
        "keyPoints",
        "unconfirmed",
        "upcoming",
        "corrections",
        "sources",
        "media"
      ],
      "additionalProperties": false
    }
  }
}
