|
7 | 7 | import com.axway.apim.lib.CoreParameters; |
8 | 8 | import com.axway.apim.lib.error.AppException; |
9 | 9 | import com.axway.apim.lib.utils.Utils; |
| 10 | +import com.fasterxml.jackson.databind.JsonNode; |
10 | 11 | import com.fasterxml.jackson.databind.ObjectMapper; |
11 | 12 | import org.apache.commons.io.IOUtils; |
12 | 13 | import org.apache.http.util.Asserts; |
@@ -43,6 +44,23 @@ public void getAPISpecificationOpenApi() throws AppException { |
43 | 44 | Assert.assertNotNull(apiSpecification.getApiSpecificationContent()); |
44 | 45 | } |
45 | 46 |
|
| 47 | + @Test |
| 48 | + public void getAPISpecificationOpenApi31() throws AppException { |
| 49 | + String specDirPath = classLoader.getResource("com/axway/apim/adapter/spec").getFile(); |
| 50 | + APISpecification apiSpecification = APISpecificationFactory.getAPISpecification("openapi31.json", specDirPath, "petstore"); |
| 51 | + Assert.assertEquals(APISpecification.APISpecType.valueOf("OPEN_API_30"), apiSpecification.getAPIDefinitionType()); |
| 52 | + Assert.assertNotNull(apiSpecification.getDescription()); |
| 53 | + Assert.assertNotNull(apiSpecification.getApiSpecificationContent()); |
| 54 | + // openapi 3.1 specific attribute |
| 55 | + ObjectMapper mapper = apiSpecification.getMapper(); |
| 56 | + try { |
| 57 | + JsonNode node = mapper.readTree(apiSpecification.getApiSpecificationContent()); |
| 58 | + Assert.assertNotNull(node.get("info").get("summary").asText()); |
| 59 | + } catch (IOException e) { |
| 60 | + throw new RuntimeException(e); |
| 61 | + } |
| 62 | + } |
| 63 | + |
46 | 64 | @Test |
47 | 65 | public void getAPISpecificationSwagger2() throws AppException { |
48 | 66 | String specDirPath = classLoader.getResource("com/axway/apim/adapter/spec").getFile(); |
|
0 commit comments