Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Snyk] Upgrade fs-extra from 10.0.1 to 10.1.0 #9

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/gen-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ export function typeName(name: string): string {
*/
export function enumName(value: string, options: Options): string {
let name = toBasicChars(value, true);
if (options.enumStyle === 'upper') {
if (options.enumStyle === 'unmodified') {
return name;
} else if (options.enumStyle === 'upper') {
name = upperCase(name).replace(/\s+/g, '_');
} else {
name = upperFirst(camelCase(name));
Expand Down
5 changes: 5 additions & 0 deletions lib/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class Globals {
modelIndexFile?: string;
serviceIndexFile?: string;
rootUrl?: string;
customApiConfiguration?: string;

constructor(options: Options) {
this.configurationClass = options.configuration || 'ApiConfiguration';
Expand All @@ -42,6 +43,10 @@ export class Globals {
if (options.modelIndex !== false && options.modelIndex !== '') {
this.modelIndexFile = options.modelIndex === true || options.modelIndex == undefined ? 'models' : options.modelIndex;
}
if (options.customApiConfiguration) {
this.customApiConfiguration = options.customApiConfiguration;
this.configurationFile = this.customApiConfiguration;
}
}

}
4 changes: 3 additions & 1 deletion lib/ng-openapi-gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ export class NgOpenApiGen {
};

// Generate the general files
this.write('configuration', general, this.globals.configurationFile);
if (!this.globals.customApiConfiguration) {
this.write('configuration', general, this.globals.configurationFile);
}
this.write('response', general, this.globals.responseFile);
this.write('requestBuilder', general, this.globals.requestBuilderFile);
this.write('baseService', general, this.globals.baseServiceFile);
Expand Down
10 changes: 7 additions & 3 deletions lib/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ export interface Options {
* Determines how root enums will be generated. Possible values are:
*
* - `alias`: just generate a type alias with the possible values;
* - `upper` for an enum with UPPER_CASE names, and;
* - `pascal` for enum PascalCase names.
* - `upper` for an enum with UPPER_CASE names;
* - `pascal` for enum PascalCase names;
* - `unmodified` to use the value as the name after basic character parsing;
*
* Defaults to 'pascal'.
*/
enumStyle?: 'alias' | 'upper' | 'pascal';
enumStyle?: 'alias' | 'upper' | 'pascal' | 'unmodified';

/**
* Determines how to normalize line endings. Possible values are:
Expand Down Expand Up @@ -105,4 +106,7 @@ export interface Options {

/** When specified, will create temporary files in system temporary folder instead of next to output folder. */
useTempDir?: boolean;

/** When set, the ApiConfiguration file not be generated and only a custom import will be used */
customApiConfiguration?: string;
}
10 changes: 8 additions & 2 deletions ng-openapi-gen-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,13 @@
]
},
"enumStyle": {
"description": "Determines how root enums will be generated. Possible values are:\n\n- `alias`: just generate a type alias with the possible values;\n- `upper` for an enum with UPPER_CASE names, and;\n- `pascal` for enum PascalCase names. Defaults to 'pascal'.",
"description": "Determines how root enums will be generated. Possible values are:\n\n- `alias`: just generate a type alias with the possible values;\n- `upper` for an enum with UPPER_CASE names;\n- `pascal` for enum PascalCase names;\n- `unmodified` to use the value as the name after basic character parsing; Defaults to 'pascal'.",
"default": "pascal",
"enum": [
"alias",
"upper",
"pascal"
"pascal",
"unmodified"
]
},
"endOfLineStyle": {
Expand Down Expand Up @@ -196,6 +197,11 @@
"description": "When specified, will create temporary files in system temporary folder instead of output folder",
"default": false,
"type": "boolean"
},
"customApiConfiguration": {
"description": "When set, the ApiConfiguration file not be generated and only a custom import will be used",
"default": "",
"type": "string"
}
}
}
Loading