From 509db07c7d6637ee166a58bc94fd78ea4520bdf2 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 5 Feb 2026 15:32:52 +0000 Subject: [PATCH] Add scoped global variable schemas Co-authored-by: Justin Brooks --- apps/workspace-engine/oapi/spec/main.jsonnet | 1 + .../oapi/spec/schemas/globalvariables.jsonnet | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 apps/workspace-engine/oapi/spec/schemas/globalvariables.jsonnet diff --git a/apps/workspace-engine/oapi/spec/main.jsonnet b/apps/workspace-engine/oapi/spec/main.jsonnet index aa79f3c16..cdf18c205 100644 --- a/apps/workspace-engine/oapi/spec/main.jsonnet +++ b/apps/workspace-engine/oapi/spec/main.jsonnet @@ -38,6 +38,7 @@ (import 'schemas/relationship.jsonnet') + (import 'schemas/jobs.jsonnet') + (import 'schemas/deployments.jsonnet') + + (import 'schemas/globalvariables.jsonnet') + (import 'schemas/verification.jsonnet') + (import 'schemas/resourcevariables.jsonnet') + (import 'schemas/workflows.jsonnet'), diff --git a/apps/workspace-engine/oapi/spec/schemas/globalvariables.jsonnet b/apps/workspace-engine/oapi/spec/schemas/globalvariables.jsonnet new file mode 100644 index 000000000..c4816dcd2 --- /dev/null +++ b/apps/workspace-engine/oapi/spec/schemas/globalvariables.jsonnet @@ -0,0 +1,46 @@ +local openapi = import '../lib/openapi.libsonnet'; + +{ + GlobalVariable: { + type: 'object', + required: ['id', 'workspaceId', 'key'], + properties: { + id: { type: 'string' }, + workspaceId: { type: 'string' }, + key: { type: 'string' }, + description: { type: 'string' }, + }, + }, + + GlobalVariableScope: { + type: 'object', + properties: { + systemId: { type: 'string' }, + environmentId: { type: 'string' }, + deploymentId: { type: 'string' }, + resourceId: { type: 'string' }, + resourceSelector: openapi.schemaRef('Selector'), + }, + }, + + GlobalVariableValue: { + type: 'object', + required: ['id', 'globalVariableId', 'priority', 'value'], + properties: { + id: { type: 'string' }, + globalVariableId: { type: 'string' }, + priority: { type: 'integer', format: 'int64' }, + scope: openapi.schemaRef('GlobalVariableScope'), + value: openapi.schemaRef('LiteralValue'), + }, + }, + + GlobalVariableWithValues: { + type: 'object', + required: ['variable', 'values'], + properties: { + variable: openapi.schemaRef('GlobalVariable'), + values: { type: 'array', items: openapi.schemaRef('GlobalVariableValue') }, + }, + }, +}