Comments (3)
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 pif 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 callableTraceback (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.
#%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.
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)
- Global mediaType ignored in parsing of body HOT 1
- Order not conserved HOT 3
- parser does not include body in put request HOT 3
- submit 0.1.1 to pypi HOT 2
- Docs HOT 1
- RAML parser failed with attribute error HOT 1
- Validation shall fail on double entries (e.g. double `title`)
- Can't export to new RAML/YAML files HOT 4
- Grabbing raml over network fails in both python 2 & 3
- mediaType support
- Defining JSON body using native RAML? HOT 3
- side-effect on other modules using PyYAML HOT 2
- Support RAML 1.0 HOT 1
- Update to latest https://pypi.org/project/PyYAML HOT 2
- ValidationError using !include for response example HOT 2
- Query parameters in HTTP methods HOT 3
- uriParameters support HOT 3
- PyPI release HOT 1
- Numeric API versions crashing parser HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyraml-parser.