forked from MeltanoLabs/tap-github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema_objects.py
More file actions
61 lines (55 loc) · 2.16 KB
/
schema_objects.py
File metadata and controls
61 lines (55 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"""Reusable schema objects for tap-github.
Below are a few common patterns in the github API
factored out as reusable objects. They help in making the
schema more readable and error-free.
"""
from singer_sdk import typing as th # JSON Schema typing helpers
# This user object is common throughout the API results
user_object = th.ObjectType(
th.Property("login", th.StringType),
th.Property("id", th.IntegerType),
th.Property("node_id", th.StringType),
th.Property("avatar_url", th.StringType),
th.Property("gravatar_id", th.StringType),
th.Property("html_url", th.StringType),
th.Property("type", th.StringType),
th.Property("site_admin", th.BooleanType),
)
# some objects are shared between issues and pull requests
label_object = th.ObjectType(
th.Property("id", th.IntegerType),
th.Property("node_id", th.StringType),
th.Property("url", th.StringType),
th.Property("name", th.StringType),
th.Property("description", th.StringType),
th.Property("color", th.StringType),
th.Property("default", th.BooleanType),
)
milestone_object = th.ObjectType(
th.Property("html_url", th.StringType),
th.Property("node_id", th.StringType),
th.Property("id", th.IntegerType),
th.Property("number", th.IntegerType),
th.Property("state", th.StringType),
th.Property("title", th.StringType),
th.Property("description", th.StringType),
th.Property("creator", user_object),
th.Property("open_issues", th.IntegerType),
th.Property("closed_issues", th.IntegerType),
th.Property("created_at", th.DateTimeType),
th.Property("updated_at", th.DateTimeType),
th.Property("closed_at", th.DateTimeType),
th.Property("due_on", th.DateTimeType),
)
reactions_object = th.ObjectType(
th.Property("url", th.StringType),
th.Property("total_count", th.IntegerType),
th.Property("plus_one", th.IntegerType),
th.Property("minus_one", th.IntegerType),
th.Property("laugh", th.IntegerType),
th.Property("hooray", th.IntegerType),
th.Property("confused", th.IntegerType),
th.Property("heart", th.IntegerType),
th.Property("rocket", th.IntegerType),
th.Property("eyes", th.IntegerType),
)