Skip to content

Commit a0d5033

Browse files
committed
included swagger 2.0 dependencies in order to support conversion.
1 parent 5fa41b5 commit a0d5033

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

modules/swagger-codegen/pom.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,16 @@
198198
<diffutils-version>1.3.0</diffutils-version>
199199
</properties>
200200
<dependencies>
201+
<dependency>
202+
<groupId>io.swagger</groupId>
203+
<artifactId>swagger-models</artifactId>
204+
<version>1.5.17</version>
205+
</dependency>
206+
<dependency>
207+
<groupId>io.swagger</groupId>
208+
<artifactId>swagger-core</artifactId>
209+
<version>1.5.17</version>
210+
</dependency>
201211
<dependency>
202212
<groupId>io.swagger.core.v3</groupId>
203213
<artifactId>swagger-models</artifactId>
@@ -218,6 +228,11 @@
218228
<artifactId>swagger-parser-v3</artifactId>
219229
<version>${swagger-parser-version}</version>
220230
</dependency>
231+
<dependency>
232+
<groupId>io.swagger.parser.v3</groupId>
233+
<artifactId>swagger-parser</artifactId>
234+
<version>${swagger-parser-version}</version>
235+
</dependency>
221236
<dependency>
222237
<groupId>com.samskivert</groupId>
223238
<artifactId>jmustache</artifactId>

modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,8 +709,11 @@ private Map<String, Object> buildSupportFileBundle(List<Object> allOperations, L
709709
@Override
710710
public List<File> generate() {
711711

712-
if (openAPI == null || config == null) {
713-
throw new RuntimeException("missing swagger input or config!");
712+
if (openAPI == null) {
713+
throw new RuntimeException("missing OpenAPI input!");
714+
}
715+
if (config == null) {
716+
throw new RuntimeException("missing configuration input!");
714717
}
715718
configureGeneratorProperties();
716719
configureSwaggerInfo();

modules/swagger-codegen/src/main/java/io/swagger/codegen/config/CodegenConfigurator.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
import io.swagger.codegen.CodegenConfigLoader;
1010
import io.swagger.codegen.CodegenConstants;
1111
import io.swagger.codegen.auth.AuthParser;
12+
import io.swagger.parser.OpenAPIParser;
1213
import io.swagger.v3.oas.models.OpenAPI;
13-
import io.swagger.v3.parser.OpenAPIV3Parser;
14-
import io.swagger.v3.parser.OpenAPIV3Parser;
1514
import io.swagger.v3.core.util.Json;
1615
import io.swagger.v3.parser.core.models.AuthorizationValue;
16+
import io.swagger.v3.parser.core.models.SwaggerParseResult;
17+
import io.swagger.v3.parser.OpenAPIV3Parser;
1718
import org.apache.commons.lang3.Validate;
1819
import org.slf4j.Logger;
1920
import org.slf4j.LoggerFactory;
@@ -429,7 +430,8 @@ public ClientOptInput toClientOptInput() {
429430

430431
final List<AuthorizationValue> authorizationValues = AuthParser.parse(auth);
431432

432-
OpenAPI openAPI = new OpenAPIV3Parser().read(inputSpec, authorizationValues, null);
433+
SwaggerParseResult result = new OpenAPIParser().readLocation(inputSpec, authorizationValues, null);
434+
OpenAPI openAPI = result.getOpenAPI();
433435

434436
input.opts(new ClientOpts())
435437
.openAPI(openAPI);

0 commit comments

Comments
 (0)