springfox.documentation.schema.TypeNameExtractor Java Examples

The following examples show how to use springfox.documentation.schema.TypeNameExtractor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PageableParameterBuilderPluginTest.java    From jhipster with Apache License 2.0 6 votes vote down vote up
@BeforeEach
public void setup() throws Exception {
    MockitoAnnotations.initMocks(this);
    Method method = this.getClass().getMethod("test", new Class<?>[]{Pageable.class, Integer.class});
    resolver = new TypeResolver();
    RequestHandler handler = new WebMvcRequestHandler(new HandlerMethodResolver(resolver), null, new
        HandlerMethod(this, method));
    DocumentationContext docContext = mock(DocumentationContext.class);
    RequestMappingContext reqContext = new RequestMappingContext(docContext, handler);
    builder = spy(new OperationBuilder(null));
    context = new OperationContext(builder, RequestMethod.GET, reqContext, 0);
    List<TypeNameProviderPlugin> plugins = new LinkedList<>();
    extractor = new TypeNameExtractor(resolver, SimplePluginRegistry.create(plugins), new
        JacksonEnumTypeDeterminer());
    plugin = new PageableParameterBuilderPlugin(extractor, resolver);
}
 
Example #2
Source File: SuccessPlugin.java    From BlogManagePlatform with Apache License 2.0 5 votes vote down vote up
public SuccessPlugin(TypeNameExtractor typeNameExtractor, TypeResolver typeResolver, SwaggerProperties properties) {
	this.typeNameExtractor = typeNameExtractor;
	this.typeResolver = typeResolver;
	this.useCustomerizedPluggins = properties.getUseCustomerizedPluggins();
	okMessage = SwaggerUtil.statusDescription((item) -> {
		return item.getStatus() == HttpStatus.OK;
	});
	ResponseMessageBuilder messageBuilder = new ResponseMessageBuilder();
	messageBuilder.code(HttpStatus.OK.value());
	messageBuilder.message(okMessage);
	messageBuilder.responseModel(new ModelRef(SwaggerModel.class.getSimpleName()));
	okResponses.add(messageBuilder.build());
	okResult = typeResolver.resolve(SwaggerModel.class);
}
 
Example #3
Source File: ParametersReader.java    From Resource with GNU General Public License v3.0 5 votes vote down vote up
@Autowired
public ParametersReader(DescriptionResolver descriptions, TypeNameExtractor nameExtractor, TypeResolver resolver)
{
    this.nameExtractor = nameExtractor;
    this.resolver = resolver;
    this.descriptions = descriptions;
}
 
Example #4
Source File: SwaggerPluginsAutoConfigurationTest.java    From jhipster with Apache License 2.0 5 votes vote down vote up
@Test
public void testPageableParameterBuilderPlugin() {
    TypeResolver resolver = new TypeResolver();
    List<TypeNameProviderPlugin> plugins = new LinkedList<>();
    TypeNameExtractor extractor = new TypeNameExtractor(resolver, SimplePluginRegistry.create(plugins), new JacksonEnumTypeDeterminer());
    PageableParameterBuilderPlugin plugin = pagePluginConfig.pageableParameterBuilderPlugin(extractor, resolver);
    assertThat(plugin.getResolver()).isEqualTo(resolver);
    assertThat(plugin.getNameExtractor()).isEqualTo(extractor);
}
 
Example #5
Source File: ApiMethodReader.java    From swagger-more with Apache License 2.0 4 votes vote down vote up
@Autowired
public ApiMethodReader(DescriptionResolver resolver, TypeNameExtractor typeNameExtractor) {
    this.resolver = resolver;
    this.typeNameExtractor = typeNameExtractor;
}
 
Example #6
Source File: PageableParameterBuilderPlugin.java    From spring-cloud-gray with Apache License 2.0 4 votes vote down vote up
public PageableParameterBuilderPlugin(TypeNameExtractor nameExtractor, TypeResolver resolver) {
    this.nameExtractor = nameExtractor;
    this.resolver = resolver;
    this.pageableType = resolver.resolve(Pageable.class);
}
 
Example #7
Source File: SwaggerPluginsAutoConfiguration.java    From albedo with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public PageableParameterBuilderPlugin pageableParameterBuilderPlugin(TypeNameExtractor typeNameExtractor, TypeResolver typeResolver) {
	return new PageableParameterBuilderPlugin(typeNameExtractor, typeResolver);
}
 
Example #8
Source File: PageableParameterBuilderPlugin.java    From albedo with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Autowired
public PageableParameterBuilderPlugin(TypeNameExtractor nameExtractor, TypeResolver resolver) {
	this.nameExtractor = nameExtractor;
	this.resolver = resolver;
	this.pageableType = resolver.resolve(Page.class);
}
 
Example #9
Source File: PageableParameterBuilderPlugin.java    From albedo with GNU Lesser General Public License v3.0 4 votes vote down vote up
TypeNameExtractor getNameExtractor() {
	return nameExtractor;
}
 
Example #10
Source File: ResponseMessageReader.java    From Resource with GNU General Public License v3.0 4 votes vote down vote up
public ResponseMessageReader(TypeNameExtractor typeNameExtractor, TypeResolver typeResolver)
{
    super(typeNameExtractor, typeResolver);
    this.typeNameExtractor = typeNameExtractor;
    this.typeResolver = typeResolver;
}
 
Example #11
Source File: SwaggerPluginsAutoConfiguration.java    From jhipster with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public PageableParameterBuilderPlugin pageableParameterBuilderPlugin(TypeNameExtractor typeNameExtractor,
                                                                     TypeResolver typeResolver) {
    return new PageableParameterBuilderPlugin(typeNameExtractor, typeResolver);
}
 
Example #12
Source File: PageableParameterBuilderPlugin.java    From jhipster with Apache License 2.0 4 votes vote down vote up
TypeNameExtractor getNameExtractor() {
    return nameExtractor;
}
 
Example #13
Source File: PageableParameterBuilderPlugin.java    From jhipster with Apache License 2.0 2 votes vote down vote up
/**
 * <p>Constructor for PageableParameterBuilderPlugin.</p>
 *
 * @param nameExtractor a {@link springfox.documentation.schema.TypeNameExtractor} object.
 * @param resolver a {@link com.fasterxml.classmate.TypeResolver} object.
 */
public PageableParameterBuilderPlugin(TypeNameExtractor nameExtractor, TypeResolver resolver) {
    this.nameExtractor = nameExtractor;
    this.resolver = resolver;
    this.pageableType = resolver.resolve(Pageable.class);
}