Skip to content

Commit e51a8b3

Browse files
authored
Merge pull request #8786 from swagger-api/fix-meta
refs #8784 - fix meta generator
2 parents 6428d23 + dd3c421 commit e51a8b3

File tree

5 files changed

+22
-11
lines changed

5 files changed

+22
-11
lines changed

modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/v3/cli/cmd/Meta.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class Meta implements Runnable {
2323

2424
private static final Logger LOGGER = LoggerFactory.getLogger(Meta.class);
2525

26-
private static final String TEMPLATE_DIR_CLASSPATH = "v2/codegen";
26+
private static final String TEMPLATE_DIR_CLASSPATH = "handlebars/codegen";
2727
private static final String MUSTACHE_EXTENSION = ".mustache";
2828

2929
private String outputFolder = "";

samples/meta-codegen/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ At this point, you've likely generated a client setup. It will include somethin
2626
|----- myClientCodegen // template files
2727
|----- META-INF
2828
|------ services
29-
|------- io.swagger.codegen.v3.CodegenConfig
29+
|------- io.swagger.codegen.CodegenConfig
3030
```
3131

3232
You _will_ need to make changes in at least the following:
@@ -46,7 +46,7 @@ mvn package
4646
In your generator project. A single jar file will be produced in `target`. You can now use that with codegen:
4747

4848
```
49-
java -cp /path/to/swagger-codegen-cli.jar:/path/to/your.jar io.swagger.codegen.v3.Codegen -l myClientCodegen -i /path/to/swagger.yaml -o ./test
49+
java -cp /path/to/swagger-codegen-cli.jar:/path/to/your.jar io.swagger.codegen.Codegen -l myClientCodegen -i /path/to/swagger.yaml -o ./test
5050
```
5151

5252
Now your templates are available to the client generator and you can write output values
@@ -67,7 +67,7 @@ the object you have available during client generation:
6767
# -DdebugOperations prints operations passed to the template engine
6868
# -DdebugSupportingFiles prints additional data passed to the template engine
6969
70-
java -DdebugOperations -cp /path/to/swagger-codegen-cli.jar:/path/to/your.jar io.swagger.codegen.v3.Codegen -l myClientCodegen -i /path/to/swagger.yaml -o ./test
70+
java -DdebugOperations -cp /path/to/swagger-codegen-cli.jar:/path/to/your.jar io.swagger.codegen.Codegen -l myClientCodegen -i /path/to/swagger.yaml -o ./test
7171
```
7272

7373
Will, for example, output the debug info for operations. You can use this info

samples/meta-codegen/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,22 +106,22 @@
106106
</build>
107107
<dependencies>
108108
<dependency>
109-
<groupId>io.swagger</groupId>
109+
<groupId>io.swagger.codegen.v3</groupId>
110110
<artifactId>swagger-codegen</artifactId>
111111
<version>${swagger-codegen-version}</version>
112112
<scope>provided</scope>
113113
</dependency>
114114
<dependency>
115115
<groupId>io.swagger.codegen.v3</groupId>
116116
<artifactId>swagger-codegen-generators</artifactId>
117-
<version>1.0.0-SNAPSHOT</version>
117+
<version>${swagger-codegen-generators-version}</version>
118118
<scope>provided</scope>
119119
</dependency>
120120
</dependencies>
121121
<properties>
122122
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
123-
<swagger-codegen-version>3.0.0-SNAPSHOT</swagger-codegen-version>
124-
<swagger-codegen-generators-version>1.0.0-SNAPSHOT</swagger-codegen-generators-version>
123+
<swagger-codegen-version>3.0.2-SNAPSHOT</swagger-codegen-version>
124+
<swagger-codegen-generators-version>1.0.2-SNAPSHOT</swagger-codegen-generators-version>
125125
<maven-plugin-version>1.0.0</maven-plugin-version>
126126
<junit-version>4.8.1</junit-version>
127127
<build-helper-maven-plugin>3.0.0</build-helper-maven-plugin>

samples/meta-codegen/src/main/java/com/my/company/codegen/MyclientcodegenGenerator.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package com.my.company.codegen;
22

3-
import io.swagger.codegen.*;
4-
import io.swagger.codegen.languages.DefaultCodegenConfig;
3+
import io.swagger.codegen.v3.*;
4+
import io.swagger.codegen.v3.generators.DefaultCodegenConfig;
55

66
import java.util.*;
77
import java.io.File;
88

9-
public class MyclientcodegenGenerator extends DefaultCodegenConfig implements CodegenConfig {
9+
public class MyclientcodegenGenerator extends DefaultCodegenConfig {
1010

1111
// source folder where to write the files
1212
protected String sourceFolder = "src";
@@ -151,4 +151,14 @@ public String apiFileFolder() {
151151
public String getArgumentsLocation() {
152152
return null;
153153
}
154+
155+
@Override
156+
protected String getTemplateDir() {
157+
return templateDir;
158+
}
159+
160+
@Override
161+
public String getDefaultTemplateDir() {
162+
return templateDir;
163+
}
154164
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
com.my.company.codegen.MyclientcodegenGenerator

0 commit comments

Comments
 (0)