From 005112a163a0a3499d22523828688f12bbcb86b6 Mon Sep 17 00:00:00 2001 From: Todd Baert Date: Wed, 3 Jan 2024 16:49:42 -0500 Subject: [PATCH] fixup: load targeting in ci Signed-off-by: Todd Baert --- Makefile | 3 ++- json/flagd-definitions.json | 6 +++--- json/flagd-definitions.yaml | 8 ++++---- json/targeting.json | 2 +- json/targeting.yaml | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index a8ba07d..13e2771 100644 --- a/Makefile +++ b/Makefile @@ -48,5 +48,6 @@ gen-schema-json: install-yq ajv-validate-flagd-schema: @if ! npm ls ajv-cli; then npm ci; fi - npx ajv compile -s json/flagd-definitions.json npx ajv compile -s json/targeting.json +# load the targeting json so flagd-definitions.json can reference it + npx ajv compile -r json/targeting.json -s json/flagd-definitions.json diff --git a/json/flagd-definitions.json b/json/flagd-definitions.json index ab2e05a..83fe319 100644 --- a/json/flagd-definitions.json +++ b/json/flagd-definitions.json @@ -1,5 +1,5 @@ { - "$id": "flagd.dev/schema/flagd-definitions.json", + "$id": "https://flagd.dev/schema/flagd-definitions.json", "$schema": "http://json-schema.org/draft-07/schema#", "title": "flagd Flag Configuration", "description": "Defines flags for use in flagd, including typed variants and rules", @@ -46,7 +46,7 @@ "patternProperties": { "^.{1,}$": { "$comment": "this relative ref means that targeting.json MUST be in the same dir, or available on the same HTTP path", - "$ref": "./targeting.json#/$defs/targeting" + "$ref": "https://flagd.dev/schema/targeting.json#/$defs/targeting" } } } @@ -71,7 +71,7 @@ "type": "string" }, "targeting": { - "$ref": "./targeting.json#/$defs/targeting" + "$ref": "https://flagd.dev/schema/targeting.json#/$defs/targeting" } }, "required": [ diff --git a/json/flagd-definitions.yaml b/json/flagd-definitions.yaml index c6d93c3..9fced8c 100644 --- a/json/flagd-definitions.yaml +++ b/json/flagd-definitions.yaml @@ -1,4 +1,4 @@ -$id: "flagd.dev/schema/flagd-definitions.json" +$id: "https://flagd.dev/schema/flagd-definitions.json" $schema: http://json-schema.org/draft-07/schema# title: flagd Flag Configuration description: Defines flags for use in flagd, including typed variants and rules @@ -25,7 +25,7 @@ properties: - title: Object flag description: A flag having arbitrary object values. $ref: "#/$defs/objectFlag" - "$evaluators": + $evaluators: title: Evaluators description: 'Reusable targeting rules that can be referenced with "$ref": "myRule" in multiple flags.' @@ -35,7 +35,7 @@ properties: "^.{1,}$": $comment: this relative ref means that targeting.json MUST be in the same dir, or available on the same HTTP path - $ref: "./targeting.json#/$defs/targeting" + $ref: "https://flagd.dev/schema/targeting.json#/$defs/targeting" "$defs": flag: $comment: base flag object; no title/description here, allows for better UX, @@ -56,7 +56,7 @@ properties: if the targeting returns null). type: string targeting: - $ref: "./targeting.json#/$defs/targeting" + $ref: "https://flagd.dev/schema/targeting.json#/$defs/targeting" required: - state - defaultVariant diff --git a/json/targeting.json b/json/targeting.json index 8341513..a634b6d 100644 --- a/json/targeting.json +++ b/json/targeting.json @@ -1,5 +1,5 @@ { - "$id": "flagd.dev/schema/targeting.json", + "$id": "https://flagd.dev/schema/targeting.json", "$schema": "http://json-schema.org/draft-07/schema#", "title": "flagd Targeting", "description": "Defines targeting logic for flagd; a extension of JSONLogic, including purpose-built feature-flagging operations.", diff --git a/json/targeting.yaml b/json/targeting.yaml index e626b34..87fff24 100644 --- a/json/targeting.yaml +++ b/json/targeting.yaml @@ -1,4 +1,4 @@ -$id: "flagd.dev/schema/targeting.json" +$id: "https://flagd.dev/schema/targeting.json" $schema: http://json-schema.org/draft-07/schema# title: flagd Targeting description: Defines targeting logic for flagd; a extension of JSONLogic, including