Skip to content

Instantly share code, notes, and snippets.

@shibukawa
Created September 11, 2019 11:22
Show Gist options
  • Select an option

  • Save shibukawa/fe2f957348affe22170f76f9650483f4 to your computer and use it in GitHub Desktop.

Select an option

Save shibukawa/fe2f957348affe22170f76f9650483f4 to your computer and use it in GitHub Desktop.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"title": "The Root Schema",
"required": [
"name",
"author",
"version",
"handlers"
],
"definitions": {
"comment": {
"$id": "#/definitions/comment",
"type": "string",
"title": "Comment",
"default": "",
"examples": [
""
],
"pattern": "^(.*)$"
}
},
"properties": {
"$comment": {
"$ref": "#/definitions/comment"
},
"name": {
"$id": "#/properties/name",
"type": "string",
"title": "The Name Schema",
"default": "",
"examples": [
"example-application"
],
"pattern": "^(.*)$"
},
"author": {
"$id": "#/properties/author",
"type": "string",
"title": "The Author Schema",
"default": "",
"examples": [
"Your Name"
],
"pattern": "^(.*)$"
},
"version": {
"$id": "#/properties/version",
"type": "string",
"title": "The Version Schema",
"default": "",
"examples": [
"1.0.0"
],
"pattern": "^(.*)$"
},
"envs": {
"$id": "#/properties/envs",
"type": "object",
"title": "Environment variables for all platforms",
"additionalProperties": true
},
"gcp": {
"$id": "#/properties/gcp",
"type": "object",
"title": "The settings only for GCP",
"properties": {
"$comment": {
"$ref": "#/definitions/comment"
},
"envs": {
"$id": "#/properties/gcp/properties/envs",
"type": "object",
"title": "Environment variables for GCP",
"additionalProperties": true
}
}
},
"aws": {
"$id": "#/properties/aws",
"type": "object",
"title": "The settings only for AWS",
"properties": {
"$comment": {
"$ref": "#/definitions/comment"
},
"envs": {
"$id": "#/properties/aws/properties/envs",
"type": "object",
"title": "Environment variables for AWS",
"additionalProperties": true
}
}
},
"local": {
"$id": "#/properties/local",
"type": "object",
"title": "The settings only for local simulator",
"properties": {
"$comment": {
"$ref": "#/definitions/comment"
},
"envs": {
"$id": "#/properties/local/properties/envs",
"type": "object",
"title": "Environment variables for local simulator",
"additionalProperties": true
}
}
},
"handlers": {
"$id": "#/properties/handlers",
"type": "object",
"title": "The Handlers",
"properties": {
"$comment": {
"$ref": "#/definitions/comment"
},
"http": {
"$id": "#/properties/handlers/properties/http",
"type": "array",
"title": "HTTP handler",
"items": {
"$id": "#/properties/handlers/properties/http/items",
"type": "object",
"title": "Each HTTP handler setting",
"required": [
"handler",
"path"
],
"properties": {
"$comment": {
"$ref": "#/definitions/comment"
},
"handler": {
"$id": "#/properties/handlers/properties/http/items/properties/handler",
"type": "string",
"title": "Handler function that handles HTTP access",
"default": "",
"examples": [
"AdminRouter"
],
"pattern": "^(.*)$"
},
"path": {
"$id": "#/properties/handlers/properties/http/items/properties/path",
"type": "string",
"title": "URL Path",
"default": "",
"examples": [
"/admin"
],
"pattern": "^(.*)$"
}
}
}
},
"pubsub": {
"$id": "#/properties/handlers/properties/pubsub",
"type": "array",
"title": "PubSub settings",
"items": {
"$id": "#/properties/handlers/properties/pubsub/items",
"type": "object",
"title": "The Items Schema",
"required": [
"handler",
"aws",
"gcp",
"local"
],
"properties": {
"$comment": {
"$ref": "#/definitions/comment"
},
"handler": {
"$id": "#/properties/handlers/properties/pubsub/items/properties/handler",
"type": "string",
"title": "PubSub handler function name",
"default": "",
"examples": [
"Receive"
],
"pattern": "^(.*)$"
},
"aws": {
"$id": "#/properties/handlers/properties/pubsub/items/properties/aws",
"type": "object",
"title": "AWS specific setting",
"required": [
"topic"
],
"properties": {
"$comment": {
"$ref": "#/definitions/comment"
},
"topic": {
"$id": "#/properties/handlers/properties/pubsub/items/properties/aws/properties/topic",
"type": "string",
"title": "AWS SNS/SQS topic name",
"default": "",
"examples": [
"arn:aws:sns:us-east-2:123456789012:mytopic"
],
"pattern": "^(.*)$"
}
}
},
"gcp": {
"$id": "#/properties/handlers/properties/pubsub/items/properties/gcp",
"type": "object",
"title": "GCP specific setting",
"required": [
"topic"
],
"properties": {
"$comment": {
"$ref": "#/definitions/comment"
},
"topic": {
"$id": "#/properties/handlers/properties/pubsub/items/properties/gcp/properties/topic",
"type": "string",
"title": "GCP PubSub topic name",
"default": "",
"examples": [
"gcppubsub://12345/mytopic"
],
"pattern": "^(.*)$"
}
}
},
"local": {
"$id": "#/properties/handlers/properties/pubsub/items/properties/local",
"type": "object",
"title": "local simulator specific setting",
"required": [
"topic"
],
"properties": {
"$comment": {
"$ref": "#/definitions/comment"
},
"topic": {
"$id": "#/properties/handlers/properties/pubsub/items/properties/local/properties/topic",
"type": "string",
"title": "PubSub topic for mem pubsub or NATS.",
"default": "",
"examples": [
"mem://mytopic",
"nats://example.mytopic"
],
"pattern": "^(.*)$"
}
}
}
}
}
},
"schedule": {
"$id": "#/properties/handlers/properties/schedule",
"type": "array",
"title": "The Schedule Schema",
"items": {
"$id": "#/properties/handlers/properties/schedule/items",
"type": "object",
"title": "Each schedule setting",
"required": [
"handler",
"cron"
],
"properties": {
"$comment": {
"$ref": "#/definitions/comment"
},
"handler": {
"$id": "#/properties/handlers/properties/schedule/items/properties/handler",
"type": "string",
"title": "Schedule handler function name",
"default": "",
"examples": [
"Timer"
],
"pattern": "^(.*)$"
},
"cron": {
"$id": "#/properties/handlers/properties/schedule/items/properties/cron",
"type": "string",
"title": "Cron definition. For AWS/GCP, that uses cron service settings.",
"default": "",
"examples": [
"*/10 * * * *"
],
"pattern": "^(.*)$"
},
"aws": {
"$id": "#/properties/handlers/properties/schedule/items/properties/aws",
"type": "object",
"title": "The Aws Schema",
"required": [
"topic"
],
"properties": {
"$comment": {
"$ref": "#/definitions/comment"
},
"topic": {
"$id": "#/properties/handlers/properties/schedule/items/properties/aws/properties/topic",
"type": "string",
"title": "The SNS/SQS topic that linked with AWS CloudWatch Events",
"default": "",
"examples": [
"arn:aws:sns:us-east-2:123456789012:scheduler"
],
"pattern": "^(.*)$"
}
}
},
"gcp": {
"$id": "#/properties/handlers/properties/schedule/items/properties/gcp",
"type": "object",
"title": "The Gcp Schema",
"required": [
"topic"
],
"properties": {
"$comment": {
"$ref": "#/definitions/comment"
},
"topic": {
"$id": "#/properties/handlers/properties/schedule/items/properties/gcp/properties/topic",
"type": "string",
"title": "The Cloud PubSub topic that linked with Cloud Scheduler",
"default": "",
"examples": [
"gcppubsub://12345/scheduler"
],
"pattern": "^(.*)$"
}
}
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment