go-fed / activity

ActivityStreams & ActivityPub in golang, oh my!
BSD 3-Clause "New" or "Revised" License
702 stars 111 forks source link

Creating non-standard properties on existing vocabulary + creating non-standard vocabulary #149

Closed gabek closed 2 years ago

gabek commented 2 years ago

I'm looking to accomplish two things, but the answer is probably similar enough I'm throwing them into one question :)

  1. Add non-standard properties to an existing type (example: isLiveBroadcast on a Video)
  2. Add a custom type (example: Hashtag type as used in Mastodon)

I think the official way of doing this is creating a new definition and running codegen against it, but I just wanted to make sure that's the only option, and there isn't something I'm missing of how to set a map of properties to a type, or extend a type without forking and re-generating.

Thanks for everything!

cjslep commented 2 years ago

Hey!

Yep, that is the "official" way. Here is an example JSONLD file for creating new types and properties. The "domain" is where the property is valid (pick the highest level type that makes sense), and the "range" are the possible value types for that property. For the isLiveBroadcast the boolean is represented as xsd:boolean.

As for the Hashtag type originally defined by Mastodon, that's handled in this issue. I'm not sure if it is well-defined-enough to go ahead and submit a PR for, or if there's a couple questions that need to be posed to the Mastodon folks to get an agreement.

Let me know if I don't make sense.

gabek commented 2 years ago

Got it! Thanks for pointing me in the right direction. I'll let you know if I run into any issues with tweaking and generating!