From 7c960a4f2be27a5d805420d69b5d07b6bfb7e25c Mon Sep 17 00:00:00 2001 From: Victor Ikuomola Date: Fri, 8 Nov 2024 10:45:50 +0100 Subject: [PATCH] ref(async-gitlab): uses toString flag to convert numeric resource ids --- .../.port/resources/port-app-config.yml | 14 +++++++------- integrations/async-gitlab/gitlab/client.py | 18 ------------------ 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/integrations/async-gitlab/.port/resources/port-app-config.yml b/integrations/async-gitlab/.port/resources/port-app-config.yml index 2ab02bef23..97663e06d2 100644 --- a/integrations/async-gitlab/.port/resources/port-app-config.yml +++ b/integrations/async-gitlab/.port/resources/port-app-config.yml @@ -5,7 +5,7 @@ resources: port: entity: mappings: - identifier: .id + identifier: .id | tostring title: .name blueprint: '"gitlabGroup"' properties: @@ -18,7 +18,7 @@ resources: port: entity: mappings: - identifier: .id + identifier: .id | tostring title: .name blueprint: '"project"' properties: @@ -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: @@ -49,7 +49,7 @@ resources: link: .web_url reviewers: .reviewers relations: - project: .project_id + project: .project_id | tostring - kind: issue selector: @@ -57,7 +57,7 @@ resources: port: entity: mappings: - identifier: .id + identifier: .id | tostring title: .title blueprint: '"gitlabIssue"' properties: @@ -69,4 +69,4 @@ resources: creator: .author.name status: .state relations: - project: .project_id + project: .project_id | tostring diff --git a/integrations/async-gitlab/gitlab/client.py b/integrations/async-gitlab/gitlab/client.py index 415b67415a..45ffe5c724 100644 --- a/integrations/async-gitlab/gitlab/client.py +++ b/integrations/async-gitlab/gitlab/client.py @@ -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