Skip to content

Commit 07edda9

Browse files
OskarAsplinrobdodson
authored andcommitted
Rename transformModelCase to transformCase and add to Readme
1 parent 483f672 commit 07edda9

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ $ openapi --help
5050
--postfixServices Service name postfix (default: "Service")
5151
--postfixModels Model name postfix
5252
--request <value> Path to custom request file
53+
--transformCase <value> Transforms field names to specified case [camel, snake] (default: none)
5354
-h, --help display help for command
5455
5556
Examples

bin/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const params = program
2323
.option('--indent <value>', 'Indentation options [4, 2, tabs]', '4')
2424
.option('--postfixServices <value>', 'Service name postfix', 'Service')
2525
.option('--postfixModels <value>', 'Model name postfix')
26-
.option('--transformModelCase <value>', 'Transform model case [camel, snake]', 'none')
26+
.option('--transformCase <value>', 'Transforms field names to specified case [camel, snake]', 'none')
2727
.option('--request <value>', 'Path to custom request file')
2828
.parse(process.argv)
2929
.opts();
@@ -45,7 +45,7 @@ if (OpenAPI) {
4545
indent: params.indent,
4646
postfixServices: params.postfixServices,
4747
postfixModels: params.postfixModels,
48-
transformModelCase: params.transformModelCase,
48+
transformCase: params.transformCase,
4949
request: params.request,
5050
})
5151
.then(() => {

src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export type Options = {
2727
indent?: Indent;
2828
postfixServices?: string;
2929
postfixModels?: string;
30-
transformModelCase?: Case;
30+
transformCase?: Case;
3131
request?: string;
3232
write?: boolean;
3333
};
@@ -49,7 +49,7 @@ export type Options = {
4949
* @param indent Indentation options (4, 2 or tab)
5050
* @param postfixServices Service name postfix
5151
* @param postfixModels Model name postfix
52-
* @param transformModelCase Transform model case (camel, snake)
52+
* @param transformCase Transform case (camel, snake)
5353
* @param request Path to custom request file
5454
* @param write Write the files to disk (true or false)
5555
*/
@@ -67,7 +67,7 @@ export const generate = async ({
6767
indent = Indent.SPACE_4,
6868
postfixServices = 'Service',
6969
postfixModels = '',
70-
transformModelCase = Case.NONE,
70+
transformCase = Case.NONE,
7171
request,
7272
write = true,
7373
}: Options): Promise<void> => {
@@ -98,7 +98,7 @@ export const generate = async ({
9898
indent,
9999
postfixServices,
100100
postfixModels,
101-
transformModelCase,
101+
transformCase,
102102
clientName,
103103
request
104104
);
@@ -123,7 +123,7 @@ export const generate = async ({
123123
indent,
124124
postfixServices,
125125
postfixModels,
126-
transformModelCase,
126+
transformCase,
127127
clientName,
128128
request
129129
);

src/utils/writeClient.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { writeClientServices } from './writeClientServices';
3131
* @param indent Indentation options (4, 2 or tab)
3232
* @param postfixServices Service name postfix
3333
* @param postfixModels Model name postfix
34-
* @param transformModelCase Transform model case (camel, snake)
34+
* @param transformCase Transform model case (camel, snake)
3535
* @param clientName Custom client class name
3636
* @param request Path to custom request file
3737
*/
@@ -49,7 +49,7 @@ export const writeClient = async (
4949
indent: Indent,
5050
postfixServices: string,
5151
postfixModels: string,
52-
transformModelCase: Case,
52+
transformCase: Case,
5353
clientName?: string,
5454
request?: string
5555
): Promise<void> => {
@@ -101,7 +101,7 @@ export const writeClient = async (
101101
httpClient,
102102
useUnionTypes,
103103
indent,
104-
transformModelCase
104+
transformCase
105105
);
106106
}
107107

src/utils/writeClientModels.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import type { Templates } from './registerHandlebarTemplates';
1717
* @param httpClient The selected httpClient (fetch, xhr, node or axios)
1818
* @param useUnionTypes Use union types instead of enums
1919
* @param indent Indentation options (4, 2 or tab)
20-
* @param transformModelCase Transform model case (camel, snake)
20+
* @param transformCase Transform model case (camel, snake)
2121
*/
2222
export const writeClientModels = async (
2323
models: Model[],
@@ -26,10 +26,10 @@ export const writeClientModels = async (
2626
httpClient: HttpClient,
2727
useUnionTypes: boolean,
2828
indent: Indent,
29-
transformModelCase: Case
29+
transformCase: Case
3030
): Promise<void> => {
3131
for (const model of models) {
32-
const newModel = transformModelCase === Case.NONE ? model : convertModelNames(model, transformModelCase);
32+
const newModel = transformCase === Case.NONE ? model : convertModelNames(model, transformCase);
3333
const file = resolve(outputPath, `${model.name}.ts`);
3434
const templateResult = templates.exports.model({
3535
...newModel,

0 commit comments

Comments
 (0)