use of org.apache.servicecomb.swagger.generator.core.SwaggerGeneratorContext in project incubator-servicecomb-java-chassis by apache.
the class UnitTestSwaggerUtils method generateSwagger.
public static SwaggerGenerator generateSwagger(Class<?> cls) {
SwaggerGeneratorContext context = compositeContext.selectContext(cls);
SwaggerGenerator generator = new SwaggerGenerator(context, cls);
generator.generate();
return generator;
}
use of org.apache.servicecomb.swagger.generator.core.SwaggerGeneratorContext in project incubator-servicecomb-java-chassis by apache.
the class AbstractSchemaFactory method generateSwagger.
protected SwaggerGenerator generateSwagger(CONTEXT context) {
SwaggerGeneratorContext generatorContext = compositeSwaggerGeneratorContext.selectContext(context.getProviderClass());
SwaggerGenerator generator = new SwaggerGenerator(generatorContext, context.getProviderClass());
generator.setClassLoader(context.getMicroserviceMeta().getClassLoader());
generator.setPackageName(SchemaUtils.generatePackageName(context.getMicroserviceMeta(), context.getSchemaId()));
generator.generate();
// 确保接口是存在的
ClassUtils.getOrCreateInterface(generator);
return generator;
}
use of org.apache.servicecomb.swagger.generator.core.SwaggerGeneratorContext in project incubator-servicecomb-java-chassis by apache.
the class TestSpringmvc method testComposite.
@Test
public void testComposite() {
CompositeSwaggerGeneratorContext composite = new CompositeSwaggerGeneratorContext();
SwaggerGeneratorContext context = composite.selectContext(Echo.class);
Assert.assertEquals(SpringmvcSwaggerGeneratorContext.class, context.getClass());
}
use of org.apache.servicecomb.swagger.generator.core.SwaggerGeneratorContext in project incubator-servicecomb-java-chassis by apache.
the class TestJaxrs method testComposite.
@Test
public void testComposite() {
CompositeSwaggerGeneratorContext composite = new CompositeSwaggerGeneratorContext();
SwaggerGeneratorContext context = composite.selectContext(Echo.class);
Assert.assertEquals(JaxrsSwaggerGeneratorContext.class, context.getClass());
}
Aggregations