Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions schemas/common/boilerplate/v3.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{
"description": "Boilerplate basic configuration",
"$id": "https://mapcolonies.com/common/boilerplate/v3",
"type": "object",
"title": "commonBoilerplateV3",
"required": ["openapiConfig", "telemetry", "server"],
"properties": {
"openapiConfig": {
"description": "OpenAPI configuration",
"type": "object",
"default": {},
"examples": [
{
"filePath": "./openapi3.yaml",
"basePath": "/docs",
"rawPath": "/api",
"uiPath": "/api"
}
],
"properties": {
"filePath": { "default": "./openapi3.yaml", "description": "Path to the OpenAPI 3.0 spec file", "type": "string" },
"basePath": { "default": "/docs", "description": "The base path for the OpenAPI UI and raw OpenAPI spec", "type": "string" },
"rawPath": { "default": "/api", "description": "The path to the raw OpenAPI spec", "type": "string" },
"uiPath": { "default": "/api", "description": "The path to the OpenAPI UI", "type": "string" }
},
"unevaluatedProperties": false,
"required": ["filePath", "basePath", "rawPath", "uiPath"]
},
"telemetry": {
"description": "Telemetry configuration",
"type": "object",
"default": {},
"unevaluatedProperties": false,
"examples": [
{
"shared": { "serviceName": "boilerplate" },
"tracing": { "isEnabled": false },
"logger": { "level": "info", "prettyPrint": false }
}
],
"properties": {
"shared": {
"$ref": "https://mapcolonies.com/common/telemetry/base/v1"
},
"tracing": {
"$ref": "https://mapcolonies.com/common/telemetry/tracing/v1"
},
"logger": {
"$ref": "https://mapcolonies.com/common/telemetry/logger/v2"
},
"metrics": {
"description": "Metrics configuration"
}
},
"required": ["logger", "shared", "tracing"]
},
"server": {
"description": "Server configuration",
"type": "object",
"unevaluatedProperties": false,
"default": {},
"examples": [
{
"port": 8080,
"request": { "payload": { "limit": "1mb" } }
}
],
"properties": {
"port": {
"minimum": 1,
"maximum": 65535,
"default": 8080,
"description": "The port the server will listen on",
"type": "integer",
"x-env-value": "SERVER_PORT"
},
"request": {
"type": "object",
"default": {},
"properties": {
"payload": {
"type": "object",
"default": {},
"properties": { "limit": { "default": "1mb", "description": "The maximum payload size of an incoming request", "type": "string" } },
"unevaluatedProperties": false,
"required": ["limit"]
}
},
"unevaluatedProperties": false,
"required": ["payload"]
},
"response": {
"type": "object",
"default": {},
"properties": {
"compression": {
"type": "object",
"default": {},
"properties": {
"enabled": {
"type": "boolean",
"default": true,
"description": "Whether to compress response bodies for all request that traverse through the middleware"
},
"options": {
"type": ["null", "object"],
"default": null,
"description": "Options properties of compression"
}
},
"unevaluatedProperties": false
}
},
"unevaluatedProperties": false
}
},
"required": ["port", "request", "response"]
}
}
}
58 changes: 58 additions & 0 deletions schemas/common/telemetry/logger/v2.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"$id": "https://mapcolonies.com/common/telemetry/logger/v2",
"title": "telemetryLoggerV2",
"description": "Telemetry logger configuration",
"type": "object",
"required": ["level", "prettyPrint"],
"unevaluatedProperties": false,
"properties": {
"level": {
"$ref": "#/definitions/level"
},
"prettyPrint": {
"$ref": "#/definitions/prettyPrint"
},
"opentelemetryOptions": {
"$ref": "#/definitions/opentelemetryOptions"
}
},
"examples": [
{
"level": "info",
"prettyPrint": false
}
],
"definitions": {
"level": {
"default": "info",
"description": "The log level",
"x-env-value": "LOG_LEVEL",
"enum": ["trace", "debug", "info", "warn", "error", "fatal"]
},
"prettyPrint": {
"default": false,
"description": "Whether to pretty print logs",
"type": "boolean",
"x-env-value": "LOG_PRETTY_PRINT_ENABLED"
},
"opentelemetryOptions": {
"description": "Configuration options for OpenTelemetry logging",
"allOf": [
{
"type": "object",
"properties": {
"enabled": {
"description": "Flag to enable or disable OpenTelemetry logging",
"type": "boolean",
"default": false,
"x-env-value": "OPENTELEMETRY_LOGGING_ENABLED"
}
}
},
{
"$ref": "https://mapcolonies.com/common/telemetry/otlp-logger/v1"
}
]
}
}
}
8 changes: 8 additions & 0 deletions schemas/common/telemetry/otlp-logger/v1.configs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"name": "collector-logger-connection",
"value": {
"url": "http://localhost:4317"
}
}
]
15 changes: 15 additions & 0 deletions schemas/common/telemetry/otlp-logger/v1.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$id": "https://mapcolonies.com/common/telemetry/otlp-logger/v1",
"title": "otlpLoggerV1",
"description": "Telemetry logger configuration",
"type": "object",
"properties": {
"url": {
"description": "The OTLP grpc endpoint URL",
"type": "string",
"format": "uri",
"default": "http://localhost:4317",
"x-env-value": "OTLP_LOGGER_ENDPOINT_URL"
}
}
}