-
Notifications
You must be signed in to change notification settings - Fork 271
Update validations in core #2934
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2934 +/- ##
==========================================
+ Coverage 78.07% 78.67% +0.59%
==========================================
Files 1064 1117 +53
Lines 19612 22412 +2800
Branches 3767 4524 +757
==========================================
+ Hits 15313 17633 +2320
- Misses 3015 3489 +474
- Partials 1284 1290 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@@ -749,7 +749,7 @@ describe('destination kit', () => { | |||
|
|||
expect(res).toEqual([ | |||
{ | |||
multistatus: [{ body: {}, sent: {}, status: 200 }] | |||
multistatus: [{ body: {}, sent: { __segment_internal_sync_mode: 'add' }, status: 200 }] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes me a little worried. Why is adding the internal field in sent
required here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is because of this condition. Basically the tests don't have schema definition, thats why the internal fields are not removed by validateSchema()
. To fix this, We can either add schema to the test, or remove the internal fields here and then add the internal fields back before validateSchema()
This PR aims to achieve 2 things:-
validateSchema()
(We have use cases for the same. Refer to STRATCONN-5861 and STRATCONN-4327)__segment_internal_sync_mode
,__segment_internal_matching_key
) for mapping validations: In braze-cloud'supsertCatalogItem
we have a field which is required for a certainsyncMode
(upsert). To run this validation, we need to allow internal field validation while not exposing the internal fields in the payload (this block already takes care of that. Refer ajv docs).Testing
Sample Mapping Config:
Here it can be seen that

item
object is required only case of"__segment_internal_sync_mode": "upsert"
Sample API test when item object is passed
As
item
object is present, API doesn't throw any errorsSample API test when item object is not passed
API throws error