I am not sure why I am getting the following error. It occurred after generating my Swagger resources via swagger-php
:
Uncaught TypeError: Cannot read property '$ref' of undefined swagger.js:698
SwaggerOperation swagger.js:698
SwaggerResource.addOperations swagger.js:471
SwaggerResource.addApiDeclaration swagger.js:402
obj.on.response swagger.js:357
res.response swagger.js:1307
EventEmitter.emit shred.bundle.js:1391
emit shred.bundle.js:1191
(anonymous function) shred.bundle.js:1211
setBodyAndFinish shred.bundle.js:1815
(anonymous function) shred.bundle.js:1832
EventEmitter.emit shred.bundle.js:1388
Response.handle shred.bundle.js:2715
xhr.onreadystatechange
My Swagger resources did not throw any upon doc generation. Here is what my resource looks like:
{
"basePath":"https://myapp.com/v1",
"swaggerVersion":"1.2.0",
"apiVersion":"1.0.0",
"resourcePath":"v1",
"apis":[
{
"path":"/copyResources/",
"description":"copyResources(): Handler to copy resources. Gets the user's home directory and prepends the home directory to each passed in path. Calls copyResources on the file controller with the full paths. This is available to users with the \"upload\" permission.",
"operations":[
{
"method":"GET",
"summary":"Copies the specified file paths to the specified destination path",
"nickname":"copyResources",
"parameters":[
{
"paramType":"query",
"name":"filePaths",
"type":"array",
"required":true,
"description":"Remote paths of the files or folders to copy"
},
{
"paramType":"query",
"name":"destinationPath",
"type":"string",
"required":true,
"description":"Remote destination path to copy files/folders to"
}
],
"responseMessages":[
{
"code":200,
"message":"OK"
}
]
}
]
},
{
"path":"/createFolder/",
"description":"createFolder(): Handler to create a new folder. Gets the user's home directory and calls create folder on the file controller with the full path. This is available to users with the \"upload\" permission.",
"operations":[
{
"method":"GET",
"summary":"Get the user's home directory and calls getFolders on the file controller with the full path",
"nickname":"createFolder",
"parameters":[
{
"paramType":"query",
"name":"folderName",
"type":"string",
"required":true,
"description":"Name of the folder to create"
},
{
"paramType":"query",
"name":"path",
"type":"string",
"required":true,
"description":"Where to create the folder"
}
],
"responseMessages":[
{
"code":200,
"message":"OK"
}
]
}
]
},
{
"path":"/getFolders/",
"description":"getFolders(): Handler to get folder list Gets the user's home directory and calls getFolders on the file controller with the full path",
"operations":[
{
"method":"GET",
"summary":"Get the user's home directory and calls getFolders on the file controller with the full path",
"nickname":"getFolders",
"parameters":[
{
"paramType":"query",
"name":"path",
"type":"string",
"required":true,
"description":"The remote file path"
}
],
"responseMessages":[
{
"code":200,
"message":"OK"
}
]
}
]
},
{
"path":"/getResourceList/",
"description":"getResourceList(): Handler for folder / file path listing Gets the user's home directory and calls getResourceList on the file controller with the full path. This is available to users with the \"list files\" permission.",
"operations":[
{
"method":"GET",
"summary":"Get a listing of files/folders for the specified path. Available for users with list files permission",
"nickname":"getResourceList",
"parameters":[
{
"paramType":"query",
"name":"path",
"type":"string",
"required":true,
"description":"The remote file path"
},
{
"paramType":"query",
"name":"sortBy",
"type":"string",
"required":true,
"description":"Sort according to attribute"
},
{
"paramType":"query",
"name":"sortOrder",
"type":"string",
"required":true,
"description":"Sort in either ascending or descending order"
},
{
"paramType":"query",
"name":"offset",
"type":"integer",
"required":true,
"description":"Determines which item to start on for pagination"
},
{
"paramType":"query",
"name":"limit",
"type":"integer",
"required":true,
"description":"The number of files to limit the result"
},
{
"paramType":"query",
"name":"detailed",
"type":"boolean",
"description":"If true, returns sharedFolder, notifications or other objects associated with specified path"
},
{
"paramType":"query",
"name":"pattern",
"type":"string",
"description":"Regex string. If not null, perform a search with specified pattern"
}
],
"responseMessages":[
{
"code":200,
"message":"OK"
}
]
}
]
},
{
"path":"/moveResources/",
"description":"moveResources(): Handler to move resources. Gets the user's home directory and prepends it to each passed in path. Calls moveResources on the file controller with the full paths. This is available to users with the \"upload\" permission.",
"operations":[
{
"method":"GET",
"summary":"Moves the specified file paths to the specified destination path",
"nickname":"moveResources",
"parameters":[
{
"paramType":"query",
"name":"filePaths",
"type":"array",
"required":true,
"description":"Remote paths of the files or folders to move"
},
{
"paramType":"query",
"name":"destinationPath",
"type":"string",
"required":true,
"description":"Remote destination path to move files/folders to"
}
],
"responseMessages":[
{
"code":200,
"message":"OK"
}
]
}
]
}
],
"produces":[
"application/json",
"application/xml",
"text/plain",
"text/html"
]
}