{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aidemos-com/json-schema/aidemos-com-resource-in-schema.json",
  "title": "ResourceIn",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aidemos-com-openapi.json#/components/schemas/ResourceIn",
  "properties": {
    "name": {
      "type": "string",
      "title": "Name"
    },
    "public_name": {
      "type": "string",
      "title": "Public Name",
      "description": "what result and definition pages print for this resource (0145, #889); `name` is the registry's own name and is never shown to a reader"
    },
    "type_slug": {
      "type": "string",
      "title": "Type Slug",
      "description": "a research.resource_type slug; 'other' always exists"
    },
    "details": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Details",
      "description": "markdown, free-form, human-read only"
    },
    "disclosure": {
      "type": "string",
      "title": "Disclosure",
      "default": "public"
    },
    "status": {
      "type": "string",
      "title": "Status",
      "default": "draft"
    },
    "subject_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Subject Id",
      "description": "set when this resource IS a registered subject — a vector DB is a fixture in one benchmark and the subject in another"
    },
    "volatility": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Volatility",
      "description": "one of ('pinned_snapshot', 'live_external', 'vendor_managed'); NULL means the gate abstains"
    },
    "instantiation": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Instantiation",
      "description": "one of ('shared_persistent', 'per_run_instance', 'reset_between_runs'); NULL means the gate abstains"
    },
    "slug": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Slug"
    },
    "change_note": {
      "type": "string",
      "title": "Change Note",
      "default": "initial version"
    },
    "version_details": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Version Details"
    },
    "created_by": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Created By"
    },
    "links": {
      "items": {
        "$ref": "#/$defs/app__api__research_resources__LinkIn"
      },
      "type": "array",
      "title": "Links",
      "description": "Addresses: [{label, url}]"
    },
    "access": {
      "items": {
        "$ref": "#/$defs/AccessIn"
      },
      "type": "array",
      "title": "Access",
      "description": "grants; see AccessIn"
    },
    "facts": {
      "items": {
        "$ref": "#/$defs/FactIn"
      },
      "type": "array",
      "title": "Facts",
      "description": "[{key, value}] -> resource_version.metadata.facts. Rendered as a table; read by nothing as authority (the 0059 contract for metadata is unchanged)."
    },
    "version_metadata": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Version Metadata"
    }
  },
  "type": "object",
  "required": [
    "name",
    "public_name",
    "type_slug"
  ],
  "$defs": {
    "AccessIn": {
      "properties": {
        "grant_label": {
          "type": "string",
          "title": "Grant Label",
          "description": "read_only | writer | restricted — the grant IS what some test cases are about (the Database Agent case)"
        },
        "secret_ref": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Secret Ref",
          "description": "the NAME of a Secrets Manager secret. A value is refused by a CHECK constraint: no column here may hold a credential."
        },
        "subject_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Subject Id",
          "description": "NULL = applies to every subject"
        },
        "note": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Note"
        },
        "derive_secret_name": {
          "type": "boolean",
          "title": "Derive Secret Name",
          "description": "#551: when no secret_ref is given, mint research/<resource-slug>/<grant> so the author never has to invent a Secrets Manager name. The value is then set through PUT /secrets/{name}/value and shows as pending until it is.",
          "default": false
        }
      },
      "type": "object",
      "required": [
        "grant_label"
      ],
      "title": "AccessIn"
    },
    "FactIn": {
      "properties": {
        "key": {
          "type": "string",
          "title": "Key"
        },
        "value": {
          "type": "string",
          "title": "Value",
          "default": ""
        }
      },
      "type": "object",
      "required": [
        "key"
      ],
      "title": "FactIn"
    },
    "app__api__research_resources__LinkIn": {
      "properties": {
        "label": {
          "type": "string",
          "title": "Label"
        },
        "url": {
          "type": "string",
          "title": "Url"
        },
        "ord": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Ord"
        },
        "created_by": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Created By"
        }
      },
      "type": "object",
      "required": [
        "label",
        "url"
      ],
      "title": "LinkIn"
    }
  }
}