Skip to content

Commit

Permalink
ref(async-gitlab): uses toString flag to convert numeric resource ids
Browse files Browse the repository at this point in the history
  • Loading branch information
victor-devv committed Nov 8, 2024
1 parent 00d253a commit 7c960a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 25 deletions.
14 changes: 7 additions & 7 deletions integrations/async-gitlab/.port/resources/port-app-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resources:
port:
entity:
mappings:
identifier: .id
identifier: .id | tostring
title: .name
blueprint: '"gitlabGroup"'
properties:
Expand All @@ -18,7 +18,7 @@ resources:
port:
entity:
mappings:
identifier: .id
identifier: .id | tostring
title: .name
blueprint: '"project"'
properties:
Expand All @@ -30,14 +30,14 @@ resources:
fullPath: .path_with_namespace
defaultBranch: .default_branch
relations:
group: .namespace.id
group: .namespace.id | tostring
- kind: merge_request
selector:
query: 'true'
port:
entity:
mappings:
identifier: .id
identifier: .id | tostring
title: .title
blueprint: '"gitlabMergeRequest"'
properties:
Expand All @@ -49,15 +49,15 @@ resources:
link: .web_url
reviewers: .reviewers
relations:
project: .project_id
project: .project_id | tostring

- kind: issue
selector:
query: 'true'
port:
entity:
mappings:
identifier: .id
identifier: .id | tostring
title: .title
blueprint: '"gitlabIssue"'
properties:
Expand All @@ -69,4 +69,4 @@ resources:
creator: .author.name
status: .state
relations:
project: .project_id
project: .project_id | tostring
18 changes: 0 additions & 18 deletions integrations/async-gitlab/gitlab/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,22 +119,4 @@ async def get_resources(
resource_type=resource_type,
query_params=query_params
):
for resource in resources:
if 'id' in resource:
resource['id'] = str(resource['id'])

# Additional processing based on the resource type
match resource_type:
case ObjectKind.PROJECT:
if 'namespace' in resource and 'id' in resource['namespace']:
resource['namespace']['id'] = str(resource['namespace']['id'])

case ObjectKind.MERGE_REQUEST:
if 'project_id' in resource:
resource['project_id'] = str(resource['project_id'])

case ObjectKind.ISSUE:
if 'project_id' in resource:
resource['project_id'] = str(resource['project_id'])

yield resources

0 comments on commit 7c960a4

Please sign in to comment.