有一个令人头疼的问题。
我的OneOf数组“项目”在API文档中重复,如下所示:
我的猜测是,问题出在实体模型的类prop或api文件中。
models / entity.json
BCC_ACR_CR BCC_ACR_CU BCC_ACR_FE BCC_ACR_MN BCC_ACR_MO
0.2826027 0 0.58420346 0 0.2105587
0.27986588 0 0.58501168 0 0.20890705
0.27986588 0 0.58501168 0 0.20890705
0.27986588 0 0.58501168 0 0.20890705
0.28038733 0 0.58196375 0 0.21239142
0.26855376 0 0.60364524 0 0.11205138
0.27220042 0 0.60349573 0 0.11530944
0.36294869 0 0.50515464 0 0
0.36294869 0 0.50515464 0 0
0.40837234 0 0.47202708 0 0
0.3643896 0 0.50431576 0 0
0.3643896 0 0.50431576 0 0
0.35885258 0 0.50978952 0 0
schema / entity / api.json
{
"$id": "entity.json",
"type": "object",
"additionalProperties": false,
"required": ["id", "countryCode", "class"],
"properties": {
"id": {
"readOnly": true,
"allOf": [{
"$ref": "./uuid.json"
}],
"description": "UUID of entity",
"example": "49ad7378-121c-4a53-9894-dfd14a7b4877"
},
"countryCode": {
"type": "string",
"description": "Country code",
"example": "SE",
"pattern": "[A-Z][A-Z]"
},
"class": {
"description": "Entity classification",
"oneOf":[
{
"$ref": "./person.json"
},
{
"$ref": "./sme.json"
},
{
"$ref": "./corp.json"
}
]
},
这是oneOf中的模式模型的结构方式。
models / person.json
"post": {
"summary": "Create an entitiy",
"operationId": "createEntity",
"tags": [
"entities"
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/entity"
}
}
}
},