# 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](https://github.com/APIs-guru/openapi-directory/tree/master/APIs/amazonaws.com)
by [the `aws2openapi` tool](https://github.com/APIs-guru/aws2openapi).

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

[dcg]: datamodel-code-generator "https://github.com/koxudaxi/datamodel-code-generator"

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.
