Skip to content

Commit

Permalink
Merge pull request #4 from Matatika/fix/logs-scope-typing
Browse files Browse the repository at this point in the history
Fixed logs endpoint typing for scope
  • Loading branch information
DanielPDWalker authored Mar 23, 2022
2 parents 2370969 + 3dafc2d commit 80dc476
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tap_auth0/schemas/log.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from singer_sdk.typing import (
ArrayType,
BooleanType,
DateTimeType,
ObjectType,
Expand Down Expand Up @@ -47,7 +48,7 @@ class LogObject(CustomObject):
Property("user_id", StringType),
Property("user_name", StringType),
Property("audience", StringType),
Property("scope", StringType),
Property("scope", ArrayType(StringType)),
Property("strategy", StringType),
Property("strategy_type", StringType),
Property("log_id", StringType),
Expand Down
7 changes: 7 additions & 0 deletions tap_auth0/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,10 @@ def validate_response(self, response: requests.Response) -> None:

def parse_response(self, response: requests.Response) -> Iterable[dict]:
return [] if self.log_expired else super().parse_response(response)

def post_process(self, row: dict, context: Optional[dict] = None) -> Optional[dict]:
row = super().post_process(row, context)
scope = row.get("scope")
if isinstance(scope, str):
row.update({ "scope": scope.split() })
return row

0 comments on commit 80dc476

Please sign in to comment.