Skip to content

Remove camelCase conversion in DF methods [PLT-99360]#327

Open
Sarath1018 wants to merge 4 commits intomainfrom
sarath/getRecordById
Open

Remove camelCase conversion in DF methods [PLT-99360]#327
Sarath1018 wants to merge 4 commits intomainfrom
sarath/getRecordById

Conversation

@Sarath1018
Copy link
Copy Markdown
Contributor

@Sarath1018 Sarath1018 commented Mar 26, 2026

Remove camelCase conversion in Data Fabric entity record methods PLT-99360

Background

The Data Fabric API returns entity record fields in PascalCase (e.g., Id, CreateTime, RecordOwner). The SDK was previously converting all response keys to camelCase via pascalToCamelCaseKeys(), which mangled user-defined field names — a field named RecordOwner in the schema would silently become recordOwner in the SDK response.

Per a request from the Data Fabric team, the SDK now returns record data exactly as the API sends it, with no case conversion.

Changes

pascalToCamelCaseKeys() and EntityRecordMap transformation removed from the following methods — all now return response.data as-is:

Method Before After
getRecordById Converted to camelCase Returns raw API response
insertRecordById Converted to camelCase Returns raw API response
updateRecordById Converted to camelCase Returns raw API response
uploadAttachment Converted to camelCase Returns raw API response
insertRecordsById Converted successRecords to camelCase Returns raw API response
updateRecordsById Converted successRecords to camelCase Returns raw API response
deleteRecordsById No transform (was missing) Returns raw API response

downloadAttachment and deleteAttachment return binary/status responses with no record fields — no change needed.

EntityRecord.id renamed to EntityRecord.Id to match the actual API response key.

JSDoc examples updated across entities.models.ts and entities.ts to use record.Id instead of record.id.

Tests updated:

  • Unit service tests: mock data aligned to raw API format (PascalCase Id)
  • Unit model tests: assertions updated to record.Id, record.RecordOwner
  • Integration tests: update payload builders use { Id: id }, removed r.Id || r.id fallback to just r.Id
  • Mock helpers: createMockEntityRecords override uses Id instead of id

SDK response example (after change)

{
  "Id": "A378D039-D312-F111-832E-000D3A58D4AA",
  "CreatedBy": "5C8E90E3-7E35-45F5-B3C6-1A212A642246",
  "CreateTime": "2026-02-26T05:23:04.7946618+00:00",
  "UpdatedBy": "5C8E90E3-7E35-45F5-B3C6-1A212A642246",
  "UpdateTime": "2026-02-26T05:25:35.5379904+00:00",
  "RecordOwner": "5C8E90E3-7E35-45F5-B3C6-1A212A642246",
  "SarathReddy": "489F068F-D312-F111-832E-000D3A58D4AA"
}

All fields are returned verbatim from the API — no case conversion applied.

@Sarath1018 Sarath1018 requested a review from a team March 26, 2026 05:15
@Sarath1018 Sarath1018 changed the title Remove camelCase conversion in getRecordById Remove camelCase conversion in getRecordById [PLT-97256] Mar 26, 2026
@Sarath1018 Sarath1018 force-pushed the sarath/getRecordById branch from b9f9ce9 to ff1089c Compare March 27, 2026 04:10
@Sarath1018 Sarath1018 changed the title Remove camelCase conversion in getRecordById [PLT-97256] Remove camelCase conversion in DF methods [PLT-99360] Mar 27, 2026
@Sarath1018 Sarath1018 force-pushed the sarath/getRecordById branch from ff1089c to a06c5a7 Compare March 27, 2026 04:46
@Sarath1018 Sarath1018 force-pushed the sarath/getRecordById branch from a06c5a7 to ebbd3b7 Compare March 27, 2026 04:53
ninja-shreyash
ninja-shreyash previously approved these changes Mar 27, 2026
@ninja-shreyash ninja-shreyash dismissed their stale review March 27, 2026 08:33

need to re-review

@Sarath1018 Sarath1018 force-pushed the sarath/getRecordById branch from e261c7d to 385f5f3 Compare April 1, 2026 12:27
@Sarath1018 Sarath1018 force-pushed the sarath/getRecordById branch from f550c0c to b0849a3 Compare April 2, 2026 05:15
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 2, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to update here

expect(record.recordOwner).toHaveProperty('id');

If yes, the mock might need updating?
expanded[field] = { id: expanded[field] as string };

Comment on lines +432 to +433
.filter((r: any) => r.Id)
.map((r: any) => r.Id);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit : now we could just do this right -

.filter((r) => r.Id)
.map((r) => r.Id);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants