This is a simple library that is an extension of the Springdoc-Openapi library
This library adds support of the QueryDsl @QuerydslPredicate annotation to Springdoc-Openapi library
It is also very customizable and supports any annotation (ships with @QuerydslPredicate annotation support but more coming later).
Add to your build.gradle
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.gibahjoe:springdoc-param-customizer:[version]'
}
There are 2 ways to use this library. Both involve creating a bean in your spring project.
Registering QuerydslPredicateOperationCustomizer.java as a bean (see below)
@Configuration
public class WebConfiguration implements WebMvcConfigurer {
//some config
@Bean
public QuerydslPredicateOperationCustomizer querydslPredicateOperationCustomizer(QuerydslBindingsFactory querydslBindingsFactory) {
return new QuerydslPredicateOperationCustomizer(querydslBindingsFactory);
}
//other config
}
Using AnnotatedParameterCustomizer.java (a bean that helps to intercept any annotated spring method param for you to customise) and adding the inbuilt DefaultQuerydslPredicateCustomizer. See example below using querydsl customizer
import com.devappliance.springdocparamcustomizer.AnnotatedParameterCustomizer;
import com.devappliance.springdocparamcustomizer.customizerImpl.DefaultQuerydslPredicateCustomizer;
@Configuration
public class WebConfiguration implements WebMvcConfigurer {
//some config
@Bean
public AnnotatedParameterCustomizer annotatedParameterCustomizer(Optional<OpenAPI> openAPI, ObjectProvider<EntityPathResolver> resolver) {
return new AnnotatedParameterCustomizer(openAPI)
.addCustomizer(new DefaultQuerydslPredicateCustomizer(new QuerydslBindingsFactory(resolver.getIfAvailable(() -> SimpleEntityPathResolver.INSTANCE))));
}
//Ensure to include a bean of your openapi too in your config
@Bean
public OpenAPI openApi() {
return new OpenAPI();
}
//other config
}
The above example uses the inbuilt DefaultQuerydslPredicateCustomizer which displays QueryDslPredicate parameters properly in OpenApi document
Please file feature requests and bugs at the issue tracker.