Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
import com.github.tomakehurst.wiremock.client.WireMock;
import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
import io.swagger.v3.core.util.Json31;
import io.swagger.v3.core.util.Yaml31;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.parser.OpenAPIV3Parser;
import io.swagger.v3.parser.core.models.ParseOptions;
import io.swagger.v3.parser.core.models.SwaggerParseResult;
Expand All @@ -23,7 +20,6 @@
import java.io.IOException;
import java.net.HttpURLConnection;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.Random;

import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
Expand Down Expand Up @@ -220,32 +216,6 @@ public void testAnchorUnresolve() throws Exception {
compare("$anchor-not-found", swaggerParseResult);
}

@Test (enabled = false)
public void testa() throws Exception {
ParseOptions parseOptions = new ParseOptions();
parseOptions.setResolve(true);
//parseOptions.setResolveFully(true);
//
SwaggerParseResult result = new OpenAPIV3Parser().readLocation("http://localhost:8002/api/v31/openapi.json", null, parseOptions);
// SwaggerParseResult result = new OpenAPIV3Parser().readLocation("https://petstore31.swagger.io/api/v31/openapi.json", null, parseOptions);
OpenAPI openAPI = result.getOpenAPI();

if (result.getMessages() != null) {
result.getMessages()
.forEach(System.err::println); // validation errors and warnings
}

if (openAPI != null) {
final Map<String, Schema> schemas = openAPI.getComponents()
.getSchemas();
/* schemas.entrySet()
.stream()
.forEach(this::printSchema);*/
}
Yaml31.prettyPrint(openAPI);
}


public void compare(String dir, SwaggerParseResult result) throws Exception {
ObjectMapper mapper = Json31.mapper().copy();
mapper.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
Expand Down
Loading