smart-doc/doc/error.md

31 lines
657 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

api-doc对Spring mvc或者SpringBoot应用的Controller接口返回做了一些强制规约一旦在代码中使用
这些被api-doc不推荐的接口返回类型api-doc将会直接报错。
# 违反规约的实例
## 直接返回Object
```
/**
* 返回object
* @return
*/
@GetMapping("/test/Object")
public Object getMe(){
return null;
}
```
报错提示Please do not return java.lang.Object directly in api interface.
## 将非String对象作为Map的key然后将map作为接口中返回
```
/**
* 测试object的作为map的key
* @return
*/
@GetMapping("/test/map")
public Map<Object,Object> objectMap(){
return null;
}
```