Search in sources :

Example 21 with In

use of io.swagger.v3.oas.models.security.SecurityScheme.In in project swagger-parser by swagger-api.

the class V2ConverterTest method testIssue6.

@Test(description = "Default value in parameters")
public void testIssue6() throws Exception {
    OpenAPI oas = getConvertedOpenAPIFromJsonFile(ISSUE_6_JSON);
    assertEquals(DEFAULT_VALUE, oas.getPaths().get(PETS_PATH).getGet().getParameters().get(0).getSchema().getDefault());
}
Also used : OpenAPI(io.swagger.v3.oas.models.OpenAPI) Test(org.testng.annotations.Test)

Example 22 with In

use of io.swagger.v3.oas.models.security.SecurityScheme.In in project swagger-parser by swagger-api.

the class V2ConverterTest method testIssue745.

@Test(description = "Issue in converting server url in RFC 3986 format from OpenAPI Spec 2 to Open API Spec 3")
public void testIssue745() throws Exception {
    OpenAPI oas = getConvertedOpenAPIFromJsonFile(ISSUE_745_YAML);
    assertTrue(oas.getServers().get(0).getUrl().startsWith("//"));
}
Also used : OpenAPI(io.swagger.v3.oas.models.OpenAPI) Test(org.testng.annotations.Test)

Example 23 with In

use of io.swagger.v3.oas.models.security.SecurityScheme.In in project swagger-parser by swagger-api.

the class V2ConverterTest method testIssue13.

@Test(description = "Extensions in External Docs")
public void testIssue13() throws Exception {
    OpenAPI oas = getConvertedOpenAPIFromJsonFile(ISSUE_13_JSON);
    assertNotNull(oas.getExternalDocs());
}
Also used : OpenAPI(io.swagger.v3.oas.models.OpenAPI) Test(org.testng.annotations.Test)

Example 24 with In

use of io.swagger.v3.oas.models.security.SecurityScheme.In in project swagger-parser by swagger-api.

the class V2ConverterTest method testPreserveBodyParameterName.

@Test(description = "OpenAPI v2 Converter: Ensure body name is preserved in x-codegen-request-body-name extension")
public void testPreserveBodyParameterName() throws Exception {
    final OpenAPI oas = getConvertedOpenAPIFromJsonFile(ISSUE_762_JSON);
    assertNotNull(oas);
    assertEquals(oas.getPaths().get("/").getPut().getExtensions().get("x-codegen-request-body-name"), "pet");
}
Also used : OpenAPI(io.swagger.v3.oas.models.OpenAPI) Test(org.testng.annotations.Test)

Example 25 with In

use of io.swagger.v3.oas.models.security.SecurityScheme.In in project swagger-parser by swagger-api.

the class V2ConverterTest method testIssue758.

@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);
}
Also used : OpenAPI(io.swagger.v3.oas.models.OpenAPI) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)130 OpenAPI (io.swagger.v3.oas.models.OpenAPI)108 Parameter (io.swagger.v3.oas.models.parameters.Parameter)51 Schema (io.swagger.v3.oas.models.media.Schema)49 StringSchema (io.swagger.v3.oas.models.media.StringSchema)44 OpenAPIV3Parser (io.swagger.v3.parser.OpenAPIV3Parser)40 ArraySchema (io.swagger.v3.oas.models.media.ArraySchema)39 QueryParameter (io.swagger.v3.oas.models.parameters.QueryParameter)39 Operation (io.swagger.v3.oas.annotations.Operation)36 SwaggerParseResult (io.swagger.v3.parser.core.models.SwaggerParseResult)36 IntegerSchema (io.swagger.v3.oas.models.media.IntegerSchema)31 Operation (io.swagger.v3.oas.models.Operation)28 PathItem (io.swagger.v3.oas.models.PathItem)27 ObjectSchema (io.swagger.v3.oas.models.media.ObjectSchema)27 ComposedSchema (io.swagger.v3.oas.models.media.ComposedSchema)25 ParseOptions (io.swagger.v3.parser.core.models.ParseOptions)25 Map (java.util.Map)25 HashMap (java.util.HashMap)23 PathParameter (io.swagger.v3.oas.models.parameters.PathParameter)22 ApiResponses (io.swagger.v3.oas.annotations.responses.ApiResponses)21