我试图显示仅针对401响应状态代码的自定义示例(覆盖默认示例值),但是由于某些原因,以下代码将不执行此操作(默认值保留在原位置)Status.Code和Status.Verbal不会设置,“代理”对象也不会进入内容。
paths:
/api/Users/Login:
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/LoginCredentials'
responses:
'200':
description: Login OK / Agent Object
content:
'*/*':
schema:
$ref: '#/components/schemas/RestResponse'
example:
Content:
schema:
$ref: '#/components/schemas/Agent'
'401':
description: Incorrect credentials
content:
'*/*':
schema:
$ref: '#/components/schemas/RestResponse'
example:
Status:
Verbal: Error
Code: 1074
Content: null
components:
schemas:
Agent:
type: object
RestResponse:
type: object
properties:
Status:
type: object
properties:
Verbal:
type: string
example: Success
Code:
type: string
format: int32
example: 104
Content:
type: object
Exception:
type: object
LoginCredentials:
type: object
required:
- UserName
- Password
properties:
UserName:
type: string
format: email
example: user@not.net
Password:
type: string
example: password
我希望看到的是响应示例: 200:
{
"Status": {
"Verbal": "Success",
"Code": 104
},
"Content": "Agent{}"
}
401:
{
"Status": {
"Verbal": "Error",
"Code": 1074
},
"Content": null
}