Java 未显示值的@ApiModel和@apimodelpropty虚张声势注释
我想记录我的模型,但招摇过市的注释不能正常工作。顺便说一句,我正在使用osgi 在Rest界面中,im使用:Java 未显示值的@ApiModel和@apimodelpropty虚张声势注释,java,rest,swagger,Java,Rest,Swagger,我想记录我的模型,但招摇过市的注释不能正常工作。顺便说一句,我正在使用osgi 在Rest界面中,im使用: import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Sche
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
当我转到“大摇大摆”编辑器时,它工作得很好,出现了描述
但当我使用
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
不起作用。我找到了swagger编辑器,将de yaml粘贴到那里,没有对字段/模型的描述
我正在使用dependecy:
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.0</version>
<scope>provided</scope>
</dependency>
财产:
@ApiModelProperty(value = "description")
private String typeDescription;
如何在yaml上显示:
"typeDescription" : {
"type" : "string"
},
大摇大摆的用户界面:
typeDescription string
我认为继承也不起作用,因为在swagger编辑器中,FooBase显示如下在swagger编辑器中显示如下:
FooBase:
type: object
properties:
id:
type: string
description:
type: string
discriminator:
propertyName: type
CreateFooBaseRequest:
type: object
properties:
fooBase:
$ref: '#/components/schemas/FooBase'
CreateFooBaseResponse:
type: object
properties:
fooBase:
$ref: '#/components/schemas/FooBase'
但在扩展FooBase的Foo类中,出现了:
allOf:
- $ref: '#/components/schemas/FooBase'
有两个类扩展了FooBase。例:
@ApiModel(description = "foo",
subTypes = {Foo.class, FooTwo.class})
请注意,这是一个示例
但它不起作用…嘿,你能弄明白吗?看起来您正在导入v3,但使用的注释仅在以前的版本中。嘿,我现在先使用合同,所以我没有任何问题。嘿,您能解决这个问题吗?看起来您正在导入v3,但使用的注释仅在以前的版本中。嘿,我现在先使用合同,所以我没有任何问题。
@ApiModel(description = "foo",
subTypes = {Foo.class, FooTwo.class})