{
	"$schema": "http://json-schema.org/draft-04/schema#",
	"$ref": "#/definitions/Function",
	"definitions": {
		"BuildSpec": {
			"properties": {
				"git": {
					"$schema": "http://json-schema.org/draft-04/schema#",
					"$ref": "#/definitions/Git",
					"description": "Git stores information about an optionally associated git repository."
				},
				"builderImages": {
					"patternProperties": {
						".*": {
							"type": "string"
						}
					},
					"type": "object",
					"description": "BuilderImages define optional explicit builder images to use by\nbuilder implementations in leau of the in-code defaults.  They key\nis the builder's short name.  For example:\nbuilderImages:\n  pack: example.com/user/my-pack-node-builder\n  s2i: example.com/user/my-s2i-node-builder"
				},
				"buildpacks": {
					"items": {
						"type": "string"
					},
					"type": "array",
					"description": "Optional list of buildpacks to use when building the function"
				},
				"builder": {
					"enum": [
						"pack",
						"s2i"
					],
					"type": "string",
					"description": "Builder is the name of the subsystem that will complete the underlying\nbuild (pack, s2i, etc)"
				},
				"buildEnvs": {
					"items": {
						"$schema": "http://json-schema.org/draft-04/schema#",
						"$ref": "#/definitions/Env"
					},
					"type": "array",
					"description": "Build Env variables to be set"
				},
				"pvcSize": {
					"type": "string",
					"description": "PVCSize specifies the size of persistent volume claim used to store function\nwhen using deployment and remote build process (only relevant when Remote is true)."
				},
				"remoteStorageClass": {
					"type": "string",
					"description": "RemoteStorageClass specifies the storage class to use for the volume used\non-cluster during when built remotely."
				}
			},
			"additionalProperties": false,
			"type": "object",
			"description": "BuildSpec"
		},
		"DeploySpec": {
			"properties": {
				"namespace": {
					"type": "string",
					"description": "Namespace into which the function was deployed on supported platforms."
				},
				"image": {
					"type": "string",
					"description": "Image is the deployed image including sha256"
				},
				"annotations": {
					"patternProperties": {
						".*": {
							"type": "string"
						}
					},
					"type": "object",
					"description": "Map containing user-supplied annotations\nExample: { \"division\": \"finance\" }"
				},
				"options": {
					"$schema": "http://json-schema.org/draft-04/schema#",
					"$ref": "#/definitions/Options",
					"description": "Options to be set on deployed function (scaling, etc.)"
				},
				"labels": {
					"items": {
						"$schema": "http://json-schema.org/draft-04/schema#",
						"$ref": "#/definitions/Label"
					},
					"type": "array",
					"description": "Map of user-supplied labels"
				},
				"healthEndpoints": {
					"$schema": "http://json-schema.org/draft-04/schema#",
					"$ref": "#/definitions/HealthEndpoints",
					"description": "Health endpoints specified by the language pack"
				},
				"serviceAccountName": {
					"type": "string",
					"description": "ServiceAccountName is the name of the service account used for the\nfunction pod. The service account must exist in the namespace to\nsucceed.\nMore info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/"
				},
				"subscriptions": {
					"items": {
						"$schema": "http://json-schema.org/draft-04/schema#",
						"$ref": "#/definitions/KnativeSubscription"
					},
					"type": "array"
				}
			},
			"additionalProperties": false,
			"type": "object",
			"description": "DeploySpec"
		},
		"EmptyDir": {
			"properties": {
				"medium": {
					"type": "string",
					"description": "medium represents what type of storage medium should back this directory.\nThe default is \"\" which means to use the node's default medium.\nMust be an empty string (default) or Memory.\nMore info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir"
				},
				"sizeLimit": {
					"type": "string",
					"description": "sizeLimit is the total amount of local storage required for this EmptyDir volume.\nThe size limit is also applicable for memory medium.\nThe maximum usage on memory medium EmptyDir would be the minimum value between\nthe SizeLimit specified here and the sum of memory limits of all containers in a pod.\nThe default is nil which means that the limit is undefined.\nMore info: http://kubernetes.io/docs/user-guide/volumes#emptydir"
				}
			},
			"additionalProperties": false,
			"type": "object"
		},
		"Env": {
			"properties": {
				"name": {
					"pattern": "^[-._a-zA-Z][-._a-zA-Z0-9]*$",
					"type": "string"
				},
				"value": {
					"type": "string"
				}
			},
			"additionalProperties": false,
			"type": "object"
		},
		"Function": {
			"required": [
				"specVersion",
				"created"
			],
			"properties": {
				"specVersion": {
					"type": "string",
					"description": "SpecVersion at which this function is known to be compatible.\nMore specifically, it is the highest migration which has been applied.\nFor details see the .Migrated() and .Migrate() methods."
				},
				"name": {
					"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
					"type": "string",
					"description": "Name of the function."
				},
				"domain": {
					"type": "string",
					"description": "Domain of the function optionally specifies the domain to use as the\nroute of the function. By default the cluster's default will be used.\nNote that the value defined here must be one which the cluster is\nconfigured to recognize, or this will have no effect and the cluster\ndefault will be applied.  This value shuld therefore ideally be\nvalidated by the client."
				},
				"runtime": {
					"type": "string",
					"description": "Runtime is the language plus context.  nodejs|go|quarkus|rust etc."
				},
				"registry": {
					"type": "string",
					"description": "Registry at which to store interstitial containers, in the form\n[registry]/[user]."
				},
				"image": {
					"type": "string",
					"description": "Image is the full OCI image tag in form:\n  [registry]/[namespace]/[name]:[tag]\nexample:\n  quay.io/alice/my.function.name\nRegistry is optional and is defaulted to DefaultRegistry\nexample:\n  alice/my.function.name\nIf Image is provided, it overrides the default of concatenating\n\"Registry+Name:latest\" to derive the Image."
				},
				"namespace": {
					"type": "string",
					"description": "Namespace in which to deploy the Function"
				},
				"created": {
					"type": "string",
					"description": "Created time is the moment that creation was successfully completed\naccording to the client which is in charge of what constitutes being\nfully \"Created\" (aka initialized)",
					"format": "date-time"
				},
				"invoke": {
					"enum": [
						"http",
						"cloudevent"
					],
					"type": "string",
					"description": "Invoke defines hints for use when invoking this function.\nSee Client.Invoke for usage."
				},
				"build": {
					"$schema": "http://json-schema.org/draft-04/schema#",
					"$ref": "#/definitions/BuildSpec",
					"description": "Build defines the build properties for a function"
				},
				"run": {
					"$schema": "http://json-schema.org/draft-04/schema#",
					"$ref": "#/definitions/RunSpec",
					"description": "Run defines the runtime properties for a function"
				},
				"deploy": {
					"$schema": "http://json-schema.org/draft-04/schema#",
					"$ref": "#/definitions/DeploySpec",
					"description": "Deploy defines the deployment properties for a function"
				}
			},
			"additionalProperties": false,
			"type": "object",
			"description": "Function"
		},
		"Git": {
			"properties": {
				"url": {
					"type": "string"
				},
				"revision": {
					"type": "string"
				},
				"contextDir": {
					"type": "string"
				}
			},
			"additionalProperties": false,
			"type": "object"
		},
		"HealthEndpoints": {
			"properties": {
				"liveness": {
					"type": "string"
				},
				"readiness": {
					"type": "string"
				}
			},
			"additionalProperties": false,
			"type": "object",
			"description": "HealthEndpoints specify the liveness and readiness endpoints for a Runtime"
		},
		"KnativeSubscription": {
			"required": [
				"source"
			],
			"properties": {
				"source": {
					"type": "string"
				},
				"filters": {
					"patternProperties": {
						".*": {
							"type": "string"
						}
					},
					"type": "object"
				}
			},
			"additionalProperties": false,
			"type": "object",
			"description": "KnativeSubscription"
		},
		"Label": {
			"required": [
				"key"
			],
			"properties": {
				"key": {
					"pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\\/)?([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$",
					"type": "string",
					"description": "Key consist of optional prefix part (ended by '/') and name part\nPrefix part validation pattern: [a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\nName part validation pattern: ([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]"
				},
				"value": {
					"pattern": "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$",
					"type": "string"
				}
			},
			"additionalProperties": false,
			"type": "object"
		},
		"Options": {
			"properties": {
				"scale": {
					"$schema": "http://json-schema.org/draft-04/schema#",
					"$ref": "#/definitions/ScaleOptions"
				},
				"resources": {
					"$schema": "http://json-schema.org/draft-04/schema#",
					"$ref": "#/definitions/ResourcesOptions"
				}
			},
			"additionalProperties": false,
			"type": "object"
		},
		"PersistentVolumeClaim": {
			"properties": {
				"claimName": {
					"type": "string",
					"description": "claimName is the name of a PersistentVolumeClaim in the same namespace as the pod using this volume.\nMore info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims"
				},
				"readOnly": {
					"type": "boolean",
					"description": "readOnly Will force the ReadOnly setting in VolumeMounts.\nDefault false."
				}
			},
			"additionalProperties": false,
			"type": "object"
		},
		"ResourcesLimitsOptions": {
			"properties": {
				"cpu": {
					"pattern": "^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$",
					"type": "string"
				},
				"memory": {
					"pattern": "^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$",
					"type": "string"
				},
				"concurrency": {
					"type": "integer",
					"minimum": 0
				}
			},
			"additionalProperties": false,
			"type": "object"
		},
		"ResourcesOptions": {
			"properties": {
				"requests": {
					"$schema": "http://json-schema.org/draft-04/schema#",
					"$ref": "#/definitions/ResourcesRequestsOptions"
				},
				"limits": {
					"$schema": "http://json-schema.org/draft-04/schema#",
					"$ref": "#/definitions/ResourcesLimitsOptions"
				}
			},
			"additionalProperties": false,
			"type": "object"
		},
		"ResourcesRequestsOptions": {
			"properties": {
				"cpu": {
					"pattern": "^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$",
					"type": "string"
				},
				"memory": {
					"pattern": "^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$",
					"type": "string"
				}
			},
			"additionalProperties": false,
			"type": "object"
		},
		"RunSpec": {
			"properties": {
				"volumes": {
					"items": {
						"$schema": "http://json-schema.org/draft-04/schema#",
						"$ref": "#/definitions/Volume"
					},
					"type": "array",
					"description": "List of volumes to be mounted to the function"
				},
				"envs": {
					"items": {
						"$ref": "#/definitions/Env"
					},
					"type": "array",
					"description": "Env variables to be set"
				},
				"startTimeout": {
					"type": "integer",
					"description": "StartTimeout specifies that this function should have a custom timeout\nwhen starting. This setting is currently respected by the host runner,\nwith containerized docker runner and deployed Knative service integration\nin development."
				}
			},
			"additionalProperties": false,
			"type": "object",
			"description": "RunSpec"
		},
		"ScaleOptions": {
			"properties": {
				"min": {
					"type": "integer",
					"minimum": 0
				},
				"max": {
					"type": "integer",
					"minimum": 0
				},
				"metric": {
					"enum": [
						"concurrency",
						"rps"
					],
					"type": "string"
				},
				"target": {
					"type": "number",
					"minimum": 0
				},
				"utilization": {
					"maximum": 100,
					"minimum": 1,
					"type": "number"
				}
			},
			"additionalProperties": false,
			"type": "object"
		},
		"Volume": {
			"properties": {
				"secret": {
					"type": "string"
				},
				"configMap": {
					"type": "string"
				},
				"persistentVolumeClaim": {
					"$schema": "http://json-schema.org/draft-04/schema#",
					"$ref": "#/definitions/PersistentVolumeClaim"
				},
				"emptyDir": {
					"$schema": "http://json-schema.org/draft-04/schema#",
					"$ref": "#/definitions/EmptyDir"
				},
				"path": {
					"type": "string"
				}
			},
			"additionalProperties": false,
			"type": "object",
			"oneOf": [
				{
					"required": [
						"secret"
					],
					"title": "secret"
				},
				{
					"required": [
						"configMap"
					],
					"title": "configmap"
				},
				{
					"required": [
						"persistentVolumeClaim"
					],
					"title": "persistentVolumeClaim"
				},
				{
					"required": [
						"emptyDir"
					],
					"title": "emptyDir"
				}
			]
		}
	}
}
