Search in sources :

Example 1 with SwaggerGeneratorContext

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());
}
Also used : CompositeSwaggerGeneratorContext(io.servicecomb.swagger.generator.core.CompositeSwaggerGeneratorContext) CompositeSwaggerGeneratorContext(io.servicecomb.swagger.generator.core.CompositeSwaggerGeneratorContext) SwaggerGeneratorContext(io.servicecomb.swagger.generator.core.SwaggerGeneratorContext) Test(org.junit.Test)

Example 2 with SwaggerGeneratorContext

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());
}
Also used : CompositeSwaggerGeneratorContext(io.servicecomb.swagger.generator.core.CompositeSwaggerGeneratorContext) CompositeSwaggerGeneratorContext(io.servicecomb.swagger.generator.core.CompositeSwaggerGeneratorContext) SwaggerGeneratorContext(io.servicecomb.swagger.generator.core.SwaggerGeneratorContext) Test(org.junit.Test)

Example 3 with SwaggerGeneratorContext

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;
}
Also used : SwaggerGenerator(io.servicecomb.swagger.generator.core.SwaggerGenerator) CompositeSwaggerGeneratorContext(io.servicecomb.swagger.generator.core.CompositeSwaggerGeneratorContext) SwaggerGeneratorContext(io.servicecomb.swagger.generator.core.SwaggerGeneratorContext)

Example 4 with SwaggerGeneratorContext

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;
}
Also used : SwaggerGenerator(io.servicecomb.swagger.generator.core.SwaggerGenerator) CompositeSwaggerGeneratorContext(io.servicecomb.swagger.generator.core.CompositeSwaggerGeneratorContext) SwaggerGeneratorContext(io.servicecomb.swagger.generator.core.SwaggerGeneratorContext)

Aggregations

CompositeSwaggerGeneratorContext (io.servicecomb.swagger.generator.core.CompositeSwaggerGeneratorContext)4 SwaggerGeneratorContext (io.servicecomb.swagger.generator.core.SwaggerGeneratorContext)4 SwaggerGenerator (io.servicecomb.swagger.generator.core.SwaggerGenerator)2 Test (org.junit.Test)2