Skip to content

Commit cd0b98c

Browse files
[FEEDS-0] updated feeds jsonschems
1 parent da135fe commit cd0b98c

11 files changed

Lines changed: 321 additions & 90 deletions

jsonschemas/feeds/activity.schema.json

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,61 @@
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"$id": "activity.schema.json",
44
"type": "object",
5+
"description": "Activity entity for feeds import.",
6+
"required": ["id", "type", "user_id", "fids"],
57
"properties": {
6-
"id": { "type": "string" },
7-
"type": { "type": "string" },
8-
"user_id": { "type": "string" },
8+
"id": { "type": "string", "minLength": 1 },
9+
"type": {
10+
"type": "string",
11+
"minLength": 1,
12+
"description": "Activity type, e.g. 'post', 'photo'."
13+
},
14+
"user_id": { "type": "string", "minLength": 1 },
915
"fids": {
1016
"type": "array",
11-
"items": { "type": "string" }
17+
"items": { "type": "string", "minLength": 1 },
18+
"minItems": 1,
19+
"description": "List of feed IDs (fids) this activity is posted to."
1220
},
1321
"text": { "type": "string" },
1422
"attachments": {
1523
"type": "array",
1624
"items": {
1725
"type": "object",
1826
"properties": {
19-
"type": { "type": "string" },
20-
"image_url": { "type": "string" },
21-
"thumb_url": { "type": "string" },
22-
"asset_url": { "type": "string" },
27+
"type": {
28+
"type": "string",
29+
"description": "e.g. text, image, audio, video, file, poll."
30+
},
31+
"image_url": {
32+
"type": "string",
33+
"format": "uri",
34+
"pattern": "^https://"
35+
},
36+
"thumb_url": {
37+
"type": "string",
38+
"format": "uri",
39+
"pattern": "^https://"
40+
},
41+
"asset_url": {
42+
"type": "string",
43+
"format": "uri",
44+
"pattern": "^https://"
45+
},
2346
"migrate_resources": { "type": "boolean" },
24-
"custom": { "type": "object" }
47+
"custom": { "type": "object", "additionalProperties": true }
2548
}
2649
}
2750
},
28-
"visibility": { "type": "string" },
29-
"visibility_tag": { "type": "string" },
51+
"visibility": {
52+
"type": "string",
53+
"enum": ["public", "private", "tag"],
54+
"description": "Defaults to 'public' when empty."
55+
},
56+
"visibility_tag": {
57+
"type": "string",
58+
"description": "Required semantics when visibility='tag' (enforced at runtime, not in schema)."
59+
},
3060
"location": {
3161
"type": "object",
3262
"properties": {
@@ -41,7 +71,7 @@
4171
},
4272
"parent_id": { "type": "string" },
4373
"poll_id": { "type": "string" },
44-
"custom": { "type": "object" },
74+
"custom": { "type": "object", "additionalProperties": true },
4575
"created_at": { "type": "string", "format": "date-time" },
4676
"updated_at": { "type": "string", "format": "date-time" },
4777
"edited_at": { "type": "string", "format": "date-time" },
@@ -53,7 +83,11 @@
5383
"interest_tags": {
5484
"type": "array",
5585
"items": { "type": "string" }
86+
},
87+
"collection_refs": {
88+
"type": "array",
89+
"items": { "type": "string" },
90+
"description": "Collection IDs this activity references."
5691
}
57-
},
58-
"required": ["id", "type", "user_id", "fids"]
92+
}
5993
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "bookmark.schema.json",
4+
"type": "object",
5+
"description": "Bookmark entity for feeds import. Use 'object_id' (with optional 'object_type'). 'activity_id' is supported for backward compatibility only. See importer/v2/items/bookmark.go.",
6+
"required": ["user_id"],
7+
"properties": {
8+
"user_id": { "type": "string", "minLength": 1 },
9+
"object_id": {
10+
"type": "string",
11+
"description": "ID of the bookmarked object (activity or comment)."
12+
},
13+
"object_type": {
14+
"type": "string",
15+
"enum": ["activity", "comment"],
16+
"default": "activity",
17+
"description": "Type of the bookmarked object. Defaults to 'activity' when empty."
18+
},
19+
"activity_id": {
20+
"type": "string",
21+
"deprecated": true,
22+
"description": "Deprecated: use 'object_id'. If 'object_id' is empty, 'activity_id' is copied over for backward compatibility."
23+
},
24+
"folder_id": { "type": "string" },
25+
"custom": { "type": "object", "additionalProperties": true },
26+
"created_at": { "type": "string", "format": "date-time" },
27+
"updated_at": { "type": "string", "format": "date-time" }
28+
},
29+
"anyOf": [
30+
{ "required": ["object_id"] },
31+
{ "required": ["activity_id"] }
32+
]
33+
}

jsonschemas/feeds/collection.schema.json

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"$id": "collection.schema.json",
44
"type": "object",
5+
"description": "Collection entity for feeds import.",
6+
"required": ["name", "id", "custom"],
57
"properties": {
6-
"name": { "type": "string" },
7-
"id": { "type": "string" },
8+
"name": { "type": "string", "minLength": 1 },
9+
"id": { "type": "string", "minLength": 1 },
810
"user_id": { "type": "string" },
9-
"custom": { "type": "object" },
11+
"custom": {
12+
"type": "object",
13+
"minProperties": 1,
14+
"additionalProperties": true,
15+
"description": "Must contain at least one key."
16+
},
1017
"created_at": { "type": "string", "format": "date-time" },
1118
"updated_at": { "type": "string", "format": "date-time" },
1219
"deleted_at": { "type": "string", "format": "date-time" }
13-
},
14-
"required": ["name", "id"]
20+
}
1521
}

jsonschemas/feeds/comment.schema.json

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,60 @@
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"$id": "comment.schema.json",
44
"type": "object",
5+
"description": "Comment entity for feeds import.",
6+
"required": ["id", "object_type", "object_id", "user_id", "text"],
57
"properties": {
6-
"id": { "type": "string" },
7-
"object_type": { "type": "string", "enum": ["activity"] },
8-
"object_id": { "type": "string" },
9-
"user_id": { "type": "string" },
10-
"parent_id": { "type": "string" },
11-
"text": { "type": "string" },
8+
"id": { "type": "string", "minLength": 1 },
9+
"object_type": {
10+
"type": "string",
11+
"enum": ["activity"],
12+
"description": "Currently only 'activity' is supported for imported comments."
13+
},
14+
"object_id": { "type": "string", "minLength": 1 },
15+
"user_id": { "type": "string", "minLength": 1 },
16+
"parent_id": {
17+
"type": ["string", "null"],
18+
"description": "ID of the parent comment when this is a reply."
19+
},
20+
"text": { "type": "string", "minLength": 1 },
1221
"status": {
1322
"type": "string",
14-
"enum": ["active", "deleted", "removed", "hidden"]
23+
"enum": ["active", "deleted", "removed", "hidden"],
24+
"default": "active"
1525
},
1626
"attachments": {
1727
"type": "array",
1828
"items": {
1929
"type": "object",
2030
"properties": {
2131
"type": { "type": "string" },
22-
"image_url": { "type": "string" },
23-
"thumb_url": { "type": "string" },
24-
"asset_url": { "type": "string" },
32+
"image_url": {
33+
"type": "string",
34+
"format": "uri",
35+
"pattern": "^https://"
36+
},
37+
"thumb_url": {
38+
"type": "string",
39+
"format": "uri",
40+
"pattern": "^https://"
41+
},
42+
"asset_url": {
43+
"type": "string",
44+
"format": "uri",
45+
"pattern": "^https://"
46+
},
2547
"migrate_resources": { "type": "boolean" },
26-
"custom": { "type": "object" }
48+
"custom": { "type": "object", "additionalProperties": true }
2749
}
2850
}
2951
},
3052
"mentioned_user_ids": {
3153
"type": "array",
3254
"items": { "type": "string" }
3355
},
34-
"custom": { "type": "object" },
56+
"custom": { "type": "object", "additionalProperties": true },
3557
"created_at": { "type": "string", "format": "date-time" },
3658
"updated_at": { "type": "string", "format": "date-time" },
3759
"deleted_at": { "type": "string", "format": "date-time" }
38-
},
39-
"required": ["id", "object_type", "object_id", "user_id", "text"]
60+
}
4061
}

jsonschemas/feeds/feed.schema.json

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,32 @@
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"$id": "feed.schema.json",
44
"type": "object",
5+
"description": "Feed entity for feeds import.",
6+
"required": ["group_id", "id", "fid", "created_by_id"],
57
"properties": {
6-
"group_id": { "type": "string" },
7-
"id": { "type": "string" },
8-
"fid": { "type": "string" },
8+
"group_id": { "type": "string", "minLength": 1 },
9+
"id": { "type": "string", "minLength": 1 },
10+
"fid": {
11+
"type": "string",
12+
"minLength": 1,
13+
"description": "Fully-qualified feed id, typically '{group_id}:{id}'."
14+
},
915
"name": { "type": "string" },
1016
"description": { "type": "string" },
11-
"custom": { "type": "object" },
17+
"custom": { "type": "object", "additionalProperties": true },
1218
"filter_tags": {
1319
"type": "array",
1420
"items": { "type": "string" }
1521
},
16-
"visibility": { "type": "string" },
17-
"created_by_id": { "type": "string" },
22+
"visibility": {
23+
"type": "string",
24+
"enum": ["public", "visible", "followers", "members", "private"],
25+
"description": "Defaults to 'visible' when empty."
26+
},
27+
"created_by_id": { "type": "string", "minLength": 1 },
1828
"created_at": { "type": "string", "format": "date-time" },
1929
"updated_at": { "type": "string", "format": "date-time" },
2030
"deleted_at": { "type": "string", "format": "date-time" },
2131
"last_watched_at": { "type": "string", "format": "date-time" }
22-
},
23-
"required": ["group_id", "id", "fid", "created_by_id"]
32+
}
2433
}

jsonschemas/feeds/feed_group.schema.json

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,28 @@
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"$id": "feed_group.schema.json",
44
"type": "object",
5+
"description": "FeedGroup entity for feeds import.",
6+
"required": ["group_id"],
57
"properties": {
68
"id": { "type": "integer" },
7-
"group_id": { "type": "string" },
9+
"group_id": { "type": "string", "minLength": 1 },
810
"app_pk": { "type": "integer" },
911
"default_view_id": { "type": "string" },
10-
"default_visibility": { "type": "string" },
12+
"default_visibility": {
13+
"type": "string",
14+
"enum": ["", "public", "visible", "followers", "members", "private"],
15+
"description": "Default feed visibility for feeds in this group. Falls back to the global default when empty."
16+
},
1117
"last_feed_get_at": { "type": ["string", "null"], "format": "date-time" },
1218
"notification": { "type": "object", "additionalProperties": true },
1319
"stories": { "type": "object", "additionalProperties": true },
14-
"activity_processors": {
15-
"type": "array"
16-
},
17-
"activity_selectors": {
18-
"type": "array"
19-
},
20+
"activity_processors": { "type": "array" },
21+
"activity_selectors": { "type": "array" },
2022
"ranking": { "type": "object", "additionalProperties": true },
2123
"aggregation": { "type": "object", "additionalProperties": true },
2224
"aggregation_version": { "type": "integer" },
2325
"push_notification": { "type": "object", "additionalProperties": true },
2426
"created_at": { "type": "string", "format": "date-time" },
25-
"custom": { "type": "object" }
26-
},
27-
"required": ["group_id", "activity_selectors"]
27+
"custom": { "type": "object", "additionalProperties": true }
28+
}
2829
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "feed_view.schema.json",
4+
"type": "object",
5+
"description": "FeedView entity for feeds import.",
6+
"required": ["view_id"],
7+
"properties": {
8+
"view_id": { "type": "string", "minLength": 1 },
9+
"app_pk": { "type": "integer" },
10+
"activity_selectors": { "type": "array" },
11+
"ranking": { "type": "object", "additionalProperties": true },
12+
"aggregation": { "type": "object", "additionalProperties": true },
13+
"aggregation_version": { "type": "integer" },
14+
"last_feed_get_at": { "type": ["string", "null"], "format": "date-time" },
15+
"created_at": { "type": "string", "format": "date-time" }
16+
}
17+
}

jsonschemas/feeds/follow.schema.json

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,37 @@
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"$id": "follow.schema.json",
44
"type": "object",
5+
"description": "Follow entity for feeds import. 'source_fid' and 'target_fid' must differ (enforced at runtime).",
6+
"required": ["source_fid", "target_fid"],
57
"properties": {
6-
"source_fid": { "type": "string" },
7-
"target_fid": { "type": "string" },
8+
"source_fid": { "type": "string", "minLength": 1 },
9+
"target_fid": { "type": "string", "minLength": 1 },
810
"status": {
911
"type": "string",
10-
"enum": ["accepted", "pending", "rejected"]
12+
"enum": ["accepted", "pending", "rejected"],
13+
"default": "accepted"
1114
},
1215
"push_preference": {
1316
"type": "string",
14-
"enum": ["all", "none"]
17+
"enum": ["all", "none"],
18+
"default": "none"
1519
},
16-
"custom": { "type": "object" },
20+
"custom": { "type": "object", "additionalProperties": true },
1721
"request_accepted_at": { "type": "string", "format": "date-time" },
1822
"request_rejected_at": { "type": "string", "format": "date-time" },
1923
"created_at": { "type": "string", "format": "date-time" },
2024
"updated_at": { "type": "string", "format": "date-time" },
21-
"source_created_by_id": { "type": "string" },
22-
"target_created_by_id": { "type": "string" },
23-
"follower_role": { "type": "string" }
24-
},
25-
"required": ["source", "target"]
25+
"source_created_by_id": {
26+
"type": "string",
27+
"description": "User ID of the creator of the source feed."
28+
},
29+
"target_created_by_id": {
30+
"type": "string",
31+
"description": "User ID of the creator of the target feed."
32+
},
33+
"follower_role": {
34+
"type": "string",
35+
"description": "Role assigned to the follower. Defaults to the 'feed_follower' role when empty."
36+
}
37+
}
2638
}

0 commit comments

Comments
 (0)