-
Notifications
You must be signed in to change notification settings - Fork 312
[MAIN] [STRATCONN] Added validation on external_id of character 255 #3777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
82eabd0
e869df2
f462239
76b89a2
8b8bac3
ca65e65
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,8 +30,10 @@ export const email: InputField = { | |
|
|
||
| export const external_id: InputField = { | ||
| label: 'External ID', | ||
| description: `A unique identifier used by customers to associate Klaviyo profiles with profiles in an external system. One of External ID and Email required.`, | ||
| type: 'string' | ||
| description: `A unique identifier used by customers to associate Klaviyo profiles with profiles in an external system. One of External ID, Email or Phone Number is required. Must not exceed 255 characters.`, | ||
| type: 'string', | ||
| minimum: 0, | ||
| maximum: 255 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Caution Bug:
The framework's Fix: Remove export const external_id: InputField = {
label: 'External ID',
description: `A unique identifier used by customers to associate Klaviyo profiles with profiles in an external system. One of External ID and Email required. Must not exceed 255 characters.`,
type: 'string'
// 255-char limit enforced at runtime by validateExternalId()
}
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The framework's The Keeping Updated the description to mention Phone Number as a valid identifier alternative. |
||
| } | ||
|
|
||
| export const enable_batching: InputField = { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| import nock from 'nock' | ||
| import { createTestEvent, createTestIntegration } from '@segment/actions-core' | ||
| import { AggregateAjvError } from '@segment/ajv-human-errors' | ||
| import Definition from '../../index' | ||
| import { API_URL } from '../../config' | ||
| import { AggregateAjvError } from '@segment/ajv-human-errors' | ||
|
|
||
| const testDestination = createTestIntegration(Definition) | ||
|
|
||
|
|
@@ -25,6 +25,22 @@ describe('Remove List from Profile', () => { | |
| ) | ||
| }) | ||
|
|
||
| it('should throw error if external_id exceeds 255 characters', async () => { | ||
| const event = createTestEvent({ | ||
| type: 'track', | ||
| properties: {} | ||
| }) | ||
|
|
||
| const mapping = { | ||
| list_id: listId, | ||
| external_id: 'a'.repeat(256) | ||
| } | ||
|
|
||
| await expect( | ||
| testDestination.testAction('removeProfileFromList', { event, mapping, settings }) | ||
| ).rejects.toThrowError(AggregateAjvError) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Warning Inconsistency: this test expects Every other new external_id test added in this PR ( .rejects.toThrowError('Length of external_id must be no more than 255 characters.')This test expects The user sees an opaque schema error rather than the intended descriptive message. Fix: After removing await expect(
testDestination.testAction('removeProfileFromList', { event, mapping, settings })
).rejects.toThrowError('Length of external_id must be no more than 255 characters.')
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The This is consistent with how Both approaches reject invalid input — schema-level is just earlier in the pipeline. |
||
| }) | ||
|
|
||
| it('should throw an error for invalid phone number format', async () => { | ||
| const event = createTestEvent({ | ||
| type: 'track', | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.