openapi-codegen icon indicating copy to clipboard operation
openapi-codegen copied to clipboard

Add `camelizedQueryParams` option

Open fabien0102 opened this issue 3 years ago • 1 comments

The idea will be to camelized every queryParams in the generated components/fetchers to improve the DX.

To have this working, we also need to generate a bit of extra logic in the fetcher if camel(name) !== name

export const fetchGetBaseBranchStats = (variables: GetBaseBranchStatsVariables) =>
  xatabaseFetch<GetBaseBranchStatsResponse, undefined, {}, GetBaseBranchStatsQueryParams, GetBaseBranchStatsPathParams>(
    { url: '/db/{basebranchName}/stats', method: 'get', ...variables, queryParams: {/* map to original names */} }
  );

fabien0102 avatar Jan 14 '22 16:01 fabien0102

@fabien0102 do you still want this? IMO queryParams or any other params should match with OpenAPI spec to be consistent.

needim avatar Sep 23 '22 15:09 needim