Skip to content

ActivityStreamsOrderedProperty isn't array with only one item #139

Description

@Sigafoos

Please Describe The Problematic Behavior
I have this code:

	followers := streams.NewActivityStreamsOrderedCollection()

	id := streams.NewJSONLDIdProperty()
	id.SetIRI(u.FollowersIRI())

	items := streams.NewActivityStreamsOrderedItemsProperty()
	for _, follower := range u.Followers {
		log.Println("appending follower", follower.ID)
		iri, err := url.Parse(follower.ID)
		if err != nil {
			log.Println("error parsing url for followers list:", err.Error())
			continue
		}
		items.PrependIRI(iri)
	}
	followers.SetActivityStreamsOrderedItems(items)

When I hit the followers endpoint of my app, this is the response

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "orderedItems": "http://localhost:8080/user/test",
  "type": "OrderedCollection"
}

I added two calls to PrependIRI() and the response was an array:

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "orderedItems": [
    "http://localhost:8080/user/test",
    "http://localhost:8080/user/test"
  ],
  "type": "OrderedCollection"
}

Please Describe The Expected Behavior

When there is only one item in the ordered items it still renders as an array.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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