Skip to content

Commit 9f48620

Browse files
committed
cleanup generator
1 parent 9db2cff commit 9f48620

File tree

2 files changed

+3
-36
lines changed

2 files changed

+3
-36
lines changed

generator/src/main/java/line/bot/generator/LineBotSdkNodejsGeneratorGenerator.java

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,6 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap operations, L
6868
if (op.isResponseFile) {
6969
op.vendorExtensions.put("isStream", true);
7070
}
71-
// for (CodegenParameter headerParam : op.headerParams) {
72-
// headerParam.;
73-
// }
74-
// op.getHasQueryParams()
75-
// op.getHasFormParams()
76-
// op.getHasBodyParam()
77-
// for (CodegenParameter formParam : op.formParams) {
78-
// formParam.isFile
79-
// }
80-
// if (op.getHasFormParams())
81-
for (CodegenParameter allParam : op.allParams) {
82-
// allParam.isModel
83-
// allParam.isNumber
84-
// allParam.isLong
85-
// allParam.isEnum
86-
}
8771
}
8872

8973
return operations;
@@ -181,11 +165,7 @@ protected ImmutableMap.Builder<String, Mustache.Lambda> addMustacheLambdas() {
181165
})
182166
.put("pathReplace", ((fragment, writer) -> {
183167
String text = fragment.execute();
184-
writer.write(pathReplacer(text, true));
185-
}))
186-
.put("pathReplaceDUMMY", ((fragment, writer) -> {
187-
String text = fragment.execute();
188-
writer.write(pathReplacer(text, false));
168+
writer.write(pathReplacer(text));
189169
}));
190170
}
191171

@@ -199,19 +179,15 @@ private String getEndpointFromClassName(String className) {
199179
}
200180
}
201181

202-
public static String pathReplacer(String template, boolean useVariable) {
182+
public static String pathReplacer(String template) {
203183
Pattern pattern = Pattern.compile("\\{(\\w+)\\}");
204184
Matcher matcher = pattern.matcher(template);
205185

206186
StringBuilder codeBuilder = new StringBuilder();
207187
while (matcher.find()) {
208188
String key = matcher.group(1);
209189
codeBuilder.append(".replace(\"{").append(key).append("}\", String(");
210-
if (useVariable) {
211-
codeBuilder.append(key);
212-
} else {
213-
codeBuilder.append("\"DUMMY\"");
214-
}
190+
codeBuilder.append(key);
215191
codeBuilder.append("))");
216192
}
217193

generator/src/test/java/line/bot/generator/LineBotSdkNodejsGeneratorGeneratorTest.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,15 @@
1212
* This test allows you to easily launch your code generation software under a debugger.
1313
* Then run this test under debug mode. You will be able to step through your java code
1414
* and then see the results in the out directory.
15-
*
16-
* To experiment with debugging your code generator:
17-
* 1) Set a break point in LineBotSdkNodejsGeneratorGenerator.java in the postProcessOperationsWithModels() method.
18-
* 2) To launch this test in Eclipse: right-click | Debug As | JUnit Test
19-
*
2015
*/
2116
public class LineBotSdkNodejsGeneratorGeneratorTest {
22-
23-
// use this test to launch you code generator in the debugger.
24-
// this allows you to easily set break points in MyclientcodegenGenerator.
2517
@Test
2618
public void launchCodeGenerator() {
2719
// to understand how the 'openapi-generator-cli' module is using 'CodegenConfigurator', have a look at the 'Generate' class:
2820
// https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java
2921
final CodegenConfigurator configurator = new CodegenConfigurator()
3022
.setGeneratorName("line-bot-sdk-nodejs-generator") // use this codegen library
3123
.setInputSpec("../line-openapi/shop.yml") // sample OpenAPI file
32-
// .setInputSpec("https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml") // or from the server
3324
.setOutputDir("out/line-bot-sdk-nodejs-generator"); // output directory
3425

3526
final ClientOptInput clientOptInput = configurator.toClientOptInput();

0 commit comments

Comments
 (0)