Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incident tag syntax breaks JSON conventions #243

Closed
katsel opened this issue Jan 5, 2021 · 2 comments
Closed

Incident tag syntax breaks JSON conventions #243

katsel opened this issue Jan 5, 2021 · 2 comments

Comments

@katsel
Copy link
Contributor

katsel commented Jan 5, 2021

One more for the bikeshed!

Syntax for tags on incidents is currently defined as

"tags": [
   {"tag": "host=foobar-sw.example.org"},
   {"tag": "location=Campus Rotvoll"},
   {"tag": "customer=himunkholmen.no"}
 ]

"tag": key is superfluous here (the parent array is already named "tags"), so using a string array

"tags": [
   "host=foobar-sw.example.org",
   "location=Campus Rotvoll",
   "customer=himunkholmen.no",
 ]

does suffice.

Still, = is not a structural character in JSON (see https://tools.ietf.org/html/rfc7159#page-5).

So, splitting the strings up into string-value members, I'm inclined to conclude that

"tags": [
  { "host": "foobar-sw.example.org" },
  { "location": "Campus Rotvoll" },
  { "customer": "himunkholmen.no" }
]

is the most JSON-y way of representing incident tags.

Note that JSON arrays are not type-specific, so the ability to have simple strings as tags is not getting lost here.

"tags": [
  { "host": "foobar-sw.example.org" },
  { "location": "Campus Rotvoll" },
  { "customer": "himunkholmen.no" },
  "a lonely string"
]

Why worry about such a minor thing like this?
Because a) consistency, and b) following standards is generally a good thing and c) quicker parsing, easier access to values, and the unhampered ability to use JSON-specific features of your coding language, database, etc on these values should you wish to do so.

@lunkwill42
Copy link
Member

This is more or less a duplicate of #136

@lunkwill42
Copy link
Member

Closing to avoid keeping dupes around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants