hachyderm.io is one of the many independent Mastodon servers you can use to participate in the fediverse.
Hachyderm is a safe space, LGBTQIA+ and BLM, primarily comprised of tech industry professionals world wide. Note that many non-user account types have restrictions - please see our About page.

Administered by:

Server stats:

8.9K
active users

Let's say for some contrived (but very real) reason, I want to add { "toot": "http://joinmastodon.org/ns#", "Emoji": "toot:Emoji" } to @context, but another member of @context might be { "toot": "http://joinmastodon.org/ns#", "focalPoint": ... }

Would it be acceptable if I just pushed my object to the end and assumed that JSON-LD parsers would correctly reduce it down to:

{
  "toot": "http://joinmastodon.org/ns#",
  "Emoji": "toot:Emoji",
  "focalPoint": ...
}

... or should I be adding in logic to detect the existing member defining toot and merge the Emoji property in?

Emelia 👸🏻

@julian depends on if your property conflicts with any other defined properties. (see the schema.org problem)

@thisismissem@hachyderm.io let's assume no. Only common property is toot.

I just want to make sure it's not going to make fedify or smithereen throw errors when it tries to parse my janky @context.

@julian @thisismissem context definitions work on a "most recently declared wins" basis. so it's generally *okay* to redeclare the same definition, just unnecessary.

the only exception is when the @\protected keyword is used, which disallows any further redefinitions unless the new definition exactly matches the old definition.

@julian @thisismissem which is to say, the following are equivalent within the same scope...

@\context: [
{
toot: joinmastodon.org/ns#,
Emoji: toot:Emoji
},
{
toot: joinmastodon.org/ns#,
IdentityProof: toot:IdentityProof
}
]

@\context: [
{
toot: joinmastodon.org/ns#,
Emoji: toot:Emoji,
IdentityProof: toot:IdentityProof
}
]