From 62d35aa3e22da99167371be3d270b3949ba96e75 Mon Sep 17 00:00:00 2001 From: Roger Peppe Date: Thu, 16 Jan 2025 16:40:46 +0000 Subject: [PATCH] fix(api/jsonschema): use unchanging JSON Schema version The current value of `$schema` in `api/jsonschema/schema.json` refers to a schema version that changes over time, which means that there's a possibility that the keywords used in the schema might change meaning unexpectedly when a new version is released. This PR fixes the schema version to the current latest version, avoiding this potential issue by locking in the expected JSON Schema semantics and meaning that any would-be interpreter does not have to make a network request to find out what version is intended. I checked that the new schema validates OK in a JSON schema checker. A passing remark with regard to this comment in `hack/api/jsonschema/main.go`: ``` "$id": "http://workflows.argoproj.io/workflows.json", // don't really know what this should be ``` It seems relatively common to use a working URL for JSON schemas URIs so this could potentially be changed to: ``` "$id": "https://raw.githubusercontent.com/argoproj/argo-workflows/HEAD/api/jsonschema/schema.json", ``` Signed-off-by: Roger Peppe --- api/jsonschema/schema.json | 2 +- hack/api/jsonschema/main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/jsonschema/schema.json b/api/jsonschema/schema.json index 6935e019d377..7bbb5ddd9d3d 100644 --- a/api/jsonschema/schema.json +++ b/api/jsonschema/schema.json @@ -1,6 +1,6 @@ { "$id": "http://workflows.argoproj.io/workflows.json", - "$schema": "http://json-schema.org/schema#", + "$schema": "https://json-schema.org/draft/2020-12/schema", "definitions": { "eventsource.CreateEventSourceRequest": { "properties": { diff --git a/hack/api/jsonschema/main.go b/hack/api/jsonschema/main.go index 72018f00049e..be06da97f0ff 100644 --- a/hack/api/jsonschema/main.go +++ b/hack/api/jsonschema/main.go @@ -40,7 +40,7 @@ func main() { } schema := obj{ "$id": "http://workflows.argoproj.io/workflows.json", // don't really know what this should be - "$schema": "http://json-schema.org/schema#", + "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "oneOf": []interface{}{ obj{"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.ClusterWorkflowTemplate"},