{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--layers.json",
  "description": "Collection of schemas for Layers Configurations",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/lalcebo/json-schema/master/serverless/components/layers.json",
    "sourceSha256": "2a46bd21c0ede98e4f8abfd04b07ca4fe188e8179ca83d4e704822be2c04744e"
  },
  "type": "object",
  "id": "https://raw.githubusercontent.com/lalcebo/json-schema/master/serverless/components/layer.json",
  "schema": "https://json-schema.org/draft-07/schema#",
  "AwsLayers": {
    "additionalProperties": {
      "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--layers.json#/AwsLayer"
    },
    "description": "Configuration to deploy layers using serverless framework, <https://www.serverless.com/framework/docs/providers/aws/guide/layers>",
    "maxProperties": 5,
    "type": "object"
  },
  "additionalProperties": false,
  "required": [
    "LayerAwsCompatibleRuntime",
    "AwsLayers",
    "AwsLayer"
  ],
  "LayerAwsCompatibleRuntime": {
    "type": "string",
    "enum": [
      "nodejs24.x",
      "nodejs22.x",
      "nodejs20.x",
      "nodejs18.x",
      "nodejs16.x",
      "nodejs14.x",
      "nodejs12.x",
      "python3.12",
      "python3.11",
      "python3.10",
      "python3.9",
      "python3.8",
      "python3.7",
      "python3.6",
      "ruby3.4",
      "ruby3.3",
      "ruby3.2",
      "ruby2.7",
      "java21",
      "java17",
      "java11",
      "java8.al2",
      "java8",
      "go1.x",
      "dotnet6",
      "dotnetcore3.1",
      "dotnet5.0"
    ],
    "description": "<https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html>"
  },
  "AwsLayerPackage": {
    "title": "AwsLayerPackage",
    "anyOf": [
      {
        "type": "object",
        "title": "AwsLayerPackageArtifact",
        "properties": {
          "artifact": {
            "description": "<https://www.serverless.com/framework/docs/providers/aws/guide/packaging#artifact>",
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "AwsLayerPackagePattern",
        "properties": {
          "patterns": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": false
      },
      {
        "type": "object",
        "title": "AwsLayerPackageExcludeInclude",
        "description": "@deprecated Please move to patterns as quickly as possible",
        "properties": {
          "exclude": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "include": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "additionalProperties": false
      }
    ]
  },
  "AwsLayer": {
    "type": "object",
    "properties": {
      "allowedAccounts": {
        "description": "**Uncommenting this will give all AWS users access to this layer unconditionally.**",
        "type": "array",
        "items": {
          "type": "string",
          "pattern": "^(\\d{12}|\\*|arn:(aws[a-zA-Z-]*):iam::\\d{12}:root)$"
        }
      },
      "compatibleArchitectures": {
        "type": "array",
        "items": {
          "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--common.json#/AwsSupportedArchitecture"
        },
        "maxItems": 2
      },
      "compatibleRuntimes": {
        "type": "array",
        "items": {
          "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--layers.json#/LayerAwsCompatibleRuntime"
        },
        "maxItems": 15
      },
      "description": {
        "type": "string"
      },
      "licenseInfo": {
        "type": "string"
      },
      "name": {
        "description": "Deployed Lambda layer name",
        "type": "string"
      },
      "package": {
        "$ref": "#/AwsLayerPackage"
      },
      "path": {
        "type": "string"
      },
      "retain": {
        "description": "If true, layer versions are not deleted as new ones are created",
        "type": "boolean",
        "default": false
      }
    },
    "oneOf": [
      {
        "required": [
          "path"
        ]
      },
      {
        "required": [
          "package"
        ]
      }
    ],
    "additionalProperties": false
  }
}
