Skip to main content

UNKNOWN

Project description

.. image:: https://drone.io/bitbucket.org/eodolphi/flask-json-resource/status.png
:target: https://drone.io/bitbucket.org/eodolphi/flask-json-resource/latest



Flask JSON Resource
=============

Quickly create REST api's using `json-schema`.


Installation
------------

pip install flask_json_resource


Minimal Example
-------------------

.. code-block:: python

from flask import Flask

from json_hyper_schema import Schema
from flask_json_resource.api import API

app = Flask('test')
app.debug = True
config = {'backend': 'mongo', 'host': 'localhost', 'db': 'test'}
app.config['JSON_RESOURCE'] = config

api = API(app)


class TestResource(api.Resource):
schema = Schema({
'id': '/schema/test',
'properties': {
'id': {'type': 'string', 'required': True},
'foo': {'type': 'string'},
},
'links': [
{'href': '/{id}/', 'rel': 'self'},
{'href': '/', 'rel': 'create'},
{'href': '/', 'rel': 'collection'}
]
})

api.register(TestResource)

Project details


Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page