我正在编写Open API 3.0规范并尝试在Swagger UI v 3.18.3中渲染response links。
例:
openapi: 3.0.0
info:
title: Test
version: '1.0'
tags:
- name: Artifacts
paths:
/artifacts:
post:
tags:
- Artifacts
operationId: createArtifact
requestBody:
content:
application/octet-stream:
schema:
type: string
format: binary
responses:
201:
description: create
headers:
Location:
schema:
type: string
format: uri
example: /artifacts/100
content:
application/json:
schema:
type: object
properties:
artifactId:
type: integer
format: int64
links:
Read Artifact:
operationId: getArtifact
parameters:
artifact-id: '$response.body#/artifactId'
/artifacts/{artifact-id}:
parameters:
- name: artifact-id
in: path
required: true
schema:
type: integer
format: int64
get:
tags:
- Artifacts
operationId: getArtifact
responses:
200:
description: read
content:
application/octet-stream:
schema:
type: string
format: binary
呈现如下链接:
这是预期的吗?我问,因为operationId
暴露在UI上,parameters
显示为JSON参考,使得它看起来像是没有正确显示。我本来期望一个超链接或东西带我到Swagger网页中与链接引用的API相对应的相应部分。
是的,这就是Swagger UI目前如何渲染OAS3 links
。渲染links
是their OAS3 support backlog上的事情之一:
OAS 3.0支持积压 这是Swagger-UI尚不支持的OAS3规范功能的集合票证。 ... []链接不能用于暂存另一个操作 []链接级服务器不可用于执行请求