【发布时间】:2020-12-24 03:51:05
【问题描述】:
我试图让组件在使用 OpenAPI 3.0 Java 注释时嵌套在一起。但是,在另一个对象中引用的每个对象都被创建为 $ref 而不是构建为该字段节点。如果没有 $ref,我怎样才能让它嵌套在下面?
例如:
public class User{
int id;
String name;
ContactInfo contactInfo;
}
public class ContactInfo{
String email;
String phone;
}
作为
components:
schemas:
User:
type: object
properties:
id:
type: integer
name:
type: string
contact_info:
# The value of this property is an object
type: object
properties:
email:
type: string
format: email
phone:
type: string
而不是
components:
schemas:
User:
type: object
properties:
id:
type: integer
name:
type: string
contactInfo: {
$ref: "#/components/schemas/ContactInfo"
}
ContactInfo:
type: object
properties:
email:
type: string
format: email
phone:
type: string
【问题讨论】:
标签: java openapi openapi-generator springdoc