Skip to content

Reformat schema files to simplify machine edits #274

@magnusbaeck

Description

@magnusbaeck

Description

The schema files are inconsistently formatted and if you attempt to use e.g. jq or Python to programmatically edit the files you'll end up with irrelevant diffs. We should reformat the files with jq or Python

Motivation

Modifying multiple schemas by hand is very tedious and the inconsistent formatting makes it unnecessarily tedious to write a script to make the updates.

Exemplification

I recently had to edit all schema files and that wasn't too fun. I ended up using ed(1). That worked but wasn't terribly convenient and can get really hairy for more involved edits.

Benefits

Easier to batch-edit files.

Possible Drawbacks

None. The differences between the current formatting and how jq wants to format files is small. Example for a single file:

diff --git a/schemas/EiffelActivityCanceledEvent/3.0.0.json b/schemas/EiffelActivityCanceledEvent/3.0.0.json
index 3c59987..edf01ca 100644
--- a/schemas/EiffelActivityCanceledEvent/3.0.0.json
+++ b/schemas/EiffelActivityCanceledEvent/3.0.0.json
@@ -11,11 +11,15 @@
         },
         "type": {
           "type": "string",
-          "enum": ["EiffelActivityCanceledEvent"]
+          "enum": [
+            "EiffelActivityCanceledEvent"
+          ]
         },
         "version": {
           "type": "string",
-          "enum": [ "3.0.0" ],
+          "enum": [
+            "3.0.0"
+          ],
           "default": "3.0.0"
         },
         "time": {
@@ -63,7 +67,20 @@
                 },
                 "alg": {
                   "type": "string",
-                  "enum": ["HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "ES256", "ES384", "ES512", "PS256", "PS384", "PS512"]
+                  "enum": [
+                    "HS256",
+                    "HS384",
+                    "HS512",
+                    "RS256",
+                    "RS384",
+                    "RS512",
+                    "ES256",
+                    "ES384",
+                    "ES512",
+                    "PS256",
+                    "PS384",
+                    "PS512"
+                  ]
                 },
                 "publicKey": {
                   "type": "string"
@@ -123,8 +140,7 @@
               "key": {
                 "type": "string"
               },
-              "value": {
-              }
+              "value": {}
             },
             "required": [
               "key",

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions