GithubHelp home page GithubHelp logo

Blank screen about django-rest-raml HOT 2 OPEN

tomchristie avatar tomchristie commented on July 21, 2024
Blank screen

from django-rest-raml.

Comments (2)

keyz182 avatar keyz182 commented on July 21, 2024

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

from django-rest-raml.

jdgarcia1381 avatar jdgarcia1381 commented on July 21, 2024

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.

from django-rest-raml.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.