Skip to main content
[![Build Status](https://travis-ci.org/dutradda/falcon-swagger.svg?branch=master)](https://travis-ci.org/dutradda/falcon-swagger)
[![Coverage Status](https://coveralls.io/repos/github/dutradda/falcon-swagger/badge.svg?branch=master)](https://coveralls.io/github/dutradda/falcon-swagger?branch=master)

# falcon-swagger
A Falcon Framework (http://falconframework.org) Extension.

Features:
- Supports Swagger Schema 2.0 (OpenAPI 2.0);
- Provides SQLAlchemy models base classes (with Redis integration, if you want);
- Provides Redis models base classes (without SQLAlchemy).

Usage Example:

```python
from falconswagger import SwaggerAPI, ModelHttpMeta

class HelloModelMeta(ModelHttpMeta):
__schema__ = {
'/hello/you/{name}': {
'get': {
'parameters': [{
'name': 'name',
'in': 'path',
'required': True,
'type': 'string'
}],
'operationId': 'get_hello_you',
'responses': {'200': {'description': 'Got you'}}
}
},
'/hello/world': {
'get': {
'operationId': 'get_hello_world',
'responses': {'200': {'description': 'Got hello'}}
}
}
}

def get_hello_you(cls, req, resp):
you = req.context['parameters']['path']['name']
resp.body = 'Hello {}!\n'.format(you)

def get_hello_world(cls, req, resp):
resp.body = 'Hello World!\n'

class HelloModel(metaclass=HelloModelMeta):
pass

api = SwaggerAPI([HelloModel], title='Hello API')
```

```bash
gunicorn hello_word_api:api
```

```bash
curl -i localhost:8000/hello/world
```

```text
HTTP/1.1 200 OK
Server: gunicorn/19.6.0
Connection: close
content-length: 13
content-type: application/json; charset=UTF-8

Hello World!
```

```bash
curl -i localhost:8000/hello/you/Diogo
```

```text
HTTP/1.1 200 OK
Server: gunicorn/19.6.0
Connection: close
content-length: 13
content-type: application/json; charset=UTF-8

Hello Diogo!
```


```bash
curl -i localhost:8000/swagger.json
```

```json
HTTP/1.1 200 OK
Server: gunicorn/19.6.0
Connection: close
content-length: 672
content-type: application/json; charset=UTF-8

{
"swagger": "2.0",
"paths": {
"/hello/world": {
"get": {
"operationId": "HelloModel.get_hello_world",
"responses": {
"200": {
"description": "Got hello"
}
}
}
},
"/hello/you/{name}": {
"get": {
"operationId": "HelloModel.get_hello_you",
"responses": {
"200": {
"description": "Got you"
}
},
"parameters": [
{
"in": "path",
"type": "string",
"required": true,
"name": "name"
}
]
}
}
},
"info": {
"title": "Hello API",
"version": "1.0.0"
}
}
```

Metadata

Release files for falcon-swagger 0.14.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for falcon-swagger 0.14.4
File Size Uploaded
falcon-swagger-0.14.4.tar.gz 25.4 kB Details

Release files / falcon-swagger-0.14.4.tar.gz

Download URL falcon-swagger-0.14.4.tar.gz
Size 25.4 kB
Tags Source
SHA-256 checksum
How to use checksums
53676e75cca57898fa26b07aa4775904f9a47dfb65a779eb67895e3641f3c7ec
BLAKE2b-256 checksum
How to use checksums
8957751687292aaf5498d883aa0b76a305bffcc6564d7b6255ebfc58ff7b9526
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.14.4 This release

1 release file

0.14.3

1 release file

0.14.2

1 release file

0.14.1

1 release file

0.14.0

1 release file

0.13.0

1 release file

0.12.7

1 release file

0.12.6

1 release file

0.12.5

1 release file

0.12.4

1 release file

0.12.3

1 release file

0.12.2

1 release file

0.12.1

1 release file

0.12.0

1 release file

0.11.1

1 release file

0.11.0

1 release file

0.10.0

0.9.4

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.9.1

1 release file

0.8.4

1 release file

0.8.3

1 release file

0.8.2

1 release file

0.8.1

1 release file

0.8.0

1 release file

0.7.0

1 release file

0.6.0

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page