Create Connexion schema composed from several files in a nested directory structure.
Project description
Connexion Compose
Purpose
Create Connexion schema composed from several files in a nested directory structure.
Resulting schema automatically includes common defaults, which you can use or override.
Requires Python 3.7+
Installation
pip install connexion-compose
Usage
from connexion_compose import compile_schema
spec_dir = 'some/dir'
schema = compile_schema(spec_dir)
The compile_schema
function traverses the specification directory and all subdirectories,
creating YAML attributes according to the directory structure.
The bottom level files are "headers" and top level features, usually all contained in headers.py.
For example, given the following directory structure:
├── 10-header.yml
├── 90-footer.yml
├── definitions
│ └── 50-whatever.yml
├── parameters
│ ├── 10-par1.yml
│ └── 20-par2.yml
└── x
└── y
└── z.yml
The resulting object will correspond to the following YAML input:
[contents of 10-header.yml]
[contents of 90-footer.yml]
definitions:
[contents of 50-whatever.yml]
parameters:
[contents of 10-par1.yml]
[contents of 20-par2.yml]
x:
y:
[contents of z.yml]
Defaults
swagger: '2.0'
info:
contact: {name: Please add a contact name}
description: Please add a description
title: Please add a title
version: 0.0.0
x-visibility: unlisted
basePath: /
schemes: [https]
consumes: [application/json]
produces: [application/json]
definitions:
Currency: {format: iso_4217, type: string}
Decimal: {format: decimal, type: string}
Path: {format: path, type: string}
Timestamp: {format: rfc_3339, type: string}
URL: {format: url, type: string}
UUID: {format: uuid, type: string}
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
File details
Details for the file connexion-compose-0.3.2.tar.gz
.
File metadata
- Download URL: connexion-compose-0.3.2.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1c0cd79f398f45cf14e98ad67540d2369083094262c867b594d457040f66c0e |
|
MD5 | 577016ebb0affc5d11b3113ffd456587 |
|
BLAKE2b-256 | 480960f16cc1d447222c8f3c99ff1e14568221f335ccbc0d21fd0970c2b11dac |