{
  "$schema": "http://json-schema.org/draft-07/schema",
  "$id": "ApiV1alpha1",
  "description": "An API describes an interface that can be exposed by a component. The API can be defined in different formats, like OpenAPI, AsyncAPI, GraphQL, gRPC, or other formats.",
  "examples": [
    {
      "apiVersion": "backstage.io/v1alpha1",
      "kind": "API",
      "metadata": {
        "name": "artist-api",
        "description": "Retrieve artist details",
        "labels": {
          "product_name": "Random value Generator"
        },
        "annotations": {
          "docs": "https://github.com/..../tree/develop/doc"
        }
      },
      "spec": {
        "type": "openapi",
        "lifecycle": "production",
        "owner": "artist-relations-team",
        "system": "artist-engagement-portal",
        "definition": "openapi: \"3.0.0\"\ninfo:..."
      }
    }
  ],
  "allOf": [
    {
      "$ref": "Entity"
    },
    {
      "type": "object",
      "required": ["spec"],
      "properties": {
        "apiVersion": {
          "enum": ["backstage.io/v1alpha1", "backstage.io/v1beta1"]
        },
        "kind": {
          "enum": ["API"]
        },
        "spec": {
          "type": "object",
          "required": ["type", "lifecycle", "owner", "definition"],
          "properties": {
            "type": {
              "type": "string",
              "description": "The type of the API definition.",
              "examples": ["openapi", "asyncapi", "graphql", "grpc"],
              "minLength": 1
            },
            "lifecycle": {
              "type": "string",
              "description": "The lifecycle state of the API.",
              "examples": ["experimental", "production", "deprecated"],
              "minLength": 1
            },
            "owner": {
              "type": "string",
              "description": "An entity reference to the owner of the API.",
              "examples": ["artist-relations-team", "user:john.johnson"],
              "minLength": 1
            },
            "system": {
              "type": "string",
              "description": "An entity reference to the system that the API belongs to.",
              "minLength": 1
            },
            "definition": {
              "type": "string",
              "description": "The definition of the API, based on the format defined by the type.",
              "minLength": 1
            }
          }
        }
      }
    }
  ]
}
