-
-
Notifications
You must be signed in to change notification settings - Fork 486
Closed
Description
error message
failed to resolve \"definitions\" in fragment in URI: \"#/definitions/BaseDictResp\": struct field \"definitions\" not found
Preliminary Analysis
kin-openapi/openapi2conv/openapi2_conv.go
Line 550 in cea0a13
| func toV3AdditionalProperties(from openapi3.AdditionalProperties) openapi3.AdditionalProperties { |
fails to handle additionalProperties.items, which results in item.$refs not being properly converted by toV3Ref. As a consequence, the following remains unchanged:
"items": {
"$ref": "#/definitions/BaseDictResp"
}This leads to the inability to find #/definitions/BaseDictResp.
test openapi2 json
{
"swagger": "2.0",
"info": {
"description": "Test for additionalProperties",
"version": "v1",
"title": "API Test"
},
"host": "Test",
"paths": {
"/map": {
"post": {
"summary": "api test summary",
"description": "api test description",
"operationId": "apiTestUsingPOST",
"consumes": ["application/json"],
"produces": ["*/*"],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/ResponseOfMap"
}
}
}
}
}
},
"definitions": {
"BaseDictResp": {
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "key of map"
},
"value": {
"type": "string",
"description": "value of map"
}
},
"title": "BaseDictResp",
"description": "BaseDictResp description"
},
"ResponseOfMap": {
"type": "object",
"properties": {
"data": {
"type": "object",
"description": "response data",
"additionalProperties": {
"type": "array",
"items": {
"$ref": "#/definitions/BaseDictResp"
}
}
}
},
"title": "ResponseOfMap"
}
}
}Metadata
Metadata
Assignees
Labels
No labels