我正在尝试为我要调用的REST接口手动创建OpenAPI定义(它们为我提供了示例有效负载)。
{
"Accounts": [
{
"ID": "",
"Name": "testIDMissing",
"Sales Force Active Status": "False",
"Sales Force Type": "Prospect",
"Sales Force Cost Center": "9938 ICP/DCO/Regional",
"FNC SAP Sold To Number": ""
},
{
"ID": "001345340017Hvk3A7C",
"Name": "Project Performance Group create",
"Sales Force Active Status": "True",
"Sales Force Type": "Integrator",
"Sales Force Cost Center": "9995 Channels",
"FNC SAP Sold To Number": "18815"
},
{
"ID": "00134535017Hvk3AAC",
"Name": "Project Performance Group Update",
"Sales Force Active Status": "True",
"Sales Force Type": "Integrator",
"Sales Force Cost Center": "9999",
"FNC SAP Sold To Number": "99"
},
{
"ID": "NoName",
"Name": "",
"Sales Force Active Status": "",
"Sales Force Type": "",
"Sales Force Cost Center": "",
"FNC SAP Sold To Number": ""
}
]
}
我有这个:
requestBody:
description: Account Objects
content:
application/json:
schema:
$ref: '#/components/schemas/Accounts'
...
components:
schemas:
Accounts:
type: array
items:
$ref: '#/components/schemas/Account'
example:
- ID:1
Name:testIDMissing
Sales Force Active Status:False
Sales Force Type:Prospect
Sales Force Cost Center:9938 ICP/DCO/Regional
FNC SAP Sold To Number:1111
- ID:2
Name:anotherExample
Sales Force Active Status:True
Sales Force Type:Prospect
Sales Force Cost Center:9937 ICP/DCO/Regional
FNC SAP Sold To Number:2222
Account:
type: object
properties:
ID:
type: string
description: Account ID in SFDC
Sales Force Active Status:
type: string
description: Is Account Active
enum:
- False
- True
Sales Force Type:
type: string
Sales Force Cost Center:
type: string
FNC SAP Sold To Number:
type: string
xml:
name: Account
哪个让我靠近。邮递员生成这样的示例:
[
{
"ID": "<string>",
"Sales Force Active Status": "<string>",
"Sales Force Type": "<string>",
"Sales Force Cost Center": "<string>",
"FNC SAP Sold To Number": "<string>"
},
{
"ID": "<string>",
"Sales Force Active Status": "<string>",
"Sales Force Type": "<string>",
"Sales Force Cost Center": "<string>",
"FNC SAP Sold To Number": "<string>"
}
]
看来我已经很接近了。我不确定我需要添加什么或如何定义Accounts
对象以使其正确。