jetstreamapp / soql-parser-js

Javascript SOQL parser
https://jetstreamapp.github.io/soql-parser-js/
MIT License
79 stars 20 forks source link

QUESTION - Is soql-parser-js case-sensitive regarding some operations on sObjectName ? #109

Closed AltiusRupert closed 4 years ago

AltiusRupert commented 4 years ago

Description

I use the SFDX-Data-Move-Utility SFDX CLI plugin (https://github.com/forcedotcom/SFDX-Data-Move-Utility) which uses your module. It has some strange behaviour which seems to be related to sObjectName case-sentivity.

Is anything regarding sObjectName in soql-parser-js case-sensitive ?

paustint commented 4 years ago

@AltiusRupert - sorry for the delay, I did not notice that you had filed this issue.

This library will not modify the case of any sobjects or fields because we do not have a way to know what the proper case is. The Salesforce API returns data as JSON in the correct case as configured in your org - so any post-processing of data outside of Salesforce will always be 100% case-sensitive by default.

I am not sure exactly how SFDX-Data-Move-Utility is using this library, but soql-parser-js will return the SObject from a query the same way that you provide it (which may not be correct based on SFDC). I would advise you to ALWAYS use the proper case of all fields and SObjects as javascript and JSON are both case-sensitive languages, even though SFDC is not.

SFDX-Data-Move-Utility could probably convert everything to lower or uppercase to normalize the case-sensitivity, but this may not be feasible in all cases.

Does this help, or do you have any other follow-up questions?