Search in sources :

Example 1 with MyClass

use of io.swagger.v3.jaxrs2.resources.MyClass in project swagger-core by swagger-api.

the class ReaderTest method testModelResolverXMLPropertiesName.

@Test(description = "Resolve Model with XML Properties starting with is prefix per #2635")
public void testModelResolverXMLPropertiesName() {
    final MyClass myClass = new MyClass();
    myClass.populate("isotonicDrink value", "softDrink value", "isoDrink value", "isotonicDrinkOnlyXmlElement value");
    Map<String, Schema> schemas = resolveJaxb(MyClass.class);
    assertNull(schemas.get("MyClass").getProperties().get("isotonicDrink"));
    assertNotNull(schemas.get("MyClass").getProperties().get("beerDrink"));
    assertNotNull(schemas.get("MyClass").getProperties().get("saltDrink"));
    // No JsonProperty or ApiModelProperty, keep original name
    assertNull(schemas.get("MyClass").getProperties().get("beerDrinkXmlElement"));
    assertNotNull(schemas.get("MyClass").getProperties().get("isotonicDrinkOnlyXmlElement"));
}
Also used : MyClass(io.swagger.v3.jaxrs2.resources.MyClass) IntegerSchema(io.swagger.v3.oas.models.media.IntegerSchema) ArraySchema(io.swagger.v3.oas.models.media.ArraySchema) Schema(io.swagger.v3.oas.models.media.Schema) Test(org.testng.annotations.Test)

Aggregations

MyClass (io.swagger.v3.jaxrs2.resources.MyClass)1 ArraySchema (io.swagger.v3.oas.models.media.ArraySchema)1 IntegerSchema (io.swagger.v3.oas.models.media.IntegerSchema)1 Schema (io.swagger.v3.oas.models.media.Schema)1 Test (org.testng.annotations.Test)1