DO NOT CHECK TYPES DURING VALIDATION

an Actor has an inbox and outbox. that’s it.

an Activity has an actor. that’s it.

a Collection has items or orderedItems. that’s it.

etc

DON’T PANIC WHEN YOU SEE A TYPE YOU DON’T UNDERSTAND

say you understand tags of type Mention and Hashtag and Emoji. someone sends you a tag array with a raw Link. DON’T PANIC. the document is still valid. just filter out anything you don’t understand, something like

1UNDERSTOOD_TAG_TYPES = set("Mention", "Hashtag", "Emoji")
2document = json.loads(...)
3tags = document.get('tag', [])
4tags = [
5	tag
6	for tag in tags
7	if tag['type'] in UNDERSTOOD_TAG_TYPES
8]
9# do whatever you need to now
1const UNDERSTOOD_TAG_TYPES = new Set(["Mention", "Hashtag", "Emoji"])
2let document = ...
3tags = document.tag.filter(tag => tag.type in UNDERSTOOD_TAG_TYPES)
4// do whatever you need to now