【发布时间】:2021-07-22 23:42:21
【问题描述】:
我使用的是 springfox 3.0.0,并且我有一个用作@RequestBody 的接口。
pom.xml
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
SwaggerConfig.java
class SwaggerConfig {
@Bean
Docket api() {
return new Docket(OAS_30)
.select()
.apis(RequestHandlerSelectors.basePackage(
"org.springframework.boot").negate())
.build();
}
}
型号
//assume Lombok or standard getter/setters/constructors
class Clazz implements StringInterface {
String s;
Integer i;
}
@JsonDeserialize(as = Clazz.class)
interface StringInterface {
String getString();
}
在 Springfox 2.9.* 中,StringInterface 的架构是
{
"title": "StringInterface",
"type": "object",
"properties": {
"s": {
"type": "String"
}
}
}
但是,当我升级到 3.0.0 时,架构现在是空的。
{
"title": "StringInterface",
"type": "object"
}
常规类正确显示。似乎只有接口有问题。
【问题讨论】:
-
你使用什么依赖?你能展示你的招摇配置吗
-
@user3696953 我更新了问题