Giter Site home page Giter Site logo

Comments (3)

an2deg avatar an2deg commented on August 24, 2024

Hi!

Could you provide your schema.raml? It would be very helpful for
reproducing this bug.

Best regards,
On Jul 19, 2015 9:49 AM, "Bright" [email protected] wrote:

from flask import Flask
app = Flask(name)
import pyraml.parser

@app.route("/")
def hello():
p= pyraml.parser.load('schema.raml')
return p

if name == "main":
app.run(host='0.0.0.0',port=8087,debug=True,threaded=True)

it throws an exception, did I miss something?

TypeError
TypeError: 'RamlRoot' object is not callable

Traceback (most recent call last)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1836, in
call
return self.wsgi_app(environ, start_response)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1820, in
wsgi_app
response = self.make_response(self.handle_exception(e))
File "/Library/Python/2.7/site-packages/flask/app.py", line 1403, in
handle_exception
reraise(exc_type, exc_value, tb)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1817, in
wsgi_app
response = self.full_dispatch_request()
File "/Library/Python/2.7/site-packages/flask/app.py", line 1478, in
full_dispatch_request
response = self.make_response(rv)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1577, in
make_response
rv = self.response_class.force_type(rv, request.environ)
File "/Library/Python/2.7/site-packages/werkzeug/wrappers.py", line 841,
in force_type
response = BaseResponse(*_run_wsgi_app(response, environ))
File "/Library/Python/2.7/site-packages/werkzeug/test.py", line 867, in
run_wsgi_app
app_rv = app(environ, start_response)
TypeError: 'RamlRoot' object is not callable


Reply to this email directly or view it on GitHub
#24.

from pyraml-parser.

BrightZliu avatar BrightZliu commented on August 24, 2024

#%RAML 0.8
title: Amazon simple storage API
version: 1
baseUri: https://{destinationBucket}.s3.amazonaws.com
/:
post:
description: The POST operation adds an object to a specified bucket using HTML forms.
body:
application/x-www-form-urlencoded:
formParameters:
AWSAccessKeyId:
description: The AWS Access Key ID of the owner of the bucket who grants an Anonymous user access for a request that satisfies the set of constraints in the Policy.
type: string
acl:
description: Specifies an Amazon S3 access control list. If an invalid access control list is specified, an error is generated.
type: string
file:
- type: string
description: Text content. The text content must be the last field in the form.
- type: file
description: File to upload. The file must be the last field in the form.

BTW, it could work via shell command like

import pyraml.parser
p= pyraml.parser.load('schema.raml')
print p
{'title': 'Amazon simple storage API', 'baseUri': 'https://{destinationBucket}.s3.amazonaws.com', 'documentation': None, 'mediaType': None, 'securitySchemes': None, 'resourceTypes': None, 'version': 1, 'resources': OrderedDict([('/', {'displayName': None, 'methods': OrderedDict([('post', {'body': OrderedDict([('application/x-www-form-urlencoded', {'notNull': None, 'formParameters': OrderedDict([('AWSAccessKeyId', {'repeat': None, 'displayName': None, 'name': None, 'default': None, 'pattern': None, 'enum': None, 'maximum': None, 'required': None, 'minimum': None, 'minLength': None, 'maxLength': None, 'type': 'string', 'example': None, 'description': 'The AWS Access Key ID of the owner of the bucket who grants an Anonymous user access for a request that satisfies the set of constraints in the Policy.'}), ('acl', {'repeat': None, 'displayName': None, 'name': None, 'default': None, 'pattern': None, 'enum': None, 'maximum': None, 'required': None, 'minimum': None, 'minLength': None, 'maxLength': None, 'type': 'string', 'example': None, 'description': 'Specifies an Amazon S3 access control list. If an invalid access control list is specified, an error is generated.'}), ('file', [{'repeat': None, 'displayName': None, 'name': None, 'default': None, 'pattern': None, 'enum': None, 'maximum': None, 'required': None, 'minimum': None, 'minLength': None, 'maxLength': None, 'type': 'string', 'example': None, 'description': 'Text content. The text content must be the last field in the form.'}, {'repeat': None, 'displayName': None, 'name': None, 'default': None, 'pattern': None, 'enum': None, 'maximum': None, 'required': None, 'minimum': None, 'minLength': None, 'maxLength': None, 'type': 'file', 'example': None, 'description': 'File to upload. The file must be the last field in the form.'}])]), 'example': None, 'schema': None})]), 'description': 'The POST operation adds an object to a specified bucket using HTML forms.', 'queryParameters': None, 'headers': None, 'notNull': None, 'baseUriParameters': None, 'protocols': None, 'responses': None})]), 'description': None, 'uriParameters': None, 'is_': None, 'baseUriParameters': None, 'type': None, 'resources': None, 'securedBy': None})]), 'traits': None, 'baseUriParameters': None, 'raml_version': u'0.8', 'protocols': ['HTTPS'], 'schemas': None}

from pyraml-parser.

an2deg avatar an2deg commented on August 24, 2024

Hi,

I think you should return either string or Response object. I don't know
what should be on output of your view function (Json encoded object?)

Best regards,
On Jul 19, 2015 1:08 PM, "Bright" [email protected] wrote:

#%RAML 0.8
title: Amazon simple storage API
version: 1
baseUri: https://{destinationBucket}.s3.amazonaws.com
/:
post:
description: The POST operation adds an object to a specified bucket using
HTML forms.
body:
application/x-www-form-urlencoded:
formParameters:
AWSAccessKeyId:
description: The AWS Access Key ID of the owner of the bucket who grants
an Anonymous user access for a request that satisfies the set of
constraints in the Policy.
type: string
acl:
description: Specifies an Amazon S3 access control list. If an invalid
access control list is specified, an error is generated.
type: string
file:

  • type: string
    description: Text content. The text content must be the last field in the
    form.
  • type: file
    description: File to upload. The file must be the last field in the form.

BTW, it could work via shell command like

import pyraml.parser
p= pyraml.parser.load('schema.raml')
print p
{'title': 'Amazon simple storage API', 'baseUri': 'https://
{destinationBucket}.s3.amazonaws.com', 'documentation': None,
'mediaType': None, 'securitySchemes': None, 'resourceTypes': None,
'version': 1, 'resources': OrderedDict([('/', {'displayName': None,
'methods': OrderedDict([('post', {'body':
OrderedDict([('application/x-www-form-urlencoded', {'notNull': None,
'formParameters': OrderedDict([('AWSAccessKeyId', {'repeat': None,
'displayName': None, 'name': None, 'default': None, 'pattern': None,
'enum': None, 'maximum': None, 'required': None, 'minimum': None,
'minLength': None, 'maxLength': None, 'type': 'string', 'example': None,
'description': 'The AWS Access Key ID of the owner of the bucket who grants
an Anonymous user access for a request that satisfies the set of
constraints in the Policy.'}), ('acl', {'repeat': None, 'displayName':
None, 'name': None, 'default': None, 'pattern': None, 'enum': None,
'maximum': None, 'required': None, 'minimum': None, 'minLength': Non e,
'maxL ength': None, 'type': 'string', 'example': None, 'description':
'Specifies an Amazon S3 access control list. If an invalid access control
list is specified, an error is generated.'}), ('file', [{'repeat': None,
'displayName': None, 'name': None, 'default': None, 'pattern': None,
'enum': None, 'maximum': None, 'required': None, 'minimum': None,
'minLength': None, 'maxLength': None, 'type': 'string', 'example': None,
'description': 'Text content. The text content must be the last field in
the form.'}, {'repeat': None, 'displayName': None, 'name': None, 'default':
None, 'pattern': None, 'enum': None, 'maximum': None, 'required': None,
'minimum': None, 'minLength': None, 'maxLength': None, 'type': 'file',
'example': None, 'description': 'File to upload. The file must be the last
field in the form.'}])]), 'example': None, 'schema': None})]),
'description': 'The POST operation adds an object to a specified bucket
using HTML forms.', 'queryParameters': None, 'headers': None, 'notNu ll':
Non e, 'baseUriParameters': None, 'protocols': None, 'responses': None})]),
'description': None, 'uriParameters': None, 'is_': None,
'baseUriParameters': None, 'type': None, 'resources': None, 'securedBy':
None})]), 'traits': None, 'baseUriParameters': None, 'raml_version':
u'0.8', 'protocols': ['HTTPS'], 'schemas': None}


Reply to this email directly or view it on GitHub
#24 (comment)
.

from pyraml-parser.

Related Issues (20)

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.