Could not resolve pointer: /definitions/List does not exist in document
See original GitHub issueENV:
- springboot-2.0.2.RELEASE , springfox-swagger-ui-2.8.0 , springfox-swagger2-2.8.0
Q:
- I encapsulated a unified return object.
public class ResultVO<T> implements Serializable {
// Omit content
}
- I used swagger-ui on Controller as API doc . He works in these places and works very well.
@ApiOperation(value = "pageList", notes = "paging select", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value="/pageList",method={RequestMethod.GET,RequestMethod.POST})
@CtlResultAnnotation
public ResultVO<PageInfo<DicBase>> pageList(DicBase dicBase, @RequestParam(defaultValue="1") int pageNum,
@RequestParam(defaultValue="10") int pageSize, HttpServletRequest request){
// Omit content
}
@ApiOperation(value = "children", notes = "get children", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value="/children",method={RequestMethod.GET,RequestMethod.POST})
@CtlResultAnnotation
public ResultVO<List<DicBase>> getChildren(@RequestBody(required=false) DicBase dicBase){
// Omit content
}
@ApiOperation(value = "view", notes = "detail", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value="/view",method=RequestMethod.GET)
@CtlResultAnnotation
public ResultVO<DicBase> view(@RequestParam Long id){
// Omit content
}
- when I add this controller,I get an error on ‘swagger-ui.html’.
@ApiOperation(value = "dicValues", notes = "keys-values", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value="/dicValues",method=RequestMethod.POST)
@CtlResultAnnotation
public ResultVO<Map<String, List<DicBase>>> dicValues(@RequestParam(value = "keys[]") List<String> keys){
// Omit content
}
Errors
Resolver error at definitions.Map«string,List«DicBase»».additionalProperties.$ref
Could not resolve reference because of: Could not resolve pointer: /definitions/List does not exist in document
- Here is my swagger configuation. I know I should add ‘alternateTypeRules’, but I can not found a full document about this.
private ApiInfo setApiInfo(String title, String description, String teamService, String version) {
return new ApiInfoBuilder().title(title).description(description).termsOfServiceUrl(teamService).version(version).build();
}
@Bean
public Docket adminRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(setApiInfo("admin-api doc","(PMP)-system-api doc","https://blog.csdn.net/xu_san_duo", "1.0"))
.alternateTypeRules(
newRule(
typeResolver.resolve(
DeferredResult.class,
typeResolver.resolve(GenericType.class, WildcardType.class)
),
typeResolver.resolve(WildcardType.class)
)
)
.groupName("admin module")
.select()
.apis(RequestHandlerSelectors.basePackage("com.sdcm.web.controller.admin"))
.paths(PathSelectors.any())
.build();
}
- I want a standard or detailed way, I hope to get your help. Thanks.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:23 (5 by maintainers)
Top Results From Across the Web
Springfox Swagger: Could not resolve pointer - Stack Overflow
I was able to replicate this issue. enter image description here. This can be resolved by defining new AlternateTypeRules while creating ...
Read more >"Swagger Resolver" Errors in later versions of Reff app
I have now been seeing this in the later versions of reff app. Swagger can't resolve mappings to some resource documentations in the ......
Read more >Using $ref - Swagger
OAS 3 This guide is for OpenAPI 3.0. Using $ref. When you document an API, it is common to have some features which...
Read more >Could not resolve pointer: /definitions/List does not exist in ...
Could not resolve pointer : /definitions/List does not exist in document. swagger-springmvc. 19 July 2018 Posted by dingziyang ...
Read more >JSON Error For Swagger UI - Mendix Forum
schema.$ref Could not resolve reference because of: Could not resolve pointer: /definitions/ does not exist in document Thank you. asked 2018 ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was able to prevent the bad reference from being generated by adding this to my
Docket
.where my type was
Map<String, Map<String, List<String>>>
ButI still think an invalid spec should be created. Perhaps a warning with instructions on how to handle nested Generics more than n levels deep? If that is the accurate description. 😃
The same problem in 2.9.2 version~~~~!~!~!