springfox.documentation.service.VendorExtension Java Examples

The following examples show how to use springfox.documentation.service.VendorExtension. 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: ApiParamReader.java    From swagger-more with Apache License 2.0 6 votes vote down vote up
@Override
public void apply(ParameterContext context) {
    ResolvedType resolvedType = context.resolvedMethodParameter().getParameterType();
    Class erasedType = resolvedType.getErasedType();
    if (isGeneratedType(erasedType)) {
        context.parameterBuilder()
                .parameterType("body").name(erasedType.getSimpleName())
                .description("Not a real parameter, it is a parameter generated after assembly.");
        return;
    }
    Optional<ApiParam> optional = readApiParam(context);
    if (optional.isPresent()) {
        ApiParam apiParam = optional.get();
        List<VendorExtension> extensions = buildExtensions(resolvedType);
        context.parameterBuilder().name(emptyToNull(apiParam.name()))
                .description(emptyToNull(resolver.resolve(apiParam.value())))
                .parameterType(TypeUtils.isComplexObjectType(erasedType) ? "body" : "query")
                .order(SWAGGER_PLUGIN_ORDER)
                .hidden(false)
                .parameterAccess(emptyToNull(apiParam.access()))
                .defaultValue(emptyToNull(apiParam.defaultValue()))
                .allowMultiple(apiParam.allowMultiple())
                .allowEmptyValue(apiParam.allowEmptyValue())
                .required(apiParam.required())
                .scalarExample(new Example(apiParam.example()))
                .complexExamples(examples(apiParam.examples()))
                .collectionFormat(apiParam.collectionFormat())
                .vendorExtensions(extensions);
    }
}
 
Example #2
Source File: SwaggerConfig.java    From quartz-manager with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
private ApiInfo apiInfo() {
	String title = "QUARTZ MANAGER API";
	String description = "Quartz Manager - REST API";
	String version = "1.0.0";
	String termsOfServiceUrl = null;
	Contact contact = null;
	String license = "Apache License 2.0";
	String licenseUrl = "https://github.com/fabioformosa/quartz-manager/blob/master/LICENSE";
	List<VendorExtension> vendorExtension = Collections.emptyList();
	return new ApiInfo(title, description, version, termsOfServiceUrl, contact, license, licenseUrl, vendorExtension);
}
 
Example #3
Source File: ApiParamReader.java    From swagger-more with Apache License 2.0 4 votes vote down vote up
private List<VendorExtension> buildExtensions(ResolvedType resolvedType) {
    List<VendorExtension> extensions = Lists.newArrayList();
    extensions.add(new StringVendorExtension("className", resolvedType.toString()));
    return extensions;
}