Open variable opened 7 years ago
I'm also getting this, in a new django project, following the details here to get DRF set up (http://www.django-rest-framework.org/tutorial/quickstart/), and then the details in the README for this project to get RAML set up.
There's an error being thrown, which is caught at line 1114 of api-console.js
. The code there is trying to read the context_mark
or problem_mark
property of the error.
return ramlParser.loadPath($window.resolveUrl(url), null, $scope.options)
.then(function (raml) {
$scope.vm.raml = raml;
})
.catch(function (error) {
$scope.vm.error = angular.extend(error, {
/*jshint camelcase: false */
buffer: (error.context_mark || error.problem_mark).buffer
/*jshint camelcase: true */
});
})
.finally(function () {
$scope.vm.loaded = true;
})
The error doesn't have these properties, so the call to .buffer
on those properties fails. The error as caught (for me) is:
{
"stack": "Error: Api contains errors.\n at toError (http://127.0.0.1:8000/static/rest_framework_raml/scripts/api-console-vendor.js:2088:18)\n at http://127.0.0.1:8000/static/rest_framework_raml/scripts/api-console-vendor.js:2007:40\n at processQueue (http://127.0.0.1:8000/static/rest_framework_raml/scripts/api-console-vendor.js:425864:27)\n at http://127.0.0.1:8000/static/rest_framework_raml/scripts/api-console-vendor.js:425880:27\n at Scope.$eval (http://127.0.0.1:8000/static/rest_framework_raml/scripts/api-console-vendor.js:427116:28)\n at Scope.$digest (http://127.0.0.1:8000/static/rest_framework_raml/scripts/api-console-vendor.js:426932:31)\n at http://127.0.0.1:8000/static/rest_framework_raml/scripts/api-console-vendor.js:427155:26\n at completeOutstandingRequest (http://127.0.0.1:8000/static/rest_framework_raml/scripts/api-console-vendor.js:417486:10)\n at http://127.0.0.1:8000/static/rest_framework_raml/scripts/api-console-vendor.js:417874:7",
"message": "Api contains errors.",
"parserErrors": [
{
"code": 0,
"message": "type can be either of: string, number, integer, file, date or boolean",
"path": "raml",
"start": 546,
"end": 550,
"line": 17,
"column": 8,
"range": [
{
"line": 17,
"column": 8,
"position": 546
},
{
"line": 17,
"column": 12,
"position": 550
}
],
"isWarning": false
},
{
"code": 0,
"message": "type can be either of: string, number, integer, file, date or boolean",
"path": "raml",
"start": 1167,
"end": 1171,
"line": 36,
"column": 8,
"range": [
{
"line": 36,
"column": 8,
"position": 1167
},
{
"line": 36,
"column": 12,
"position": 1171
}
],
"isWarning": false
}
]
}
The RAML file being read from the API is :
#%RAML 0.8
/test/groups:
/{id}:
delete:
description: API endpoint that allows groups to be viewed or edited.
get:
description: API endpoint that allows groups to be viewed or edited.
patch:
description: API endpoint that allows groups to be viewed or edited.
put:
description: API endpoint that allows groups to be viewed or edited.
get:
description: API endpoint that allows groups to be viewed or edited.
queryParameters:
page:
description: null
required: false
type: null
post:
description: API endpoint that allows groups to be viewed or edited.
/test/users:
/{id}:
delete:
description: API endpoint that allows users to be viewed or edited.
get:
description: API endpoint that allows users to be viewed or edited.
patch:
description: API endpoint that allows users to be viewed or edited.
put:
description: API endpoint that allows users to be viewed or edited.
get:
description: API endpoint that allows users to be viewed or edited.
queryParameters:
page:
description: null
required: false
type: null
post:
description: API endpoint that allows users to be viewed or edited.
baseUri: http://127.0.0.1:8000/test/raml/
title: Test API
I'm having the same issue. I tried different versions of raml-codec
but it keeps failing. The problem is on the encode_ram
function ( encode.py
class). I can't retrieve a valid baseUri
form document
object.
I am getting a blank screen after loading icon briefly showing up.
Browser console displays the following error: