Skip to main content

chalice-spec

Python package Code style: black

Chalice × APISpec × Pydantic plug-ins

Combines the power of Chalice, APISpec, and Pydantic to make AWS Chalice apps easily documented

Installation

First, add chalice-spec:

poetry add chalice_spec

We consider Chalice, APISpec, and Pydantic "peer dependencies." We only include them as dev dependencies in our codebase, and you may need to install them in yours if you haven't already.

poetry add chalice apispec pydantic

Setup

First, instantiate your APISpec object with both the Pydantic and Chalice plug-ins, assuming you need the functionality of each. While the Pydantic plugin can be used alone, you currently must use the Pydantic plugin with the Chalice plugin.

app = Chalice(app_name="hello_world")
spec = APISpec(chalice_app=app,
               ...,
               plugins=[PydanticPlugin(), ChalicePlugin()])

If you use:

ChalicePlugin(generate_default_docs=True)

the plugin will generate empty docs (with empty request and response schemas) for every endpoint that you've defined in your app. This can be useful as a starting point / overview while developing.

Usage

To document your API, use your existing Pydantic models and add kwargs to Chalice decorators.

Before:

@app.route('/', methods=["POST"])
def example():
    body = MySchema.parse_obj(app.current_request.json_body)

After:

@app.route('/', methods=["POST"], docs=Docs(
    post=Operation(request=MySchema)
))
def example():
    body = MySchema.parse_obj(app.current_request.json_body)

If you have multiple methods supported, you may have something like:

@app.route('/', methods=["POST", "PUT"],
           docs=Docs(
               post=Operation(request=MyCreateSchema, response=MyReadSchema),
               put=Operation(request=MyEditSchema, response=MyReadSchema)
           )
def example():
    # code goes here
    pass

API

  • TODO: this section coming soon!

Metadata

Release files for chalice-spec-pr07 0.1.5

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

Source distribution (sdist)

Source distribution for chalice-spec-pr07 0.1.5
File Size Uploaded Provenance Actions
chalice_spec_pr07-0.1.5.tar.gz 5.4 kB Without provenance Details for chalice_spec_pr07-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chalice-spec-pr07 0.1.5
File Interpreter ABI Platform Actions
chalice_spec_pr07-0.1.5-py3-none-any.whl Python 3 none any Details for chalice_spec_pr07-0.1.5-py3-none-any.whl

Total release size: 11.9 kB

Release files / chalice_spec_pr07-0.1.5.tar.gz

Download URL chalice_spec_pr07-0.1.5.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
879b8a72afc372b162fa31dc4bdede18c3d7421df3a3837a57dd3ad86a6ebcf4
BLAKE2b-256 checksum
How to use checksums
6c6e4a29eb4532a95af57e8300e035e77d187d6d9920d6358c02c049e6256a55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / chalice_spec_pr07-0.1.5-py3-none-any.whl

Download URL chalice_spec_pr07-0.1.5-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df2cbadcf66535637ad60062bcd76c68b987820b1914c2756223e4560440de75
BLAKE2b-256 checksum
How to use checksums
946cd1036c994cc6b46e45ee9d81f6b588ac7c438d2b9a9b5a3d31c0959d3738
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Security for chalice-spec-pr07 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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