use of io.servicecomb.swagger.generator.core.SwaggerGeneratorContext in project java-chassis by ServiceComb.
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());
}
use of io.servicecomb.swagger.generator.core.SwaggerGeneratorContext in project java-chassis by ServiceComb.
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 io.servicecomb.swagger.generator.core.SwaggerGeneratorContext in project java-chassis by ServiceComb.
the class AbstractSchemaFactory method generateSwagger.
protected SwaggerGenerator generateSwagger(CONTEXT context) {
SwaggerGeneratorContext generatorContext = compositeSwaggerGeneratorContext.selectContext(context.getProviderClass());
SwaggerGenerator generator = new SwaggerGenerator(generatorContext, context.getProviderClass());
generator.setPackageName(SchemaUtils.generatePackageName(context.getMicroserviceMeta(), context.getSchemaId()));
generator.generate();
// 确保接口是存在的
ClassUtils.getOrCreateInterface(generator);
return generator;
}
use of io.servicecomb.swagger.generator.core.SwaggerGeneratorContext in project java-chassis by ServiceComb.
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;
}
Aggregations