@@ -14,13 +14,11 @@ export class CodeGenerator {
14
14
constructor ( private readonly entryPoint : string , option ?: Option ) {
15
15
this . rootSchema = Api . FileSystem . loadJsonOrYaml ( entryPoint ) ;
16
16
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 ( ) ;
18
18
}
19
19
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 ) ;
24
22
}
25
23
26
24
/**
@@ -40,11 +38,11 @@ export class CodeGenerator {
40
38
* @param generatorTemplate Template for when you want to change the code following a type definition
41
39
* @returns String of generated code
42
40
*/
43
- public generateTypeDefinition ( generatorTemplates ?: Types . CodeGenerator . CustomGenerator < any > [ ] ) : string {
41
+ public generateTypeDefinition ( generatorTemplates ?: Types . CodeGenerator . CustomGenerator < any > [ ] , allowOperationIds ?: string [ ] ) : string {
44
42
const create = ( ) => {
45
43
const statements = this . parser . getOpenApiTypeDefinitionStatements ( ) ;
46
44
generatorTemplates ?. forEach ( generatorTemplate => {
47
- const payload = this . parser . getCodeGeneratorParamsArray ( ) ;
45
+ const payload = this . parser . getCodeGeneratorParamsArray ( allowOperationIds ) ;
48
46
const extraStatements = Api . TsGenerator . Utils . convertIntermediateCodes ( generatorTemplate . generator ( payload , generatorTemplate . option ) ) ;
49
47
statements . push ( ...extraStatements ) ;
50
48
} ) ;
@@ -59,8 +57,8 @@ export class CodeGenerator {
59
57
* @param generatorTemplate
60
58
* @returns String of generated code
61
59
*/
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 ) ;
64
62
const create = ( ) => {
65
63
return generatorTemplates
66
64
. map ( generatorTemplate => {
@@ -74,8 +72,8 @@ export class CodeGenerator {
74
72
/**
75
73
* Provides parameters extracted from OpenApi Schema
76
74
*/
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 ) ;
79
77
}
80
78
81
79
/**
0 commit comments