{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/reacher-z/Awesome-CUA/blob/main/schemas/resource.schema.json",
  "title": "Awesome CUA resource",
  "description": "One resource, not one project. Bibliographic verification and editorial curation are different states. This schema checks each record on its own, including the rules for curated records and kind-specific details. catalog.py validate and build also enforce rules that need other fields, other records or data/topics.json: canonical URL identities, the topic vocabulary, relation targets and their evidence receipts, profile and publication evidence receipts, arXiv version links, known duplicates, and dates relative to verification.",
  "type": "object",
  "required": [
    "id",
    "name",
    "kind",
    "url",
    "aliases",
    "environments",
    "topics",
    "scope",
    "summary",
    "review_status",
    "published_at",
    "updated_at",
    "authors",
    "identifiers",
    "links",
    "relations",
    "licenses",
    "evidence",
    "last_verified_at",
    "notes",
    "details"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^(arxiv:|github:|url:|component:|organization:)[^\\s]+$"
    },
    "name": {
      "type": "string",
      "minLength": 1
    },
    "kind": {
      "enum": [
        "agent",
        "benchmark",
        "company",
        "dataset",
        "framework",
        "infrastructure",
        "learning",
        "model",
        "paper",
        "product",
        "survey",
        "tool"
      ]
    },
    "url": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://"
    },
    "aliases": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "uniqueItems": true
    },
    "environments": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "enum": [
          "android",
          "cross-platform",
          "desktop",
          "ios",
          "harmonyos",
          "linux",
          "macos",
          "unspecified",
          "web",
          "windows"
        ]
      }
    },
    "topics": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "uniqueItems": true
    },
    "scope": {
      "enum": [
        "core",
        "adjacent",
        "relevance_pending"
      ]
    },
    "summary": {
      "type": [
        "string",
        "null"
      ]
    },
    "review_status": {
      "enum": [
        "curated",
        "metadata_verified"
      ]
    },
    "published_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "updated_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "authors": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "identifiers": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "links": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "rel",
          "url"
        ],
        "properties": {
          "rel": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://"
          }
        },
        "additionalProperties": false
      }
    },
    "relations": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "object",
        "required": [
          "type",
          "target_id",
          "evidence_url"
        ],
        "properties": {
          "type": {
            "enum": [
              "introduced_by",
              "published_by",
              "component_of",
              "uses",
              "evaluates",
              "trained_on",
              "variant_of",
              "documented_by"
            ]
          },
          "target_id": {
            "type": "string"
          },
          "evidence_url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://"
          }
        },
        "additionalProperties": false
      }
    },
    "licenses": {
      "type": "object",
      "required": [
        "code",
        "data",
        "weights",
        "document"
      ],
      "properties": {
        "code": {
          "type": [
            "object",
            "null"
          ],
          "required": [
            "declared",
            "url",
            "retrieved_at",
            "basis"
          ],
          "properties": {
            "declared": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "minItems": 1,
                  "items": {
                    "type": "string"
                  }
                }
              ]
            },
            "url": {
              "type": "string",
              "format": "uri",
              "pattern": "^https://"
            },
            "retrieved_at": {
              "type": "string",
              "format": "date-time"
            },
            "basis": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "data": {
          "type": [
            "object",
            "null"
          ],
          "required": [
            "declared",
            "url",
            "retrieved_at",
            "basis"
          ],
          "properties": {
            "declared": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "minItems": 1,
                  "items": {
                    "type": "string"
                  }
                }
              ]
            },
            "url": {
              "type": "string",
              "format": "uri",
              "pattern": "^https://"
            },
            "retrieved_at": {
              "type": "string",
              "format": "date-time"
            },
            "basis": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "weights": {
          "type": [
            "object",
            "null"
          ],
          "required": [
            "declared",
            "url",
            "retrieved_at",
            "basis"
          ],
          "properties": {
            "declared": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "minItems": 1,
                  "items": {
                    "type": "string"
                  }
                }
              ]
            },
            "url": {
              "type": "string",
              "format": "uri",
              "pattern": "^https://"
            },
            "retrieved_at": {
              "type": "string",
              "format": "date-time"
            },
            "basis": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "document": {
          "type": [
            "object",
            "null"
          ],
          "required": [
            "declared",
            "url",
            "retrieved_at",
            "basis"
          ],
          "properties": {
            "declared": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "minItems": 1,
                  "items": {
                    "type": "string"
                  }
                }
              ]
            },
            "url": {
              "type": "string",
              "format": "uri",
              "pattern": "^https://"
            },
            "retrieved_at": {
              "type": "string",
              "format": "date-time"
            },
            "basis": {
              "type": "string"
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "evidence": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "role",
          "method",
          "supports",
          "url",
          "retrieved_at",
          "sha256"
        ],
        "properties": {
          "role": {
            "const": "primary"
          },
          "method": {
            "enum": [
              "arxiv_api",
              "editorial_primary_review",
              "github_repository_identity",
              "huggingface_repository_identity",
              "huggingface_api",
              "huggingface_card",
              "dataverse_api",
              "license_header"
            ]
          },
          "supports": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "uniqueItems": true,
            "minItems": 1
          },
          "url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://"
          },
          "retrieved_at": {
            "type": "string",
            "format": "date-time"
          },
          "sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        },
        "additionalProperties": false
      }
    },
    "last_verified_at": {
      "type": "string",
      "format": "date-time"
    },
    "notes": {
      "type": "string"
    },
    "details": {
      "type": "object",
      "properties": {
        "benchmark_protocol": {
          "$ref": "#/$defs/benchmarkProtocol"
        },
        "leaderboard_url": {
          "type": "string",
          "pattern": "^https://"
        },
        "dataset_profile": {
          "$ref": "#/$defs/datasetProfile"
        },
        "arxiv_snapshot": {
          "$ref": "#/$defs/arxivSnapshot"
        },
        "publication": {
          "$ref": "#/$defs/publication"
        }
      }
    }
  },
  "additionalProperties": false,
  "allOf": [
    {
      "description": "A curated record carries an editorial summary and a decided scope.",
      "if": {
        "properties": {
          "review_status": {
            "const": "curated"
          }
        },
        "required": [
          "review_status"
        ]
      },
      "then": {
        "properties": {
          "summary": {
            "type": "string",
            "minLength": 1
          },
          "scope": {
            "enum": [
              "core",
              "adjacent"
            ]
          }
        }
      }
    },
    {
      "description": "A benchmark protocol belongs to a curated benchmark.",
      "if": {
        "properties": {
          "details": {
            "type": "object",
            "required": [
              "benchmark_protocol"
            ]
          }
        },
        "required": [
          "details"
        ]
      },
      "then": {
        "properties": {
          "kind": {
            "const": "benchmark"
          },
          "review_status": {
            "const": "curated"
          }
        }
      }
    },
    {
      "description": "A leaderboard URL belongs to a curated benchmark.",
      "if": {
        "properties": {
          "details": {
            "type": "object",
            "required": [
              "leaderboard_url"
            ]
          }
        },
        "required": [
          "details"
        ]
      },
      "then": {
        "properties": {
          "kind": {
            "const": "benchmark"
          },
          "review_status": {
            "const": "curated"
          }
        }
      }
    },
    {
      "description": "A dataset profile belongs to a curated dataset.",
      "if": {
        "properties": {
          "details": {
            "type": "object",
            "required": [
              "dataset_profile"
            ]
          }
        },
        "required": [
          "details"
        ]
      },
      "then": {
        "properties": {
          "kind": {
            "const": "dataset"
          },
          "review_status": {
            "const": "curated"
          }
        }
      }
    },
    {
      "description": "An arXiv snapshot belongs to an arXiv paper or survey and is backed by an arXiv API receipt that supports it.",
      "if": {
        "properties": {
          "details": {
            "type": "object",
            "required": [
              "arxiv_snapshot"
            ]
          }
        },
        "required": [
          "details"
        ]
      },
      "then": {
        "properties": {
          "id": {
            "pattern": "^arxiv:"
          },
          "kind": {
            "enum": [
              "paper",
              "survey"
            ]
          },
          "evidence": {
            "contains": {
              "required": [
                "method",
                "supports"
              ],
              "properties": {
                "method": {
                  "const": "arxiv_api"
                },
                "supports": {
                  "contains": {
                    "const": "details.arxiv_snapshot"
                  }
                }
              }
            }
          }
        }
      }
    },
    {
      "description": "Publisher metadata belongs to a paper or survey.",
      "if": {
        "properties": {
          "details": {
            "type": "object",
            "required": [
              "publication"
            ]
          }
        },
        "required": [
          "details"
        ]
      },
      "then": {
        "properties": {
          "kind": {
            "enum": [
              "paper",
              "survey"
            ]
          }
        }
      }
    }
  ],
  "$defs": {
    "countObservation": {
      "type": "object",
      "required": [
        "value",
        "unit",
        "qualifier",
        "population",
        "basis",
        "evidence_url"
      ],
      "properties": {
        "value": {
          "type": "number",
          "minimum": 0
        },
        "unit": {
          "type": "string",
          "minLength": 1
        },
        "qualifier": {
          "enum": [
            "exact",
            "approximately",
            "at-least",
            "more-than"
          ]
        },
        "population": {
          "type": "string",
          "minLength": 1
        },
        "basis": {
          "enum": [
            "reported",
            "computed"
          ]
        },
        "evidence_url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "reference_url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        }
      },
      "additionalProperties": false
    },
    "benchmarkProtocol": {
      "type": "object",
      "required": [
        "counts",
        "notes",
        "evidence_urls",
        "focus",
        "setting",
        "observations",
        "actions",
        "evaluation"
      ],
      "properties": {
        "counts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/countObservation"
          }
        },
        "notes": {
          "type": "string"
        },
        "evidence_urls": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://"
          }
        },
        "focus": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 1
        },
        "setting": {
          "enum": [
            "interactive",
            "offline",
            "mixed"
          ]
        },
        "observations": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "actions": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "evaluation": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "datasetProfile": {
      "type": "object",
      "required": [
        "counts",
        "notes",
        "evidence_urls",
        "supervision",
        "modalities",
        "formats",
        "splits"
      ],
      "properties": {
        "counts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/countObservation"
          }
        },
        "notes": {
          "type": "string"
        },
        "evidence_urls": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://"
          }
        },
        "supervision": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 1
        },
        "modalities": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "formats": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "splits": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "additionalProperties": false
    },
    "arxivSnapshot": {
      "type": "object",
      "required": [
        "version",
        "versioned_url",
        "submitted_at",
        "updated_at",
        "abstract_sha256",
        "abstract_hash_method"
      ],
      "properties": {
        "version": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1
        },
        "versioned_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "pattern": "^https://arxiv\\.org/abs/\\d{4}\\.\\d{4,5}v[1-9][0-9]*$"
        },
        "submitted_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "updated_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "abstract_sha256": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^[0-9a-f]{64}$"
        },
        "abstract_hash_method": {
          "const": "sha256-utf8-whitespace-collapsed-v1"
        }
      },
      "additionalProperties": false
    },
    "publication": {
      "type": "object",
      "required": [
        "type",
        "title",
        "authors",
        "date_parts",
        "url",
        "evidence_urls"
      ],
      "properties": {
        "type": {
          "enum": [
            "conference-paper",
            "journal-article",
            "report",
            "other"
          ]
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "authors": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "date_parts": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "type": "array",
              "minItems": 1,
              "maxItems": 3,
              "prefixItems": [
                {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9999
                },
                {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 12
                },
                {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 31
                }
              ],
              "items": false
            }
          ]
        },
        "url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "pdf_url": {
          "oneOf": [
            {
              "type": "string",
              "format": "uri",
              "pattern": "^https://"
            },
            {
              "type": "null"
            }
          ]
        },
        "evidence_urls": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://"
          }
        },
        "doi": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^10\\.\\d{4,9}/\\S+$"
        },
        "venue": {
          "type": [
            "string",
            "null"
          ]
        },
        "publisher": {
          "type": [
            "string",
            "null"
          ]
        },
        "series": {
          "type": [
            "string",
            "null"
          ]
        },
        "volume": {
          "type": [
            "string",
            "null"
          ]
        },
        "issue": {
          "type": [
            "string",
            "null"
          ]
        },
        "pages": {
          "type": [
            "string",
            "null"
          ]
        },
        "date_basis": {
          "type": [
            "string",
            "null"
          ]
        },
        "event_dates": {
          "type": [
            "string",
            "null"
          ]
        },
        "identity_basis": {
          "type": [
            "string",
            "null"
          ]
        },
        "notes": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "additionalProperties": false
    }
  }
}
