Skip to main content

Nadia: automatic generation of Marshmallow Schemas for OpenAPI 3 schemas.

Project description

License: MIT Build Status Documentation Status codecov

nadia is a small and lightweight library for creating marshmallow Schemas from schemas defined in your OpenAPI spec.

Basic usage

import yaml
import nadia.api

with open('petstore.yaml') as petstore:
    data = yaml.load(petstore)

builder = nadia.api.SchemaBuilder.create()
schema = builder.build(data['components']['schemas']['Pet'])

valid_pet = {'id': 100, 'name': 'Doggo', 'tag': 'sometag'}
invalid_pet = {'id': 'foo', 'name': 'Lessie', 'tag': ['tag1', 'tag2']}

print('Validation errors for Doggo: {}'.format(schema.validate({'content': valid_pet})))
print('Validation errors for Lessie: {}'.format(schema.validate({'content': invalid_pet})))

Documentation

Documentation can be found at http://nadia.readthedocs.io/en/latest/

Feature overview

Currently nadia supports all of the OpenAPI 3 data types, except allOf/anyOf fields. Most of the options like required, nullable, etc. are also supported.

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

nadia-0.1.5.tar.gz (12.8 kB view details)

Uploaded Source

File details

Details for the file nadia-0.1.5.tar.gz.

File metadata

  • Download URL: nadia-0.1.5.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for nadia-0.1.5.tar.gz
Algorithm Hash digest
SHA256 991c90196caac23e78459fa248d1114c8976ad3da3a180686c6d65f973120087
MD5 286ea7c0e19a86e9ccfd36cc9d784a4b
BLAKE2b-256 383b2dda8883d5804081fa0d4fe1453c16f961dff145c26faba30a4093dd900c

See more details on using hashes here.

Supported by

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