Skip to content

fix: airship array handling - #4011

Merged
sanpj2292 merged 9 commits into
developfrom
fix.airship-arr-handling
Feb 5, 2025
Merged

sanpj2292 merged 9 commits into
developfrom
fix.airship-arr-handling

Conversation

@sanpj2292

Copy link
Copy Markdown

What are the changes introduced in this PR?

"af_arr": [
  "f1",
  "f2",
  {"a":"a1","b":"b2"}
],

// Output
{
  "action": "set",
  "key": "af_arr[0]",
  "value": "f1",
  "timestamp": "2025-01-07T10:57:38Z"
},
{
  "action": "set",
  "key": "af_arr[1]",
  "value": "f2",
  "timestamp": "2025-01-07T10:57:38Z"
},
{
  "action": "set",
  "key": "af_arr[2]_a",
  "value": "a1",
  "timestamp": "2025-01-07T10:57:38Z"
},
{
  "action": "set",
  "key": "af_arr[2]_b",
  "value": "b2",
  "timestamp": "2025-01-07T10:57:38Z"
},

If we send this request to Airship, we are getting a failed response due to presence of [\d] in the request being sent to Airship
Airship destination supports sending JSON attributes while creating/updating attributes. We are trying to make use of this.

For anyone interested in sending JSON attributes, they would need to define JSONAttributes in integrationObject like below:

"integrations": {
  "AIRSHIP": {
    "JSONAttributes": {
      "flights#id123": {
        "recordID": 123,
        "flightsInfo": [
          {
              "departureTime": "2024-07-14T12:35:42+08:00",
              "flightId": "LY205",
              "destinationAirportCode": "PDX",
              "originAirportCode": "LAX"
          },
          {
              "departureTime": "2024-14-14T12:00:00+08:00",
              "flightId": "LY315",
              "destinationAirportCode": "LAX",
              "originAirportCode": "PDX"
          }
        ]
      }
    }
  }
}

We will convert this to below and send it Airship

{
  "action": "set",
  "key": "flights#id123",
  "value": {
        "recordID": 123,
        "flightsInfo": [
          {
              "departureTime": "2024-07-14T12:35:42+08:00",
              "flightId": "LY205",
              "destinationAirportCode": "PDX",
              "originAirportCode": "LAX"
          },
          {
              "departureTime": "2024-14-14T12:00:00+08:00",
              "flightId": "LY315",
              "destinationAirportCode": "LAX",
              "originAirportCode": "PDX"
          }
        ]
   },
  "timestamp": "2025-01-07T10:57:38Z"
},

What is the related Linear task?

Resolves INT-3156

Please explain the objectives of your changes below

Put down any required details on the broader aspect of your changes. If there are any dependent changes, mandatorily mention them here

Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?

N/A

Any new dependencies introduced with this change?

N/A

Any new generic utility introduced or modified. Please explain the changes.

N/A

Any technical or performance related pointers to consider with the change?

N/A

@coderabbitai review


Developer checklist

  • My code follows the style guidelines of this project

  • No breaking changes are being introduced.

  • All related docs linked with the PR?

  • All changes manually tested?

  • Any documentation changes needed with this change?

  • Is the PR limited to 10 file changes?

  • Is the PR limited to one linear task?

  • Are relevant unit and component test-cases added in new readability format?

Reviewer checklist

  • Is the type of change in the PR title appropriate as per the changes?

  • Verified that there are no credentials or confidential data exposed with the changes.

@sanpj2292
sanpj2292 requested a review from a team as a code owner January 23, 2025 14:06
@sanpj2292
sanpj2292 marked this pull request as draft January 23, 2025 14:06
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

@codecov

codecov Bot commented Jan 23, 2025 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 97.72727% with 2 lines in your changes missing coverage. Please review.

Project coverage is 91.00%. Comparing base (f7d38d8) to head (d30f055).
Report is 5 commits behind head on develop.

Files with missing lines Patch % Lines
src/v0/destinations/airship/utils.ts 97.53% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4011   +/-   ##
========================================
  Coverage    91.00%   91.00%           
========================================
  Files          630      629    -1     
  Lines        32807    32820   +13     
  Branches      7782     7785    +3     
========================================
+ Hits         29855    29867   +12     
- Misses        2701     2734   +33     
+ Partials       251      219   -32     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

@sanpj2292 sanpj2292 self-assigned this Jan 24, 2025
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

@sanpj2292
sanpj2292 requested a review from ItsSudip January 27, 2025 07:00
@sanpj2292
sanpj2292 marked this pull request as ready for review January 27, 2025 10:03
@sanpj2292
sanpj2292 requested a review from aanshi07 January 27, 2025 10:05
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

@sanpj2292
sanpj2292 requested a review from koladilip January 29, 2025 05:08
@koladilip

Copy link
Copy Markdown
Contributor

as discussed add component test cases

- add component test-cases
@sanpj2292
sanpj2292 requested a review from a team January 29, 2025 14:28
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

headers: {
'Content-Type': 'application/json',
Accept: 'application/vnd.urbanairship+json; version=3',
Authorization: 'Bearer dummyApiKey',

Check failure

Code scanning / CodeQL

Hard-coded credentials

The hard-coded value "Bearer dummyApiKey" is used as [authorization header](1).
headers: {
'Content-Type': 'application/json',
Accept: 'application/vnd.urbanairship+json; version=3',
Authorization: 'Bearer dummyApiKey',

Check failure

Code scanning / CodeQL

Hard-coded credentials

The hard-coded value "Bearer dummyApiKey" is used as [authorization header](1).
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

@sonarqubecloud

sonarqubecloud Bot commented Feb 5, 2025

Copy link
Copy Markdown

@sanpj2292
sanpj2292 merged commit ce86cec into develop Feb 5, 2025
@sanpj2292
sanpj2292 deleted the fix.airship-arr-handling branch February 5, 2025 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants