use of io.servicecomb.swagger.converter.property.StringPropertyConverter in project java-chassis by ServiceComb.
the class ConverterMgr method initConverters.
private static void initConverters() {
// inner converters
for (Class<? extends Property> propertyCls : PROPERTY_MAP.keySet()) {
addInnerConverter(propertyCls);
}
converterMap.put(RefProperty.class, new RefPropertyConverter());
converterMap.put(ArrayProperty.class, new ArrayPropertyConverter());
converterMap.put(MapProperty.class, new MapPropertyConverter());
converterMap.put(StringProperty.class, new StringPropertyConverter());
converterMap.put(ModelImpl.class, new ModelImplConverter());
converterMap.put(RefModel.class, new RefModelConverter());
converterMap.put(BodyParameter.class, new BodyParameterConverter());
converterMap.put(PendingBodyParameter.class, new PendingBodyParameterConverter());
AbstractSerializableParameterConverter converter = new AbstractSerializableParameterConverter();
converterMap.put(QueryParameter.class, converter);
converterMap.put(PathParameter.class, converter);
converterMap.put(HeaderParameter.class, converter);
converterMap.put(FormParameter.class, converter);
converterMap.put(CookieParameter.class, converter);
}
use of io.servicecomb.swagger.converter.property.StringPropertyConverter in project java-chassis by ServiceComb.
the class TestProperty method testStringProperty.
@Test
public void testStringProperty() {
SwaggerGenerator generator = new SwaggerGeneratorForTest(context, null);
List<String> enums = Arrays.asList("testStringProperty_a", "testStringProperty_b");
StringProperty sp = new StringProperty();
sp._enum(enums);
StringPropertyConverter spc = new StringPropertyConverter();
JavaType jt = spc.convert(generator.getClassLoader(), generator.ensureGetPackageName(), generator.getSwagger(), sp);
StringProperty spNew = (StringProperty) ModelConverters.getInstance().readAsProperty(jt);
Assert.assertEquals(enums, spNew.getEnum());
}
Aggregations