Skip to main content

Pydantic interface codegen from Amazon Smithy JSON schemas

Project description

botodto

Pydantic model codegen from AWS OpenAPI schemas generated from the AWS JS/TS SDK (v3)

Mission statement

The goal of this library is to wrap boto3 clients so that all calls to AWS APIs through them are ingested into, and emit responses as Pydantic models.

Implementation

OpenAPI schemas are produced from the AWS Javascript SDK (v2) in the OpenAPI Directory by the aws2openapi tool.

These can be used to produce reliable Pydantic data models using datamodel-code-generator (to clarify: with minimal? no? manual editing of the result).

My implementation will take one of the following routes [TBD]:

  • replaces the aws2openapi tool with a Python converter for the v3 SDK (simplest approach, more work?)

    • Theoretically this is the nicest approach
    • It isn't a good idea to approach this without a proof of concept that the proposed solution is viable
  • amends the OpenAPI schema generated by aws2openapi from the v2 SDK to include exceptions from the v3 SDK

    • This could be a neat solution
  • amends the Pydantic models to include exceptions from the v3 SDK (potentially awkward manual mapping exercise, but least work?)

    • This could be a simple proof of concept

I propose to start with the latter approach, for a single service, end to end, and stub out the other services. After this is shown to work, automate the process for the other services.

Reliability

  • I will use a test suite to check the results work for all schemas (there are a lot!)

  • I would like to avoid manual data transfer or generation where possible to make this repeatable, and not deteriorate after writing.

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

botodto-0.0.2.tar.gz (64.1 kB view hashes)

Uploaded Source

Built Distribution

botodto-0.0.2-py3-none-any.whl (65.3 kB view hashes)

Uploaded Python 3

Supported by

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