@TaskAction
  public void generateSpec() throws IOException, GenerateException {
    ClassLoader loader = projectClassLoader();
    Set<Class<?>> classes = new HashSet<>();

    for (String pkg : apiPackages) {
      Reflections reflections =
          new Reflections(
              new ConfigurationBuilder()
                  .addClassLoaders(loader)
                  .addUrls(ClasspathHelper.forPackage(pkg, loader))
                  .setExpandSuperTypes(false)
                  .filterInputsBy(new FilterBuilder().includePackage(pkg)));
      Set<Class<?>> springMVCClasses =
          reflections.getTypesAnnotatedWith(
              org.springframework.web.bind.annotation.RestController.class);
      classes.addAll(springMVCClasses);
    }

    SpringMvcApiReader reader = new SpringMvcApiReader(new Swagger(), log);
    Swagger swagger = reader.read(classes);

    for (SwaggerFilter filter : filters) {
      filter.apply(swagger);
    }

    Yaml.pretty().writeValue(swaggerFile, swagger);
  }
An ordered list of SwaggerFilter instances to apply to the generated Swagger definition before
writing it out.
buildSrc/src/main/java/com/amazonaws/blox/tasks/GenerateSwaggerModel.java