Skip to content
Draft
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
61 changes: 61 additions & 0 deletions schemas/vector/vectorStandard/api/v2.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"$id": "https://mapcolonies.com/vector/vectorStandard/api/v2",
"type": "object",
"title": "vectorStandardApiSchemaV2",
"description": "Vector's standard API schema",
"allOf": [
{
"$ref": "https://mapcolonies.com/common/boilerplate/v2"
},
{
"$ref": "#/definitions/databases"
},
{
"$ref": "#/definitions/namespaces"
}
],
"definitions": {
"namespaces": {
"type": "object",
"required": ["namespaces"],
"properties": {
"namespaces": {
"type": "array",
"description": "The namespaces this deployment serves, by name. The synchronizer owns everything else about them, so only the names are repeated here",
"minItems": 1,
"items": {
"type": "string",
"description": "A namespace name, matching one the synchronizer is configured with",
"pattern": "^[A-Za-z0-9][A-Za-z0-9_-]*$",
"maxLength": 63,
"examples": ["data-2024", "data-2025"]
}
}
}
},
"databases": {
"type": "object",
"required": ["db"],
"properties": {
"db": {
"allOf": [
{
"$ref": "https://mapcolonies.com/common/db/full/v3"
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"x-env-value": "DB_TYPE",
"default": "postgres"
}
},
"required": ["type"]
}
]
}
}
}
}
}
182 changes: 182 additions & 0 deletions schemas/vector/vectorStandard/namespace/v1.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
{
"$id": "https://mapcolonies.com/vector/vectorStandard/namespace/v1",
"type": "object",
"title": "vectorStandardNamespaceSchemaV1",
"description": "A single vector standard namespace - one source database and the layer source describing it. Namespaces are consumed as an array, and the config package stops descending at arrays, so no x-env-value declared or inherited below this point is ever bound. Per namespace values, credentials in particular, are expected to come from referenced config instances.",
"required": ["name", "db", "layersFile", "bucket", "layerSource"],
"unevaluatedProperties": false,
"properties": {
"name": {
"type": "string",
"description": "The namespace identifier. Appears in the destination database primary keys, in the API path and as a key in the aliases file, so it is restricted to URL safe characters",
"pattern": "^[A-Za-z0-9][A-Za-z0-9_-]*$",
"maxLength": 63,
"examples": ["data-2024", "data-2025"]
},
"db": {
"description": "The source database for this namespace. A config instance of https://mapcolonies.com/common/db/full/v3 can be referenced here directly",
"allOf": [
{
"$ref": "https://mapcolonies.com/common/db/full/v3"
},
{
"type": "object",
"required": ["type"],
"properties": {
"type": {
"type": "string",
"description": "the type of the database",
"default": "postgres"
}
}
}
]
},
"layersFile": {
"type": "string",
"description": "The path to this namespace's layers file. Each namespace owns its own file - sharing one across namespaces is always a mistake",
"examples": ["./config/layers/data-2025.json"]
},
"bucket": {
"type": "string",
"description": "The S3 bucket holding this namespace's layer source. The connection itself is shared and configured once under dbs.s3"
},
"layerSource": {
"$ref": "#/definitions/layerSource"
}
},
"definitions": {
"layerSource": {
"type": "object",
"description": "Where layer identity and property aliases come from. The two modes are mutually exclusive: sharedLua requires the lua fields and carries the enrichment API, perLayerJson forbids enrichment outright, because without a layer id its url template cannot be resolved. The exclusivity is enforced by shape rather than by a runtime check",
"required": ["type"],
"unevaluatedProperties": false,
"properties": {
"type": {
"description": "Which layer source this namespace uses",
"enum": ["sharedLua", "perLayerJson"]
},
"fileName": {
"type": "string",
"description": "sharedLua only. The key of the lua file within the bucket"
},
"layersVariable": {
"type": "string",
"description": "sharedLua only. Lua layers variable name"
},
"aliasFieldName": {
"type": "string",
"description": "sharedLua only. Lua alias field name"
},
"idFieldName": {
"type": "string",
"description": "sharedLua only. Lua id field name"
},
"nameFieldName": {
"type": "string",
"description": "sharedLua only. Lua name field name"
},
"enrichment": {
"$ref": "#/definitions/enrichment"
}
},
"if": {
"required": ["type"],
"properties": {
"type": {
"const": "sharedLua"
}
}
},
"then": {
"required": ["fileName", "layersVariable", "aliasFieldName", "idFieldName", "nameFieldName", "enrichment"]
},
"else": {
"not": {
"required": ["enrichment"]
},
"properties": {
"prefix": {
"type": "string",
"description": "perLayerJson only. Optional key prefix within the bucket, prepended to the file name configured for each layer",
"default": ""
},
"aliasLayerNameField": {
"type": "string",
"description": "perLayerJson only. The field holding the layer alias",
"default": "alias_layer_name"
},
"fieldsField": {
"type": "string",
"description": "perLayerJson only. The field holding the array of field definitions",
"default": "fields"
},
"fieldNameField": {
"type": "string",
"description": "perLayerJson only. The field within a field definition holding the source column name. Matched against the database columns case insensitively",
"default": "field_name"
},
"aliasFieldNameField": {
"type": "string",
"description": "perLayerJson only. The field within a field definition holding the property alias",
"default": "alias_field_name"
}
}
}
},
"enrichment": {
"type": "object",
"description": "sharedLua only. Property alias enrichment over http. The settings exist only while it is enabled, so disabling it is exactly { \"enabled\": false }",
"required": ["enabled"],
"properties": {
"enabled": {
"type": "boolean",
"description": "enable enrichment",
"default": false
},
"api": {
"type": "string",
"description": "Property alias name API. Supports the {layerName} and {layerId} placeholders"
},
"propertiesPath": {
"type": "string",
"description": "Path to the properties map within the API response. Supports the {layerName} placeholder",
"examples": ["{layerName}.properties"]
},
"aliasField": {
"type": "string",
"description": "The field within a property entry holding its alias",
"examples": ["alias"]
},
"requestTimeoutMilliseconds": {
"type": "integer",
"description": "Timeout for enrichment API requests in milliseconds",
"examples": [5000]
}
},
"unevaluatedProperties": false,
"if": {
"required": ["enabled"],
"properties": {
"enabled": {
"const": true
}
}
},
"then": {
"required": ["api", "propertiesPath", "aliasField", "requestTimeoutMilliseconds"]
},
"else": {
"properties": {
"enabled": {
"const": false
},
"api": false,
"propertiesPath": false,
"aliasField": false,
"requestTimeoutMilliseconds": false
}
}
}
}
}
Loading
Loading