-
Notifications
You must be signed in to change notification settings - Fork 6k
/
Copy pathCodegenConfig.java
254 lines (137 loc) · 5.84 KB
/
CodegenConfig.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
package io.swagger.codegen;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.samskivert.mustache.Mustache.Compiler;
import io.swagger.models.Model;
import io.swagger.models.Operation;
import io.swagger.models.Swagger;
import io.swagger.models.auth.SecuritySchemeDefinition;
import io.swagger.models.properties.Property;
public interface CodegenConfig {
CodegenType getTag();
String getName();
String getHelp();
Map<String, Object> additionalProperties();
Map<String, Object> vendorExtensions();
String testPackage();
String apiPackage();
String apiFileFolder();
String apiTestFileFolder();
String apiDocFileFolder();
String fileSuffix();
String outputFolder();
String templateDir();
String embeddedTemplateDir();
String modelFileFolder();
String modelTestFileFolder();
String modelDocFileFolder();
String modelPackage();
String toApiName(String name);
String toApiVarName(String name);
String toModelName(String name);
String toParamName(String name);
String escapeText(String text);
String escapeUnsafeCharacters(String input);
String escapeReservedWord(String name);
String escapeQuotationMark(String input);
String getTypeDeclaration(Property p);
String getTypeDeclaration(String name);
void processOpts();
List<CliOption> cliOptions();
String generateExamplePath(String path, Operation operation);
Set<String> reservedWords();
List<SupportingFile> supportingFiles();
String getInputSpec();
void setInputSpec(String inputSpec);
String getOutputDir();
void setOutputDir(String dir);
CodegenModel fromModel(String name, Model model);
CodegenModel fromModel(String name, Model model, Map<String, Model> allDefinitions);
CodegenOperation fromOperation(String resourcePath, String httpMethod, Operation operation, Map<String, Model> definitions, Swagger swagger);
CodegenOperation fromOperation(String resourcePath, String httpMethod, Operation operation, Map<String, Model> definitions);
List<CodegenSecurity> fromSecurity(Map<String, SecuritySchemeDefinition> schemes);
Set<String> defaultIncludes();
Map<String, String> typeMapping();
Map<String, String> instantiationTypes();
Map<String, String> importMapping();
Map<String, String> apiTemplateFiles();
Map<String, String> modelTemplateFiles();
Map<String, String> apiTestTemplateFiles();
Map<String, String> modelTestTemplateFiles();
Map<String, String> apiDocTemplateFiles();
Map<String, String> modelDocTemplateFiles();
Set<String> languageSpecificPrimitives();
Map<String, String> reservedWordsMappings();
void preprocessSwagger(Swagger swagger);
void processSwagger(Swagger swagger);
Compiler processCompiler(Compiler compiler);
String sanitizeTag(String tag);
String toApiFilename(String name);
String toModelFilename(String name);
String toApiTestFilename(String name);
String toModelTestFilename(String name);
String toApiDocFilename(String name);
String toModelDocFilename(String name);
String toModelImport(String name);
String toApiImport(String name);
void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations);
Map<String, Object> postProcessAllModels(Map<String, Object> objs);
Map<String, Object> postProcessModels(Map<String, Object> objs);
Map<String, Object> postProcessOperations(Map<String, Object> objs);
Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels);
Map<String, Object> postProcessSupportingFileData(Map<String, Object> objs);
void postProcessModelProperty(CodegenModel model, CodegenProperty property);
void postProcessParameter(CodegenParameter parameter);
String apiFilename(String templateName, String tag);
String modelFilename(String templateName, String modelName);
String apiTestFilename(String templateName, String tag);
String apiDocFilename(String templateName, String tag);
boolean shouldOverwrite(String filename);
boolean isSkipOverwrite();
void setSkipOverwrite(boolean skipOverwrite);
boolean isRemoveOperationIdPrefix();
void setRemoveOperationIdPrefix(boolean removeOperationIdPrefix);
public boolean isHideGenerationTimestamp();
public void setHideGenerationTimestamp(boolean hideGenerationTimestamp);
Map<String, String> supportedLibraries();
void setLibrary(String library);
/**
* Library template (sub-template).
*
* @return libray template
*/
String getLibrary();
void setGitUserId(String gitUserId);
String getGitUserId();
void setGitRepoId(String gitRepoId);
String getGitRepoId();
void setGitRepoBaseURL(String repositoryBaseURL);
String getGitRepoBaseURL();
void setReleaseNote(String releaseNote);
String getReleaseNote();
void setHttpUserAgent(String httpUserAgent);
String getHttpUserAgent();
String getCommonTemplateDir();
void setIgnoreFilePathOverride(String ignoreFileOverride);
String getIgnoreFilePathOverride();
String toBooleanGetter(String name);
String toSetter(String name);
String toGetter(String name);
String sanitizeName(String name);
void setSkipAliasGeneration(Boolean skipAliasGeneration);
Boolean getSkipAliasGeneration();
boolean getIgnoreImportMapping();
void setIgnoreImportMapping(boolean ignoreImportMapping);
boolean defaultIgnoreImportMappingOption();
boolean isUsingFlattenSpec();
default boolean isPrivileged() {
return false;
}
default int getPriority() {
return Integer.MIN_VALUE;
}
default String getCodeName() {
return getName();
}
}