Repository: swagger-api/swagger-parser
Pull request #773 (2018-07-19 14:37:03)

Convert Server with relative location to absolute url
Replacement for #754 with additional changes to fix issue #742


Patch:
diff --git a/README.md b/README.md
index 2bc8bcd0..a8cd031a 100644
--- a/README.md
+++ b/README.md
@@ -95,7 +95,7 @@ You can include this library from Sonatype OSS for SNAPSHOTS, or Maven central f
 <dependency>
   <groupId>io.swagger.parser.v3</groupId>
   <artifactId>swagger-parser</artifactId>
-  <version>2.0.2-SNAPSHOT</version>
+  <version>2.0.1</version>
 </dependency>
 
 ```
@@ -106,7 +106,7 @@ or
 <dependency>
   <groupId>io.swagger.parser.v3</groupId>
   <artifactId>swagger-parser</artifactId>
-  <version>2.0.2-SNAPSHOT</version>
+  <version>2.0.1</version>
 </dependency>
 
 ```
diff --git a/modules/swagger-parser-core/pom.xml b/modules/swagger-parser-core/pom.xml
index 8559734b..7e39477f 100644
--- a/modules/swagger-parser-core/pom.xml
+++ b/modules/swagger-parser-core/pom.xml
@@ -3,7 +3,7 @@
     <parent>
         <groupId>io.swagger.parser.v3</groupId>
         <artifactId>swagger-parser-project</artifactId>
-        <version>2.0.2-SNAPSHOT</version>
+        <version>2.0.1</version>
         <relativePath>../..</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
diff --git a/modules/swagger-parser-v2-converter/pom.xml b/modules/swagger-parser-v2-converter/pom.xml
index e8e47330..33cc1ded 100644
--- a/modules/swagger-parser-v2-converter/pom.xml
+++ b/modules/swagger-parser-v2-converter/pom.xml
@@ -3,7 +3,7 @@
     <parent>
         <groupId>io.swagger.parser.v3</groupId>
         <artifactId>swagger-parser-project</artifactId>
-        <version>2.0.2-SNAPSHOT</version>
+        <version>2.0.1</version>
         <relativePath>../..</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
diff --git a/modules/swagger-parser-v2-converter/src/main/java/io/swagger/v3/parser/converter/SwaggerConverter.java b/modules/swagger-parser-v2-converter/src/main/java/io/swagger/v3/parser/converter/SwaggerConverter.java
index e94b9895..b4250e44 100644
--- a/modules/swagger-parser-v2-converter/src/main/java/io/swagger/v3/parser/converter/SwaggerConverter.java
+++ b/modules/swagger-parser-v2-converter/src/main/java/io/swagger/v3/parser/converter/SwaggerConverter.java
@@ -317,10 +317,7 @@ public class SwaggerConverter implements SwaggerParserExtension {
         }
 
         Scopes scopes = new Scopes();
-        Map<String, String> oAuth2Scopes = oAuth2Definition.getScopes();
-        if (oAuth2Scopes != null) {
-            oAuth2Scopes.forEach((k, v) -> scopes.addString(k, v));
-        }
+        oAuth2Definition.getScopes().forEach((k, v) -> scopes.addString(k, v));
         oAuthFlow.setScopes(scopes);
 
         securityScheme.setFlows(oAuthFlows);
@@ -815,9 +812,6 @@ public class SwaggerConverter implements SwaggerParserExtension {
     }
 
     private Schema convert(Property schema) {
-        if (schema == null) {
-            return null;
-        }
         Schema result;
 
         if (schema instanceof RefProperty) {
@@ -1013,7 +1007,7 @@ public class SwaggerConverter implements SwaggerParserExtension {
 
             if (sp.getEnum() != null) {
                 for (String e : sp.getEnum()) {
-                    switch (sp.getType() == null ? SchemaTypeUtil.OBJECT_TYPE : sp.getType()) {
+                    switch (sp.getType()) {
                         case SchemaTypeUtil.INTEGER_TYPE:
                             schema.addEnumItemObject(Integer.parseInt(e));
                             break;
@@ -1054,9 +1048,6 @@ public class SwaggerConverter implements SwaggerParserExtension {
     }
 
     public Schema convert(io.swagger.models.Model v2Model) {
-        if (v2Model == null) {
-            return null;
-        }
         Schema result;
 
         if (v2Model instanceof ArrayModel) {
diff --git a/modules/swagger-parser-v3/pom.xml b/modules/swagger-parser-v3/pom.xml
index 35cbe7f9..407fd1c9 100644
--- a/modules/swagger-parser-v3/pom.xml
+++ b/modules/swagger-parser-v3/pom.xml
@@ -3,7 +3,7 @@
     <parent>
         <groupId>io.swagger.parser.v3</groupId>
         <artifactId>swagger-parser-project</artifactId>
-        <version>2.0.2-SNAPSHOT</version>
+        <version>2.0.1</version>
         <relativePath>../..</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
diff --git a/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/OpenAPIV3Parser.java b/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/OpenAPIV3Parser.java
index 0e5f57d7..256e2762 100644
--- a/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/OpenAPIV3Parser.java
+++ b/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/OpenAPIV3Parser.java
@@ -99,9 +99,9 @@ public class OpenAPIV3Parser implements SwaggerParserExtension {
         return null;
     }
 
-    public SwaggerParseResult readWithInfo(JsonNode node) {
+    public SwaggerParseResult readWithInfo(String path, JsonNode node) {
         OpenAPIDeserializer ser = new OpenAPIDeserializer();
-        return ser.deserialize(node);
+        return ser.deserialize(node, path);
     }
 
     private ObjectMapper getRightMapper(String data) {
@@ -139,7 +139,7 @@ public class OpenAPIV3Parser implements SwaggerParserExtension {
             ObjectMapper mapper = getRightMapper(data);
             JsonNode rootNode = mapper.readTree(data);
             LOGGER.debug("Parsed rootNode: {}", rootNode);
-            return readWithInfo(rootNode);
+            return readWithInfo(location, rootNode);
         }
         catch (SSLHandshakeException e) {
             SwaggerParseResult output = new SwaggerParseResult();
diff --git a/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/processors/ParameterProcessor.java b/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/processors/ParameterProcessor.java
index fde98ab3..273a19fa 100644
--- a/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/processors/ParameterProcessor.java
+++ b/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/processors/ParameterProcessor.java
@@ -133,13 +133,6 @@ public class ParameterProcessor {
 
         }
 
-        for (Parameter parameter : processedPathLevelParameters) {
-            Schema schema = parameter.getSchema();
-            if(schema != null){
-                schemaProcessor.processSchema(schema);
-            }
-        }
-
         return processedPathLevelParameters;
     }
 }
\ No newline at end of file
diff --git a/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/InlineModelResolver.java b/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/InlineModelResolver.java
index 4eb0579a..be93c1d4 100644
--- a/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/InlineModelResolver.java
+++ b/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/InlineModelResolver.java
@@ -436,7 +436,6 @@ public class InlineModelResolver {
         model.setExample(example);
         model.setName(name);
         model.setXml(xml);
-        model.setType(object.getType());
 
         if (properties != null) {
             flattenProperties(properties, path);
diff --git a/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/OpenAPIDeserializer.java b/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/OpenAPIDeserializer.java
index 3bdeb8f1..94f8fd1c 100644
--- a/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/OpenAPIDeserializer.java
+++ b/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/OpenAPIDeserializer.java
@@ -49,6 +49,9 @@ import io.swagger.v3.core.util.Json;
 import org.apache.commons.lang3.StringUtils;
 
 import java.math.BigDecimal;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Iterator;
@@ -97,10 +100,14 @@ public class OpenAPIDeserializer {
 
 
     public SwaggerParseResult deserialize(JsonNode rootNode) {
+    	return deserialize(rootNode, null);
+    }
+    
+    public SwaggerParseResult deserialize(JsonNode rootNode, String path) {
         SwaggerParseResult result = new SwaggerParseResult();
         try {
             ParseResult rootParse = new ParseResult();
-            OpenAPI api = parseRoot(rootNode, rootParse);
+            OpenAPI api = parseRoot(rootNode, rootParse, path);
             result.setOpenAPI(api);
             result.setMessages(rootParse.getMessages());
         } catch (Exception e) {
@@ -110,7 +117,7 @@ public class OpenAPIDeserializer {
         return result;
     }
 
-    public OpenAPI parseRoot(JsonNode node, ParseResult result) {
+    public OpenAPI parseRoot(JsonNode node, ParseResult result, String path) {
         String location = "";
         OpenAPI openAPI = new OpenAPI();
         if (node.getNodeType().equals(JsonNodeType.OBJECT)) {
@@ -145,7 +152,7 @@ public class OpenAPIDeserializer {
 
             ArrayNode array = getArray("servers", rootNode, false, location, result);
             if (array != null && array.size() > 0) {
-                openAPI.setServers(getServersList(array, String.format("%s.%s", location, "servers"), result));
+                openAPI.setServers(getServersList(array, String.format("%s.%s", location, "servers"), result, path));
             }else {
                 Server defaultServer = new Server();
                 defaultServer.setUrl("/");
@@ -331,7 +338,7 @@ public class OpenAPIDeserializer {
 
 
 
-    public List<Server> getServersList(ArrayNode obj, String location, ParseResult result) {
+    public List<Server> getServersList(ArrayNode obj, String location, ParseResult result, String path) {
 
         List<Server> servers = new ArrayList<>();
         if (obj == null) {
@@ -340,7 +347,7 @@ public class OpenAPIDeserializer {
         }
         for (JsonNode item : obj) {
             if (item.getNodeType().equals(JsonNodeType.OBJECT)) {
-                Server server = getServer((ObjectNode) item, location, result);
+                Server server = getServer((ObjectNode) item, location, result, path);
                 if (server != null) {
                     servers.add(server);
                 }else{
@@ -352,8 +359,16 @@ public class OpenAPIDeserializer {
         }
         return servers;
     }
+    
+    public List<Server> getServersList(ArrayNode obj, String location, ParseResult result) {
+		return getServersList(obj, location, result, null);
+	}
+
+	public Server getServer(ObjectNode obj, String location, ParseResult result) {
+		return getServer(obj, location, result, null);
+	}
 
-    public Server getServer(ObjectNode obj, String location, ParseResult result) {
+    public Server getServer(ObjectNode obj, String location, ParseResult result, String path) {
         if (obj == null) {
             return null;
         }
@@ -362,6 +377,17 @@ public class OpenAPIDeserializer {
 
         String value = getString("url", obj, true, location, result);
         if(StringUtils.isNotBlank(value)) {
+			if(!isValidURL(value) && path != null){
+				try {
+					final URI absURI = new URI(path);
+					if("http".equals(absURI.getScheme()) || "https".equals(absURI.getScheme())){
+						value = absURI.resolve(new URI(value)).toString();
+					}
+				} catch (URISyntaxException e) {
+					e.printStackTrace();
+				}
+
+			}
             server.setUrl(value);
         }
 
@@ -393,6 +419,16 @@ public class OpenAPIDeserializer {
 
         return server;
     }
+    
+    boolean isValidURL(String urlString){
+		try {
+			URL url = new URL(urlString);
+			url.toURI();
+			return true;
+		} catch (Exception exception) {
+			return false;
+		}
+	}
 
     public ServerVariables getServerVariables(ObjectNode obj, String location, ParseResult result){
         ServerVariables serverVariables = new ServerVariables();
diff --git a/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/RefUtils.java b/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/RefUtils.java
index 66380cea..7b628153 100644
--- a/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/RefUtils.java
+++ b/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/RefUtils.java
@@ -53,7 +53,7 @@ public class RefUtils {
             result = RefFormat.URL;
         } else if(ref.startsWith("#/")) {
             result = RefFormat.INTERNAL;
-        } else if(ref.startsWith(".") || ref.startsWith("/") || ref.indexOf("#/") > 0) {
+        } else if(ref.startsWith(".") || ref.startsWith("/")) {
             result = RefFormat.RELATIVE;
         }
 
diff --git a/modules/swagger-parser/pom.xml b/modules/swagger-parser/pom.xml
index 06ae69f4..18737a5e 100644
--- a/modules/swagger-parser/pom.xml
+++ b/modules/swagger-parser/pom.xml
@@ -3,7 +3,7 @@
     <parent>
         <groupId>io.swagger.parser.v3</groupId>
         <artifactId>swagger-parser-project</artifactId>
-        <version>2.0.2-SNAPSHOT</version>
+        <version>2.0.1</version>
         <relativePath>../..</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
diff --git a/pom.xml b/pom.xml
index 5562d6e9..376ecdda 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>io.swagger.parser.v3</groupId>
     <artifactId>swagger-parser-project</artifactId>
-    <version>2.0.2-SNAPSHOT</version>
+    <version>2.0.1</version>
     <packaging>pom</packaging>
     <name>swagger-parser-project</name>
     <developers>


Test patch:
diff --git a/modules/swagger-parser-v2-converter/src/test/java/io/swagger/parser/test/V2ConverterTest.java b/modules/swagger-parser-v2-converter/src/test/java/io/swagger/parser/test/V2ConverterTest.java
index c2458b1a..4d565290 100644
--- a/modules/swagger-parser-v2-converter/src/test/java/io/swagger/parser/test/V2ConverterTest.java
+++ b/modules/swagger-parser-v2-converter/src/test/java/io/swagger/parser/test/V2ConverterTest.java
@@ -77,9 +77,6 @@ public class V2ConverterTest {
     private static final String ISSUE_673_YAML = "issue-673.yaml";
     private static final String ISSUE_676_JSON = "issue-676.json";
     private static final String ISSUE_708_YAML = "issue-708.yaml";
-    private static final String ISSUE_756_JSON = "issue-756.json";
-    private static final String ISSUE_758_JSON = "issue-758.json";
-    private static final String ISSUE_762_JSON = "issue-762.json";
 
     private static final String API_BATCH_PATH = "/api/batch/";
     private static final String PETS_PATH = "/pets";
@@ -619,24 +616,6 @@ public class V2ConverterTest {
         assertEquals(schema.getPattern(), "^[0-9]+$");
     }
 
-    @Test(description = "OpenAPI v2 converter - no model in body parameter")
-    public void testIssue756() throws Exception {
-        OpenAPI oas = getConvertedOpenAPIFromJsonFile(ISSUE_756_JSON);
-          assertNotNull(oas);
-    }
-
-    @Test(description = "OpenAPI v2 converter - NPE when 'enum' field is available and 'type' field is missing in query parameter")
-    public void testIssue758() throws Exception {
-        final OpenAPI oas = getConvertedOpenAPIFromJsonFile(ISSUE_758_JSON);
-        assertNotNull(oas);
-    }
-  
-    @Test(description = "OpenAPI v2 Converter: NPE when type is array and 'items' field is missing in array property")
-    public void testIssue762() throws Exception {
-        final OpenAPI oas = getConvertedOpenAPIFromJsonFile(ISSUE_762_JSON);
-        assertNotNull(oas);
-    } 
-
     @Test(description = "OpenAPI v2 converter - Missing Parameter.style property")
     public void testParameterConversion() throws Exception {
         OpenAPI oas = getConvertedOpenAPIFromJsonFile(PARAMETER_CONVERSION_JSON);
diff --git a/modules/swagger-parser-v2-converter/src/test/resources/issue-756.json b/modules/swagger-parser-v2-converter/src/test/resources/issue-756.json
deleted file mode 100644
index e1d90dc5..00000000
--- a/modules/swagger-parser-v2-converter/src/test/resources/issue-756.json
+++ /dev/null
@@ -1,38 +0,0 @@
-{
-  "swagger": "2.0",
-  "info": {
-    "version": "1",
-    "title": "EchoSoap"
-  },
-  "paths": {
-    "/echo": {
-      "post": {
-        "consumes": [
-          "application/json",
-          "application/xml"
-        ],
-        "produces": [
-          "application/json",
-          "application/xml"
-        ],
-        "parameters": [
-          {
-            "in": "body",
-            "required": false,
-            "x-examples": {
-              "application/json": "{}"
-            }
-          }
-        ],
-        "responses": {
-          "200": {
-            "examples": {
-              "application/json": "{}"
-            }
-          }
-        }
-      },
-      "parameters": []
-    }
-  }
-}
\ No newline at end of file
diff --git a/modules/swagger-parser-v2-converter/src/test/resources/issue-758.json b/modules/swagger-parser-v2-converter/src/test/resources/issue-758.json
deleted file mode 100644
index c607198e..00000000
--- a/modules/swagger-parser-v2-converter/src/test/resources/issue-758.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
-  "swagger" : "2.0",
-  "info" : {
-    "version" : "1",
-    "title" : "EchoSoap"
-  },
-  "paths" : {
-    "/echo" : {
-      "post" : {
-        "parameters" : [           {
-          "name": "sort",
-          "in": "query",
-          "required": false,
-          "enum": [
-            "forks",
-            "stars",
-            "updated"
-          ],
-          "description": "If not provided, results are sorted by best match."
-        }],
-        "responses" : {
-          "200" : {
-            "description" : "Dummy response"
-          }
-        }
-      }
-    }
-  }
-}
\ No newline at end of file
diff --git a/modules/swagger-parser-v2-converter/src/test/resources/issue-762.json b/modules/swagger-parser-v2-converter/src/test/resources/issue-762.json
deleted file mode 100644
index 411aea43..00000000
--- a/modules/swagger-parser-v2-converter/src/test/resources/issue-762.json
+++ /dev/null
@@ -1,47 +0,0 @@
-{
-  "swagger": "2.0",
-  "info": {
-    "version": "1.0.0",
-    "title": "PetStore on Heroku",
-    "description": "**This example has a working backend hosted in Heroku**\n\nYou can try all HTTP operation described in this Swagger spec.\n\nFind source code of this API [here](https://github.com/mohsen1/petstore-api)\n"
-  },
-  "host": "petstore-api.herokuapp.com",
-  "basePath": "/pet",
-  "schemes": [
-    "http",
-    "https"
-  ],
-  "paths": {
-    "/": {
-      "put": {
-        "parameters": [
-          {
-            "name": "pet",
-            "in": "body",
-            "description": "The pet JSON you want to post",
-            "schema": {
-              "$ref": "#/definitions/Pet"
-            },
-            "required": true
-          }
-        ],
-        "responses": {
-          "200": {
-            "description": "Updates the pet"
-          }
-        }
-      }
-    }
-  },
-  "definitions": {
-    "Pet": {
-      "type": "object",
-      "required" : ["name"],
-      "properties": {
-        "name": {
-          "type": "array"
-        }
-      }
-    }
-  }
-}
\ No newline at end of file
diff --git a/modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/processors/ParameterProcessorTest.java b/modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/processors/ParameterProcessorTest.java
index 318c0f0e..60e82e41 100644
--- a/modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/processors/ParameterProcessorTest.java
+++ b/modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/processors/ParameterProcessorTest.java
@@ -13,7 +13,10 @@ import io.swagger.v3.oas.models.parameters.QueryParameter;
 import io.swagger.v3.oas.models.parameters.RequestBody;
 import io.swagger.v3.parser.ResolverCache;
 import io.swagger.v3.parser.models.RefFormat;
-import mockit.*;
+import mockit.FullVerifications;
+import mockit.Injectable;
+import mockit.Mocked;
+import mockit.StrictExpectations;
 import org.testng.annotations.Test;
 
 
@@ -41,18 +44,7 @@ public class ParameterProcessorTest {
                                                                @Injectable final CookieParameter cookieParameter,
                                                                @Injectable final PathParameter pathParameter) throws Exception {
         expectedModelProcessorCreation();
-        new Expectations() {
-            {
-                headerParameter.getSchema();
-                result = null;
-                queryParameter.getSchema();
-                result = null;
-                cookieParameter.getSchema();
-                result = null;
-                pathParameter.getSchema();
-                result = null;
-            }
-        };
+
         final List<Parameter> processedParameters = new ParameterProcessor(cache, openAPI)
                 .processParameters(Arrays.<Parameter>asList(headerParameter,
                         queryParameter,
@@ -86,12 +78,6 @@ public class ParameterProcessorTest {
         Parameter refParameter = new Parameter().$ref(ref);
 
         expectLoadingRefFromCache(ref, RefFormat.INTERNAL, resolvedHeaderParam);
-        new Expectations() {
-            {
-                resolvedHeaderParam.getSchema();
-                result = null;
-            }
-        };
 
         final List<Parameter> processedParameters = new ParameterProcessor(cache, openAPI)
                 .processParameters(Arrays.<Parameter>asList(refParameter));
@@ -146,6 +132,8 @@ public class ParameterProcessorTest {
             new SchemaProcessor(cache, openAPI);
             times = 1;
             result = modelProcessor;
+
+
         }};
     }
 }
diff --git a/modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/test/NetworkReferenceTest.java b/modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/test/NetworkReferenceTest.java
index 6cc85430..c35cd35e 100644
--- a/modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/test/NetworkReferenceTest.java
+++ b/modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/test/NetworkReferenceTest.java
@@ -38,6 +38,7 @@ public class NetworkReferenceTest {
     private static String issue_335_json, issue_335_bar_json;
     private static String issue_407_json;
     private static String issue_411_server, issue_411_components;
+    private static String issue_742_json;
 
     static {
         try {
@@ -63,6 +64,8 @@ public class NetworkReferenceTest {
 
             issue_411_server        = readFile("src/test/resources/nested-network-references/issue-411-server.yaml");
             issue_411_components    = readFile("src/test/resources/nested-network-references/issue-411-remote2.yaml");
+
+            issue_742_json          = readFile("src/test/resources/issue-742.json");
         }
         catch(Exception e) {
             e.printStackTrace();
@@ -256,6 +259,33 @@ public class NetworkReferenceTest {
 
         assertTrue(swagger.getComponents().getSchemas().get("Error") instanceof Schema);
     }
+    
+    @Test
+    public void testIssue742() throws Exception {
+        final List< AuthorizationValue > auths = new ArrayList<>();
+
+        new Expectations() {{
+            remoteUrl.urlToString("http://www.example.io/one/two/swagger.json", auths);
+            result = issue_742_json;
+        }};
+
+        OpenAPIV3Parser parser = new OpenAPIV3Parser();
+        ParseOptions options = new ParseOptions();
+        options.setResolve(true);
+        SwaggerParseResult result = parser.readLocation("http://www.example.io/one/two/swagger.json", auths, options);
+
+        Assert.assertNotNull(result.getOpenAPI());
+        Assert.assertNotNull(result.getOpenAPI().getServers());
+        Assert.assertEquals(result.getOpenAPI().getServers().size(), 4);
+        Assert.assertEquals(result.getOpenAPI().getServers().get(0).getDescription(), "An absolute path");
+        Assert.assertEquals(result.getOpenAPI().getServers().get(0).getUrl(), "https://api.absolute.org/v2");
+        Assert.assertEquals(result.getOpenAPI().getServers().get(1).getDescription(), "Server relative to root path");
+        Assert.assertEquals(result.getOpenAPI().getServers().get(1).getUrl(), "http://www.example.io/api/v2");
+        Assert.assertEquals(result.getOpenAPI().getServers().get(2).getDescription(), "Server relative path 1");
+        Assert.assertEquals(result.getOpenAPI().getServers().get(2).getUrl(), "http://www.example.io/one/two/path/v2");
+        Assert.assertEquals(result.getOpenAPI().getServers().get(3).getDescription(), "Server relative path 2");
+        Assert.assertEquals(result.getOpenAPI().getServers().get(3).getUrl(), "http://www.example.io/one/v2");
+    }
 
     static String readFile(String name) throws Exception {
         return new String(Files.readAllBytes(new File(name).toPath()), Charset.forName("UTF-8"));
diff --git a/modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/test/OpenAPIV3ParserTest.java b/modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/test/OpenAPIV3ParserTest.java
index 13dd389e..cad5c1e6 100644
--- a/modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/test/OpenAPIV3ParserTest.java
+++ b/modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/test/OpenAPIV3ParserTest.java
@@ -1408,7 +1408,7 @@ public class OpenAPIV3ParserTest {
         String yaml = Files.readFile(new File("src/test/resources/over-quoted-example.yaml"));
         JsonNode rootNode = Yaml.mapper().readValue(yaml, JsonNode.class);
         OpenAPIV3Parser parser = new OpenAPIV3Parser();
-        OpenAPI openAPI = (parser.readWithInfo(rootNode)).getOpenAPI();
+        OpenAPI openAPI = (parser.readWithInfo(null, rootNode)).getOpenAPI();
 
         Map<String, Schema> definitions = openAPI.getComponents().getSchemas();
         assertEquals("NoQuotePlease", definitions.get("CustomerType").getExample());
diff --git a/modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/util/InlineModelResolverTest.java b/modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/util/InlineModelResolverTest.java
index 768b1aa8..99ff7e90 100644
--- a/modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/util/InlineModelResolverTest.java
+++ b/modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/util/InlineModelResolverTest.java
@@ -16,8 +16,6 @@ import io.swagger.v3.oas.models.parameters.Parameter;
 import io.swagger.v3.oas.models.parameters.RequestBody;
 import io.swagger.v3.oas.models.responses.ApiResponse;
 import io.swagger.v3.oas.models.responses.ApiResponses;
-import io.swagger.v3.parser.OpenAPIV3Parser;
-import io.swagger.v3.parser.core.models.ParseOptions;
 import org.testng.annotations.Test;
 
 
@@ -31,17 +29,6 @@ import static org.testng.AssertJUnit.*;
 
 @SuppressWarnings("static-method")
 public class InlineModelResolverTest {
-
-    @Test
-    public void testIssue705() throws Exception {
-        ParseOptions options = new ParseOptions();
-        options.setFlatten(true);
-        OpenAPI openAPI = new OpenAPIV3Parser().read("issue-705.yaml",null, options);
-        assertNotNull(openAPI);
-        assertNotNull(openAPI.getComponents().getSchemas().get("inline_response_200").getType());
-    }
-
-
     @Test
     public void resolveInlineModelTestWithoutTitle() throws Exception {
         OpenAPI openAPI = new OpenAPI();
diff --git a/modules/swagger-parser-v3/src/test/resources/issue-705.yaml b/modules/swagger-parser-v3/src/test/resources/issue-705.yaml
deleted file mode 100644
index c2b4c4b7..00000000
--- a/modules/swagger-parser-v3/src/test/resources/issue-705.yaml
+++ /dev/null
@@ -1,41 +0,0 @@
-openapi: 3.0.0
-info:
-  version: 1.0.0
-  title: Swagger Petstore
-  license:
-    name: MIT
-paths:
-  /pets:
-    get:
-      summary: List all pets
-      operationId: listPets
-      tags:
-        - pets
-      parameters:
-        - name: limit
-          in: query
-          description: How many items to return at one time (max 100)
-          required: false
-          schema:
-            type: integer
-            format: int32
-      responses:
-        '200':
-          description: An paged array of pets
-          headers:
-            x-next:
-              description: A link to the next page of responses
-              schema:
-                type: string
-          content:
-            application/json:
-              schema:
-                 type: object
-                 properties:
-                    id:
-                      type: integer
-                      format: int64
-                    name:
-                      type: string
-                    tag:
-                      type: string
\ No newline at end of file
diff --git a/modules/swagger-parser-v3/src/test/resources/issue-742.json b/modules/swagger-parser-v3/src/test/resources/issue-742.json
new file mode 100644
index 00000000..2532e464
--- /dev/null
+++ b/modules/swagger-parser-v3/src/test/resources/issue-742.json
@@ -0,0 +1,44 @@
+{
+    "openapi": "3.0.1",
+    "servers": [
+      {
+        "description": "An absolute path",
+        "url": "https://api.absolute.org/v2"
+      },
+      {
+        "description": "Server relative to root path",
+        "url": "/api/v2"
+      },
+      {
+        "description": "Server relative path 1",
+        "url": "path/v2"
+      },
+      {
+        "description": "Server relative path 2",
+        "url": "../v2"
+      }
+    ],
+    "info": {
+      "description": "This is a sample server",
+      "version": "1.0.0",
+      "title": "Issue 742 API",
+      "license": {
+        "name": "Apache-2.0",
+        "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
+      }
+    },
+    "paths": {
+      "/ping": {
+        "get": {
+          "summary": "Some ping operation",
+          "description": "Some ping operation",
+          "operationId": "doPing",
+          "responses": {
+            "201": {
+              "description": "OK"
+            }
+          }
+        }
+      }
+    }
+  }
\ No newline at end of file
diff --git a/modules/swagger-parser/src/test/java/io/swagger/parser/OpenAPIParserTest.java b/modules/swagger-parser/src/test/java/io/swagger/parser/OpenAPIParserTest.java
index ea9ac724..ca583b42 100644
--- a/modules/swagger-parser/src/test/java/io/swagger/parser/OpenAPIParserTest.java
+++ b/modules/swagger-parser/src/test/java/io/swagger/parser/OpenAPIParserTest.java
@@ -1,52 +1,15 @@
 package io.swagger.parser;
 
-import io.swagger.v3.oas.models.Components;
 import io.swagger.v3.oas.models.OpenAPI;
-import io.swagger.v3.oas.models.media.Schema;
-import io.swagger.v3.oas.models.PathItem;
-import io.swagger.v3.oas.models.media.Schema;
-import io.swagger.v3.oas.models.parameters.Parameter;
 import io.swagger.v3.parser.core.models.ParseOptions;
 import io.swagger.v3.parser.core.models.SwaggerParseResult;
 import io.swagger.v3.core.util.Json;
 import org.junit.Test;
-import java.util.Map;
-
-import java.util.List;
-import java.util.Map;
 
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 
 public class OpenAPIParserTest {
-    @Test
-    public void testIssue749() {
-        ParseOptions options = new ParseOptions();
-        options.setResolve(true);
-        SwaggerParseResult result = new OpenAPIParser().readLocation("issue749-main.yaml", null, options);
-        assertNotNull(result);
-
-        OpenAPI openAPI = result.getOpenAPI();
-        assertNotNull(openAPI);
-
-        Components components = openAPI.getComponents();
-        assertNotNull(components);
-
-        PathItem pathItem = openAPI.getPaths().get("/some/ping");
-        assertNotNull(pathItem);
-        List<Parameter> parameters = pathItem.getGet().getParameters();
-        assertNotNull(parameters);
-        assertEquals(parameters.size(), 1);
-        assertEquals(parameters.get(0).getName(), "i");
-        assertNotNull(parameters.get(0).getSchema());
-        assertEquals(parameters.get(0).getSchema().get$ref(), "#/components/schemas/SomeId");
-
-        Map<String, Schema> schemas = components.getSchemas();
-        assertNotNull(schemas);
-        assertEquals(schemas.size(), 1);
-        assertNotNull(schemas.get("SomeId"));
-    }
-
     @Test
     public void testSimple() {
         SwaggerParseResult result = new OpenAPIParser().readLocation("petstore.yaml", null, null);
@@ -56,25 +19,6 @@ public class OpenAPIParserTest {
         assertEquals(result.getOpenAPI().getOpenapi(), "3.0.1");
     }
 
-    @Test
-    public void testIssue768() {
-        ParseOptions options = new ParseOptions();
-        options.setResolve(true);
-        SwaggerParseResult result = new OpenAPIParser().readLocation("issue768-main.yaml", null, options);
-        assertNotNull(result);
-
-        OpenAPI openAPI = result.getOpenAPI();
-        assertNotNull(openAPI);
-
-        Components components = openAPI.getComponents();
-        assertNotNull(components);
-
-        Map<String, Schema> schemas = components.getSchemas();
-        assertNotNull(schemas);
-
-        assertEquals(schemas.size(), 1);
-    }
-
     @Test
     public void test30Url() {
         String location = "http://petstore.swagger.io/v2/swagger.json";
diff --git a/modules/swagger-parser/src/test/resources/issue749-main.yaml b/modules/swagger-parser/src/test/resources/issue749-main.yaml
deleted file mode 100644
index 0b907bc3..00000000
--- a/modules/swagger-parser/src/test/resources/issue749-main.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
-openapi: 3.0.1
-info:
-  title: ping test
-  version: '1.0'
-servers:
-  - url: 'http://localhost:8000/'
-paths:
-  /some/ping:
-    get:
-      operationId: pingGet
-      parameters:
-        - name: i
-          in: query
-          description: Test
-          required: true
-          schema:
-            $ref: './issue749-reference.yaml#/SomeId'
-      responses:
-        '201':
-          description: OK
-components:
-  schemas: {}
\ No newline at end of file
diff --git a/modules/swagger-parser/src/test/resources/issue749-reference.yaml b/modules/swagger-parser/src/test/resources/issue749-reference.yaml
deleted file mode 100644
index 8b956381..00000000
--- a/modules/swagger-parser/src/test/resources/issue749-reference.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-SomeId:
-  type: integer
-  format: int32
-  description: My value 123
-  example: 123
\ No newline at end of file
diff --git a/modules/swagger-parser/src/test/resources/issue768-main.yaml b/modules/swagger-parser/src/test/resources/issue768-main.yaml
deleted file mode 100644
index 26458e53..00000000
--- a/modules/swagger-parser/src/test/resources/issue768-main.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
-openapi: 3.0.0
-info:
-  title: ref test
-  version: '1.0'
-servers:
-  - url: 'http://localhost:8000/'
-paths:
-  /user/login:
-    post:
-      summary: Login
-      operationId: loginUser
-      requestBody:
-        required: true
-        content:
-          application/json:
-            schema:
-              $ref: "issue768-reference.yaml#/User"
-components:
-  schemas: {}
\ No newline at end of file
diff --git a/modules/swagger-parser/src/test/resources/issue768-reference.yaml b/modules/swagger-parser/src/test/resources/issue768-reference.yaml
deleted file mode 100644
index 7fa83ee5..00000000
--- a/modules/swagger-parser/src/test/resources/issue768-reference.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-User:
-  type: "object"
-  properties:
-    Name:
-      type: "string"
-    Password:
-      type: "string"
-      format: "password"
\ No newline at end of file