-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Description
It seems that whenever a model has a property that is a container (like a list) that swagger-ui renders the contained type as null. In the abbreviated swagger-spec json below generated by my rest api the type of the items is set to null, but the ref is set to ApiKey. I'm not sure if this is an issue with swagger-core putting null there or swagger-ui not following the ref type, but UI seemed more likely so I am posting here.
Given the models build by swagger-core is my expectation correct for swagger-ui's model schema, or is the null value in "type" the actual problem?
swagger-ui "Model Schema" for ApiKeysResponse (expected):
{
"keys": [
{
"id": "long",
}
]
}swagger-ui "Model Schema" for ApiKeysResponse (actual):
{
"keys": [
null
],
}built from swagger-core json response (abbreviated, removed extraneous fields):
{
"apis": [
{
"path": "/keys",
"operations": [
{
"method": "GET",
"responseMessages": [
{
"code": 200,
"message": "API key retrieval succeeded.",
"responseModel": "ApiKeysResponse"
}
]
}
]
}
],
"models": {
"ApiKeysResponse": {
"id": "ApiKeysResponse",
"name": "ApiKeysResponse",
"qualifiedType": "packageName.ApiKeysResponse",
"properties": {
"keys": {
"type": "List",
"qualifiedType": "List",
"items": {
"type": null,
"ref": "ApiKey",
"qualifiedType": "packageName.ApiKey"
}
}
}
},
"ApiKey": {
"id": "ApiKey",
"name": "ApiKey",
"qualifiedType": "packageName.ApiKey",
"properties": {
"id": {
"type": "long",
"qualifiedType": "long",
}
}
}
}
}