@@ -14,13 +14,11 @@ export class CodeGenerator {
1414 constructor ( private readonly entryPoint : string , option ?: Option ) {
1515 this . rootSchema = Api . FileSystem . loadJsonOrYaml ( entryPoint ) ;
1616 this . resolvedReferenceDocument = Api . ResolveReference . resolve ( entryPoint , entryPoint , JSON . parse ( JSON . stringify ( this . rootSchema ) ) ) ;
17- this . parser = this . createParser ( option ?. allowOperationIds ) ;
17+ this . parser = this . createParser ( ) ;
1818 }
1919
20- private createParser ( allowOperationIds ?: string [ ] ) : Api . OpenApiTools . Parser {
21- return new Api . OpenApiTools . Parser ( this . entryPoint , this . rootSchema , this . resolvedReferenceDocument , {
22- allowOperationIds : allowOperationIds ,
23- } ) ;
20+ private createParser ( ) : Api . OpenApiTools . Parser {
21+ return new Api . OpenApiTools . Parser ( this . entryPoint , this . rootSchema , this . resolvedReferenceDocument ) ;
2422 }
2523
2624 /**
@@ -40,11 +38,11 @@ export class CodeGenerator {
4038 * @param generatorTemplate Template for when you want to change the code following a type definition
4139 * @returns String of generated code
4240 */
43- public generateTypeDefinition ( generatorTemplates ?: Types . CodeGenerator . CustomGenerator < any > [ ] ) : string {
41+ public generateTypeDefinition ( generatorTemplates ?: Types . CodeGenerator . CustomGenerator < any > [ ] , allowOperationIds ?: string [ ] ) : string {
4442 const create = ( ) => {
4543 const statements = this . parser . getOpenApiTypeDefinitionStatements ( ) ;
4644 generatorTemplates ?. forEach ( generatorTemplate => {
47- const payload = this . parser . getCodeGeneratorParamsArray ( ) ;
45+ const payload = this . parser . getCodeGeneratorParamsArray ( allowOperationIds ) ;
4846 const extraStatements = Api . TsGenerator . Utils . convertIntermediateCodes ( generatorTemplate . generator ( payload , generatorTemplate . option ) ) ;
4947 statements . push ( ...extraStatements ) ;
5048 } ) ;
@@ -59,8 +57,8 @@ export class CodeGenerator {
5957 * @param generatorTemplate
6058 * @returns String of generated code
6159 */
62- public generateCode ( generatorTemplates : Types . CodeGenerator . CustomGenerator < any > [ ] ) : string {
63- const payload = this . parser . getCodeGeneratorParamsArray ( ) ;
60+ public generateCode ( generatorTemplates : Types . CodeGenerator . CustomGenerator < any > [ ] , allowOperationIds ?: string [ ] ) : string {
61+ const payload = this . parser . getCodeGeneratorParamsArray ( allowOperationIds ) ;
6462 const create = ( ) => {
6563 return generatorTemplates
6664 . map ( generatorTemplate => {
@@ -74,8 +72,8 @@ export class CodeGenerator {
7472 /**
7573 * Provides parameters extracted from OpenApi Schema
7674 */
77- public getCodeGeneratorParamsArray ( ) : Types . CodeGenerator . Params [ ] {
78- return this . parser . getCodeGeneratorParamsArray ( ) ;
75+ public getCodeGeneratorParamsArray ( allowOperationIds ?: string [ ] ) : Types . CodeGenerator . Params [ ] {
76+ return this . parser . getCodeGeneratorParamsArray ( allowOperationIds ) ;
7977 }
8078
8179 /**
0 commit comments