⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions jsonschemas/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Stream offers the ability to import data for both the **[Chat](https://getstream.io/chat/docs/javascript/import/)** and **[Feeds](https://getstream.io/activity-feeds/docs/javascript/importing_data_feeds/)** products.

To simplify data generation and ensure it conforms to the expected format, we provide **JSON Schema** files that can be used to validate the data before import.

There are many **[JSON Schema validators](https://json-schema.org/tools?query=&sortBy=name&sortOrder=ascending&groupBy=toolingTypes&licenses=&languages=&drafts=&toolingTypes=&environments=&showObsolete=false&supportsBowtie=false#validator)** available for different programming languages that you can use to validate your data.

For more information, please refer to the **[JSON Schema documentation](https://json-schema.org/docs)**.
13 changes: 13 additions & 0 deletions jsonschemas/chat/attachment.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "attachment.schema.json",
"type": "object",
"additionalProperties": false,
"properties": {
"type": { "type": "string" },
"image_url": { "type": "string", "format": "uri", "pattern": "^https://", "description": "Must be HTTPS and accessible" },
"thumb_url": { "type": "string", "format": "uri", "pattern": "^https://", "description": "Must be HTTPS and accessible" },
"asset_url": { "type": "string", "format": "uri", "pattern": "^https://", "description": "Must be HTTPS and accessible" },
"migrate_resources": { "type": "boolean" }
}
}
22 changes: 22 additions & 0 deletions jsonschemas/chat/channel.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "channel.schema.json",
"type": "object",
"required": ["type", "created_by"],
"properties": {
"id": { "type": "string", "pattern": "^[\\w-]*$", "maxLength": 64 },
"member_ids": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
"type": { "type": "string", "pattern": "^[\\w-]*$", "maxLength": 64 },
"created_by": { "type": "string" },
"team": { "type": "string" },
"disabled": { "type": "boolean" },
"frozen": { "type": "boolean" },
"truncated_at": { "type": "string", "format": "date-time" },
"created_at": { "type": "string", "format": "date-time" },
"updated_at": { "type": "string", "format": "date-time" }
},
"anyOf": [
{ "required": ["id"], "not": { "required": ["member_ids"] } },
{ "required": ["member_ids"], "not": { "required": ["id"] } }
]
}
25 changes: 25 additions & 0 deletions jsonschemas/chat/channel_member.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "channel_member.schema.json",
"type": "object",
"required": ["user_id", "channel_type"],
"properties": {
"user_id": { "type": "string" },
"channel_type": { "type": "string" },
"channel_id": { "type": "string" },
"channel_member_ids": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
"channel_role": { "type": "string", "description": "Valid channel role; defaults to channel_member" },
"invited": { "type": "boolean" },
"invite_accepted_at": { "type": "string", "format": "date-time" },
"invite_rejected_at": { "type": "string", "format": "date-time" },
"hide_channel": { "type": "boolean" },
"hide_messages_before": { "type": "string", "format": "date-time" },
"last_read": { "type": "string", "format": "date-time" },
"archived_at": { "type": "string", "format": "date-time" },
"created_at": { "type": "string", "format": "date-time" }
},
"anyOf": [
{ "required": ["channel_id"], "not": { "required": ["channel_member_ids"] } },
{ "required": ["channel_member_ids"], "not": { "required": ["channel_id"] } }
]
}
14 changes: 14 additions & 0 deletions jsonschemas/chat/device.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "device.schema.json",
"type": "object",
"additionalProperties": false,
"required": ["id", "user_id", "push_provider_type"],
"properties": {
"id": { "type": "string", "maxLength": 255 },
"user_id": { "type": "string", "maxLength": 255 },
"push_provider_type": { "type": "string", "enum": ["firebase", "apn", "huawei", "xiaomi"] },
"push_provider_name": { "type": "string" },
"created_at": { "type": "string", "format": "date-time" }
}
}
20 changes: 20 additions & 0 deletions jsonschemas/chat/item.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "item.schema.json",
"type": "object",
"additionalProperties": false,
"required": ["type", "data"],
"properties": {
"type": { "type": "string", "enum": ["user", "device", "channel", "channel_member", "message", "reaction"] },
"data": {
"anyOf": [
{ "$ref": "user.schema.json" },
{ "$ref": "device.schema.json" },
{ "$ref": "channel.schema.json" },
{ "$ref": "channel_member.schema.json" },
{ "$ref": "message.schema.json" },
{ "$ref": "reaction.schema.json" }
]
}
}
}
39 changes: 39 additions & 0 deletions jsonschemas/chat/message.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "message.schema.json",
"type": "object",
"required": ["id", "channel_type", "user"],
"properties": {
"id": { "type": "string", "minLength": 1 },
"parent_id": { "type": "string" },
"channel_type": { "type": "string" },
"channel_id": { "type": "string" },
"channel_member_ids": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
"text": { "type": "string" },
"html": { "type": "string" },
"attachments": { "type": "array", "items": { "$ref": "attachment.schema.json" }, "maxItems": 30 },
"user": { "type": "string" },
"type": { "type": "string", "enum": ["", "regular", "deleted", "system", "reply"], "default": "regular" },
"show_in_channel": { "type": "boolean" },
"created_at": { "type": "string", "format": "date-time" },
"updated_at": { "type": "string", "format": "date-time" },
"deleted_at": { "type": "string", "format": "date-time" },
"mentioned_users_ids": { "type": "array", "items": { "type": "string" } },
"quoted_message_id": { "type": "string" },
"pinned_at": { "type": "string", "format": "date-time" },
"pinned_by_id": { "type": "string" },
"pin_expires": { "type": "string", "format": "date-time" }
},
"anyOf": [
{ "required": ["channel_id"], "not": { "required": ["channel_member_ids"] } },
{ "required": ["channel_member_ids"], "not": { "required": ["channel_id"] } }
],
"allOf": [
{ "if": { "properties": { "type": { "const": "reply" } }, "required": ["type"] }, "then": { "required": ["parent_id"] } },
{ "if": { "properties": { "type": { "const": "deleted" } }, "required": ["type"] }, "then": { "required": ["deleted_at"] } },
{ "if": { "properties": { "deleted_at": { "type": "string" } }, "required": ["deleted_at"] }, "then": { "properties": { "type": { "enum": ["deleted"] } } } },
{ "if": { "properties": { "pinned_by_id": { "type": "string" } }, "required": ["pinned_by_id"] }, "then": { "required": ["pinned_at"] } },
{ "if": { "properties": { "pinned_at": { "type": "string" } }, "required": ["pinned_at"] }, "then": { "required": ["pinned_by_id"] } },
{ "if": { "properties": { "pin_expires": { "type": "string" } }, "required": ["pin_expires"] }, "then": { "required": ["pinned_at", "pinned_by_id"] } }
]
}
12 changes: 12 additions & 0 deletions jsonschemas/chat/reaction.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "reaction.schema.json",
"type": "object",
"required": ["message_id", "type", "user_id", "created_at"],
"properties": {
"message_id": { "type": "string" },
"type": { "type": "string" },
"user_id": { "type": "string" },
"created_at": { "type": "string", "format": "date-time" }
}
}
25 changes: 25 additions & 0 deletions jsonschemas/chat/user.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "user.schema.json",
"type": "object",
"required": ["id"],
"properties": {
"id": { "type": "string", "maxLength": 255, "pattern": "^[@\\w-]*$" },
"role": { "type": "string", "description": "Must be a valid app role" },
"teams": { "type": "array", "items": { "type": "string" } },
"teams_role": {
"type": "object",
"additionalProperties": { "type": "string", "description": "Valid team role" }
},
"language": { "type": "string" },
"blocked_user_ids": { "type": "array", "items": { "type": "string" } },
"blocked_by_user_ids": { "type": "array", "items": { "type": "string" } },
"invisible": { "type": "boolean" },
"deactivated_at": { "type": "string", "format": "date-time" },
"deleted_at": { "type": "string", "format": "date-time" },
"created_at": { "type": "string", "format": "date-time" },
"updated_at": { "type": "string", "format": "date-time" },
"channel_mutes": { "type": "array", "items": { "type": "string" } },
"user_mutes": { "type": "array", "items": { "type": "string" } }
}
}
59 changes: 59 additions & 0 deletions jsonschemas/feeds/activity.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "activity.schema.json",
"type": "object",
"properties": {
"id": { "type": "string" },
"type": { "type": "string" },
"user_id": { "type": "string" },
"fids": {
"type": "array",
"items": { "type": "string" }
},
"text": { "type": "string" },
"attachments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": { "type": "string" },
"image_url": { "type": "string" },
"thumb_url": { "type": "string" },
"asset_url": { "type": "string" },
"migrate_resources": { "type": "boolean" },
"custom": { "type": "object" }
}
}
},
"visibility": { "type": "string" },
"visibility_tag": { "type": "string" },
"location": {
"type": "object",
"properties": {
"lat": { "type": "number" },
"lng": { "type": "number" }
}
},
"expires_at": { "type": "string", "format": "date-time" },
"mentioned_user_ids": {
"type": "array",
"items": { "type": "string" }
},
"parent_id": { "type": "string" },
"poll_id": { "type": "string" },
"custom": { "type": "object" },
"created_at": { "type": "string", "format": "date-time" },
"updated_at": { "type": "string", "format": "date-time" },
"edited_at": { "type": "string", "format": "date-time" },
"deleted_at": { "type": "string", "format": "date-time" },
"filter_tags": {
"type": "array",
"items": { "type": "string" }
},
"interest_tags": {
"type": "array",
"items": { "type": "string" }
}
},
"required": ["id", "type", "user_id", "fids"]
}
15 changes: 15 additions & 0 deletions jsonschemas/feeds/collection.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "collection.schema.json",
"type": "object",
"properties": {
"name": { "type": "string" },
"id": { "type": "string" },
"user_id": { "type": "string" },
"custom": { "type": "object" },
"created_at": { "type": "string", "format": "date-time" },
"updated_at": { "type": "string", "format": "date-time" },
"deleted_at": { "type": "string", "format": "date-time" }
},
"required": ["name", "id"]
}
40 changes: 40 additions & 0 deletions jsonschemas/feeds/comment.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "comment.schema.json",
"type": "object",
"properties": {
"id": { "type": "string" },
"object_type": { "type": "string", "enum": ["activity"] },
"object_id": { "type": "string" },
"user_id": { "type": "string" },
"parent_id": { "type": "string" },
"text": { "type": "string" },
"status": {
"type": "string",
"enum": ["active", "deleted", "removed", "hidden"]
},
"attachments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": { "type": "string" },
"image_url": { "type": "string" },
"thumb_url": { "type": "string" },
"asset_url": { "type": "string" },
"migrate_resources": { "type": "boolean" },
"custom": { "type": "object" }
}
}
},
"mentioned_user_ids": {
"type": "array",
"items": { "type": "string" }
},
"custom": { "type": "object" },
"created_at": { "type": "string", "format": "date-time" },
"updated_at": { "type": "string", "format": "date-time" },
"deleted_at": { "type": "string", "format": "date-time" }
},
"required": ["id", "object_type", "object_id", "user_id", "text"]
}
24 changes: 24 additions & 0 deletions jsonschemas/feeds/feed.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "feed.schema.json",
"type": "object",
"properties": {
"group_id": { "type": "string" },
"id": { "type": "string" },
"fid": { "type": "string" },
"name": { "type": "string" },
"description": { "type": "string" },
"custom": { "type": "object" },
"filter_tags": {
"type": "array",
"items": { "type": "string" }
},
"visibility": { "type": "string" },
"created_by_id": { "type": "string" },
"created_at": { "type": "string", "format": "date-time" },
"updated_at": { "type": "string", "format": "date-time" },
"deleted_at": { "type": "string", "format": "date-time" },
"last_watched_at": { "type": "string", "format": "date-time" }
},
"required": ["group_id", "id", "fid", "created_by_id"]
}
28 changes: 28 additions & 0 deletions jsonschemas/feeds/feed_group.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "feed_group.schema.json",
"type": "object",
"properties": {
"id": { "type": "integer" },
"group_id": { "type": "string" },
"app_pk": { "type": "integer" },
"default_view_id": { "type": "string" },
"default_visibility": { "type": "string" },
"last_feed_get_at": { "type": ["string", "null"], "format": "date-time" },
"notification": { "type": "object", "additionalProperties": true },
"stories": { "type": "object", "additionalProperties": true },
"activity_processors": {
"type": "array"
},
"activity_selectors": {
"type": "array"
},
"ranking": { "type": "object", "additionalProperties": true },
"aggregation": { "type": "object", "additionalProperties": true },
"aggregation_version": { "type": "integer" },
"push_notification": { "type": "object", "additionalProperties": true },
"created_at": { "type": "string", "format": "date-time" },
"custom": { "type": "object" }
},
"required": ["group_id", "activity_selectors"]
}
26 changes: 26 additions & 0 deletions jsonschemas/feeds/follow.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "follow.schema.json",
"type": "object",
"properties": {
"source": { "type": "string" },
"target": { "type": "string" },
"status": {
"type": "string",
"enum": ["accepted", "pending", "rejected"]
},
"push_preference": {
"type": "string",
"enum": ["all", "none"]
},
"custom": { "type": "object" },
"request_accepted_at": { "type": "string", "format": "date-time" },
"request_rejected_at": { "type": "string", "format": "date-time" },
"created_at": { "type": "string", "format": "date-time" },
"updated_at": { "type": "string", "format": "date-time" },
"source_created_by_id": { "type": "string" },
"target_created_by_id": { "type": "string" },
"follower_role": { "type": "string" }
},
"required": ["source", "target"]
}
15 changes: 15 additions & 0 deletions jsonschemas/feeds/reaction.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "reaction.schema.json",
"type": "object",
"properties": {
"user_id": { "type": "string" },
"activity_id": { "type": "string" },
"comment_id": { "type": "string" },
"type": { "type": "string" },
"custom": { "type": "object" },
"created_at": { "type": "string", "format": "date-time" },
"updated_at": { "type": "string", "format": "date-time" }
},
"required": ["user_id", "activity_id", "type"]
}
Loading