Skip to main content

wtforms-jsonschema converts WTForms into JSON Schema compatibile representations

Project description


wtforms-jsonschema converts WTForms into JSON Schema compatibile representations


  • Python 2.6 or later
  • Wtforms


To convert a form to a JSON Schema:

from wtforms_jsonschema.jsonschema import WTFormToJSONSchema

schema_repr = WTFormToJSONSchema().convert_form(MyForm)

TODO: To embed a JSON Schema as a form field:

from wtforms_jsonschema.forms import JSONSchemaField

#where schema is a python dictionay like schema_repr in the first exmaple

class MyForm(forms.Form):
    subfield = JSONSchemaField(schema=schema)

form = MyForm(data={'subfield':'<json encoded value>'})
form.validate() #will validate the subfield entry against schema
form['subfield'].as_widget() #will render a textarea widget with a data-schemajson attribute

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wtforms-jsonschema-0.0.7.tar.gz (3.3 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page