Skip to content

Commit

Permalink
Remove unnecessary camel case conversion for query params
Browse files Browse the repository at this point in the history
  • Loading branch information
nicky1038 authored and smorimoto committed Feb 12, 2025
1 parent 6afe406 commit 0a71f2b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/rude-impalas-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"swagger-typescript-api": patch
---

Remove unnecessary camel case conversion for query params.
10 changes: 1 addition & 9 deletions src/schema-routes/schema-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -512,21 +512,13 @@ export class SchemaRoutes {
(objectSchema, schemaPart) => {
if (!schemaPart || !schemaPart.name) return objectSchema;

let usageName = `${schemaPart.name}`;

if (usageName.includes(".")) {
usageName = lodash.camelCase(usageName);
}

return {
...objectSchema,
properties: {
...objectSchema.properties,
[usageName]: {
[schemaPart.name]: {
...schemaPart,
...(schemaPart.schema || {}),
$origName: schemaPart.name,
name: usageName,
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
reproFunc: (
truckId: string,
query: {
queryId: string;
"query.id": string;
},
params: RequestParams = {},
) =>
Expand Down
4 changes: 2 additions & 2 deletions tests/spec/sortTypes-false/__snapshots__/basic.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1997,9 +1997,9 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
data: Events,
query?: {
queryParam1?: number;
fooBarBaz?: number;
"foo.bar.baz"?: number;
queryParam2?: number;
queryParamBar3?: number;
"query.param.bar.3"?: number;
queryParam3?: string[];
},
params: RequestParams = {},
Expand Down
4 changes: 2 additions & 2 deletions tests/spec/sortTypes/__snapshots__/basic.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1996,11 +1996,11 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
someOp1: (
data: Events,
query?: {
"foo.bar.baz"?: number;
"query.param.bar.3"?: number;
queryParam1?: number;
queryParam2?: number;
queryParam3?: string[];
queryParamBar3?: number;
fooBarBaz?: number;
},
params: RequestParams = {},
) =>
Expand Down

0 comments on commit 0a71f2b

Please sign in to comment.