{"action":"created","issue":{"url":"https://api.github.com/repos/springfox/springfox/issues/755","repository_url":"https://api.github.com/repos/springfox/springfox","labels_url":"https://api.github.com/repos/springfox/springfox/issues/755/labels{/name}","comments_url":"https://api.github.com/repos/springfox/springfox/issues/755/comments","events_url":"https://api.github.com/repos/springfox/springfox/issues/755/events","html_url":"https://github.com/springfox/springfox/issues/755","id":80988920,"number":755,"title":"o.s.data.domain.Pageable - automatically add @ApiImplicitParams?","user":{"login":"steve-oakey","id":3990563,"avatar_url":"https://avatars.githubusercontent.com/u/3990563?v=3","gravatar_id":"","url":"https://api.github.com/users/steve-oakey","html_url":"https://github.com/steve-oakey","followers_url":"https://api.github.com/users/steve-oakey/followers","following_url":"https://api.github.com/users/steve-oakey/following{/other_user}","gists_url":"https://api.github.com/users/steve-oakey/gists{/gist_id}","starred_url":"https://api.github.com/users/steve-oakey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steve-oakey/subscriptions","organizations_url":"https://api.github.com/users/steve-oakey/orgs","repos_url":"https://api.github.com/users/steve-oakey/repos","events_url":"https://api.github.com/users/steve-oakey/events{/privacy}","received_events_url":"https://api.github.com/users/steve-oakey/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/springfox/springfox/labels/feature","name":"feature","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/springfox/springfox/milestones/38","html_url":"https://github.com/springfox/springfox/milestones/2.6.0","labels_url":"https://api.github.com/repos/springfox/springfox/milestones/38/labels","id":1803255,"number":38,"title":"2.6.0","description":"","creator":{"login":"dilipkrish","id":73257,"avatar_url":"https://avatars.githubusercontent.com/u/73257?v=3","gravatar_id":"","url":"https://api.github.com/users/dilipkrish","html_url":"https://github.com/dilipkrish","followers_url":"https://api.github.com/users/dilipkrish/followers","following_url":"https://api.github.com/users/dilipkrish/following{/other_user}","gists_url":"https://api.github.com/users/dilipkrish/gists{/gist_id}","starred_url":"https://api.github.com/users/dilipkrish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dilipkrish/subscriptions","organizations_url":"https://api.github.com/users/dilipkrish/orgs","repos_url":"https://api.github.com/users/dilipkrish/repos","events_url":"https://api.github.com/users/dilipkrish/events{/privacy}","received_events_url":"https://api.github.com/users/dilipkrish/received_events","type":"User","site_admin":false},"open_issues":27,"closed_issues":1,"state":"open","created_at":"2016-06-01T20:42:18Z","updated_at":"2016-06-15T11:27:55Z","due_on":"2016-09-01T05:00:00Z","closed_at":null},"comments":20,"created_at":"2015-05-26T14:31:41Z","updated_at":"2016-06-16T05:00:55Z","closed_at":null,"body":"Hi,\r\n\r\nI have been looking for but haven't found a way to automatically the implicit parameters of the Pageable parameter. It would be great to have the page, size and sort parameters automatically added to the Swagger documentation. I have tried Docket#directModelSubstitute but this has not worked.\r\n\r\nAny insight to this?"},"comment":{"url":"https://api.github.com/repos/springfox/springfox/issues/comments/226388671","html_url":"https://github.com/springfox/springfox/issues/755#issuecomment-226388671","issue_url":"https://api.github.com/repos/springfox/springfox/issues/755","id":226388671,"user":{"login":"hyeonu","id":1399880,"avatar_url":"https://avatars.githubusercontent.com/u/1399880?v=3","gravatar_id":"","url":"https://api.github.com/users/hyeonu","html_url":"https://github.com/hyeonu","followers_url":"https://api.github.com/users/hyeonu/followers","following_url":"https://api.github.com/users/hyeonu/following{/other_user}","gists_url":"https://api.github.com/users/hyeonu/gists{/gist_id}","starred_url":"https://api.github.com/users/hyeonu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyeonu/subscriptions","organizations_url":"https://api.github.com/users/hyeonu/orgs","repos_url":"https://api.github.com/users/hyeonu/repos","events_url":"https://api.github.com/users/hyeonu/events{/privacy}","received_events_url":"https://api.github.com/users/hyeonu/received_events","type":"User","site_admin":false},"created_at":"2016-06-16T05:00:55Z","updated_at":"2016-06-16T05:00:55Z","body":"@namkee I've modified for multiple sort parameter.\r\n\r\n```java\r\nimport static com.google.common.collect.Lists.newArrayList;\r\nimport static springfox.documentation.schema.ResolvedTypes.modelRefFactory;\r\nimport static springfox.documentation.spi.schema.contexts.ModelContext.inputParam;\r\n\r\nimport java.util.List;\r\n\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.core.MethodParameter;\r\nimport org.springframework.core.annotation.Order;\r\nimport org.springframework.data.domain.Pageable;\r\nimport org.springframework.stereotype.Component;\r\n\r\nimport com.fasterxml.classmate.ResolvedType;\r\nimport com.fasterxml.classmate.TypeResolver;\r\nimport com.google.common.base.Function;\r\n\r\nimport springfox.documentation.schema.ModelReference;\r\nimport springfox.documentation.schema.TypeNameExtractor;\r\nimport springfox.documentation.service.Parameter;\r\nimport springfox.documentation.spi.DocumentationType;\r\nimport springfox.documentation.spi.schema.contexts.ModelContext;\r\nimport springfox.documentation.spi.service.ParameterBuilderPlugin;\r\nimport springfox.documentation.spi.service.contexts.ParameterContext;\r\nimport springfox.documentation.swagger.common.SwaggerPluginSupport;\r\n\r\n@Component\r\n@Order(SwaggerPluginSupport.SWAGGER_PLUGIN_ORDER)\r\npublic class PageableParameterBuilderPlugin implements ParameterBuilderPlugin {\r\n  private final TypeNameExtractor nameExtractor;\r\n  private final TypeResolver resolver;\r\n\r\n  @Autowired\r\n  public PageableParameterBuilderPlugin(TypeNameExtractor nameExtractor, TypeResolver resolver) {\r\n    this.nameExtractor = nameExtractor;\r\n    this.resolver = resolver;\r\n  }\r\n\r\n  @Override\r\n  public boolean supports(DocumentationType delimiter) {\r\n    return true;\r\n  }\r\n\r\n  private Function<ResolvedType, ? extends ModelReference>\r\n      createModelRefFactory(ParameterContext context) {\r\n    ModelContext modelContext = inputParam(context.methodParameter().getParameterType(),\r\n        context.getDocumentationType(),\r\n        context.getAlternateTypeProvider(),\r\n        context.getGenericNamingStrategy(),\r\n        context.getIgnorableParameterTypes());\r\n    return modelRefFactory(modelContext, nameExtractor);\r\n  }\r\n\r\n  @Override\r\n  public void apply(ParameterContext context) {\r\n    MethodParameter parameter = context.methodParameter();\r\n    Class<?> type = parameter.getParameterType();\r\n    if (type != null && Pageable.class.isAssignableFrom(type)) {\r\n      Function<ResolvedType, ? extends ModelReference> factory =\r\n          createModelRefFactory(context);\r\n\r\n      ModelReference intModel = factory.apply(resolver.resolve(Integer.TYPE));\r\n      ModelReference stringModel = factory.apply(resolver.resolve(List.class, String.class));\r\n\r\n      List<Parameter> parameters = newArrayList(\r\n          context.parameterBuilder()\r\n              .parameterType(\"query\").name(\"page\").modelRef(intModel)\r\n              .description(\"Results page you want to retrieve (0..N)\")\r\n              .build(),\r\n          context.parameterBuilder()\r\n              .parameterType(\"query\").name(\"size\").modelRef(intModel)\r\n              .description(\"Number of recods per page\")\r\n              .build(),\r\n          context.parameterBuilder()\r\n              .parameterType(\"query\").name(\"sort\").modelRef(stringModel).allowMultiple(true)\r\n              .description(\"Sorting criteria in the format: property(,asc|desc). \"\r\n                  + \"Default sort order is ascending. \"\r\n                  + \"Multiple sort criteria are supported.\")\r\n              .build());\r\n\r\n      context.getOperationContext().operationBuilder().parameters(parameters);\r\n    }\r\n  }\r\n\r\n}\r\n```"}}
{"actor":{"display_login":"hyeonu"}}