quarkus-smallrye-openapi - 无法解析参考:无法解析指针:/components/schemas
quarkus-smallrye-openapi - Could not resolve reference: Could not resolve pointer: /components/schemas
我有一个休息端点,它使用一个 class 作为 openapi 模式:
import javax.ws.rs.Path;
import org.eclipse.microprofile.openapi.annotations.media.Schema;
import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
@Path("/orders")
@RequestScoped
public class OrdersRest {
@APIResponse(responseCode = "200", description = "Create a new order", content = {
@Content(mediaType = "application/json", schema = @Schema(implementation = OrderDto.class)) })
public Response create(OrderDto request) throws SessionNotFound {
OrderDto class 有一个引用另一个 class 的属性,它存在于我的项目中:
public class SessionDto {
private SessionSettingsProperties[] sessionSettingsProperties;
当我访问 swagger-ui 时,我收到错误消息:
Errors
Resolver error at paths./session.get.responses.200.content.application/json.schema.properties.sessionSettingsProperties.items.$ref
Could not resolve reference: Could not resolve pointer: /components/schemas/SessionSettingsProperties does not exist in document
我正在使用 Quarkus 1.13。1.Final 版本。
我发现这个 issue in Quarkus project 看起来很相似,但我相信我遇到的问题并不完全相同。
我能够解决我的问题,包括在我的 SessionDto class 字段中添加一个 org.eclipse.microprofile.openapi.annotations.media.Schema 注释,如下所示:
import org.eclipse.microprofile.openapi.annotations.media.Schema;
public class SessionDto {
@Schema(implementation = SessionSettingsProperties[].class)
private SessionSettingsProperties[] sessionSettingsProperties;
我有一个休息端点,它使用一个 class 作为 openapi 模式:
import javax.ws.rs.Path;
import org.eclipse.microprofile.openapi.annotations.media.Schema;
import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
@Path("/orders")
@RequestScoped
public class OrdersRest {
@APIResponse(responseCode = "200", description = "Create a new order", content = {
@Content(mediaType = "application/json", schema = @Schema(implementation = OrderDto.class)) })
public Response create(OrderDto request) throws SessionNotFound {
OrderDto class 有一个引用另一个 class 的属性,它存在于我的项目中:
public class SessionDto {
private SessionSettingsProperties[] sessionSettingsProperties;
当我访问 swagger-ui 时,我收到错误消息:
Errors
Resolver error at paths./session.get.responses.200.content.application/json.schema.properties.sessionSettingsProperties.items.$ref
Could not resolve reference: Could not resolve pointer: /components/schemas/SessionSettingsProperties does not exist in document
我正在使用 Quarkus 1.13。1.Final 版本。
我发现这个 issue in Quarkus project 看起来很相似,但我相信我遇到的问题并不完全相同。
我能够解决我的问题,包括在我的 SessionDto class 字段中添加一个 org.eclipse.microprofile.openapi.annotations.media.Schema 注释,如下所示:
import org.eclipse.microprofile.openapi.annotations.media.Schema;
public class SessionDto {
@Schema(implementation = SessionSettingsProperties[].class)
private SessionSettingsProperties[] sessionSettingsProperties;