techniq / odata-query

OData v4 query builder
https://www.npmjs.com/package/odata-query
MIT License
225 stars 56 forks source link

Automatically Title-Case Camel-Cased props #101

Open cda210 opened 2 years ago

cda210 commented 2 years ago

So to better enforce type safety in a project - a developer may want to say let's only allow a string that adheres to keyof some TYPE for OData operations $orderBy or $filter- the issue is that keys of some TYPE are usually camelCased, but OData wants prop names in TitleCase format. Does it make sense to enhance buildQuery to properly format a camelCased "key" into a valid odata prop name that is TitleCased?

cda210 commented 2 years ago

Any advice on strongly typing what can be filtered, for example, would be appreciated. This may not be an issue as I was able to pass in keyof and use the camelCase propName and get appropriate results.