go-ap / activitypub

ActivityPub vocabulary for Go
MIT License
128 stars 10 forks source link

Should type of 'Attachment' be 'ItemCollection'? #13

Open snoymy opened 5 months ago

snoymy commented 5 months ago

Currently, the property Attachement in Object struct and some other struct has type Item. Since from the Activitypub Vocabulary Spec (Example 66) shown that attachment field can be JSON array, so shouldn't Attachement be type ItemCollection? Or I miss something?

Activitypub Vocabulary Example 66

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Note",
  "name": "Have you seen my cat?",
  "attachment": [
    {
      "type": "Image",
      "content": "This is what he looks like.",
      "url": "http://example.org/cat.jpeg"
    }
  ]
}

Ex. object.go

type Object struct {
        /* .... */

    // Attachment identifies a resource attached or related to an object that potentially requires special handling.
    // The intent is to provide a model that is at least semantically similar to attachments in email.
    Attachment Item `jsonld:"attachment,omitempty"`

       /* .... */
}

Ex. actor.go

type Actor struct {
        /* .... */

    // Attachment identifies a resource attached or related to an object that potentially requires special handling.
    // The intent is to provide a model that is at least semantically similar to attachments in email.
    Attachment Item `jsonld:"attachment,omitempty"`

       /* .... */
}