{
  "$schema": "http://json-schema.org/draft-07/schema",
  "$id": "ResourceV1alpha1",
  "description": "A resource describes the infrastructure a system needs to operate, like BigTable databases, Pub/Sub topics, S3 buckets or CDNs. Modelling them together with components and systems allows to visualize resource footprint, and create tooling around them.",
  "examples": [
    {
      "apiVersion": "backstage.io/v1alpha1",
      "kind": "Resource",
      "metadata": {
        "name": "artists-db",
        "description": "Stores artist details"
      },
      "spec": {
        "type": "database",
        "owner": "artist-relations-team",
        "system": "artist-engagement-portal"
      }
    }
  ],
  "allOf": [
    {
      "$ref": "Entity"
    },
    {
      "type": "object",
      "required": ["spec"],
      "properties": {
        "apiVersion": {
          "enum": ["backstage.io/v1alpha1", "backstage.io/v1beta1"]
        },
        "kind": {
          "enum": ["Resource"]
        },
        "spec": {
          "type": "object",
          "required": ["type", "owner"],
          "properties": {
            "type": {
              "type": "string",
              "description": "The type of resource.",
              "examples": ["database", "s3-bucket", "cluster"],
              "minLength": 1
            },
            "owner": {
              "type": "string",
              "description": "An entity reference to the owner of the resource.",
              "examples": ["artist-relations-team", "user:john.johnson"],
              "minLength": 1
            },
            "dependsOn": {
              "type": "array",
              "description": "An array of references to other entities that the resource depends on to function.",
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "system": {
              "type": "string",
              "description": "An entity reference to the system that the resource belongs to.",
              "minLength": 1
            }
          }
        }
      }
    }
  ]
}
