smithy-examples/conversion-examples
smithy-automation 0f035cc1bd
Update Smithy Version (#98)
Co-authored-by: Smithy Automation <github-aws-smithy-automation@amazon.com>
2024-06-26 08:34:17 -06:00
..
integ Update to use include node of smithy-templates (#33) 2023-06-21 15:56:11 -06:00
smithy-to-openapi Update Smithy Version (#98) 2024-06-26 08:34:17 -06:00
Makefile reorganize to have only one top-level gradle project (#30) 2023-06-21 10:53:30 -06:00
README.md Update to use include node of smithy-templates (#33) 2023-06-21 15:56:11 -06:00

README.md

Smithy Conversions

This project demonstrates how to convert Smithy models to and from other formats such as OpenAPI.

Examples


Smithy to OpenAPI

This example demonstrates how the smithy-openapi plugin can be used to convert a Smithy model into an OpenAPI specification. The model used for this example is a slightly modified version of the Weather Service from the Smithy quickstart guide.

The smithy-openapi plugin is applied to the model by declaring the smithy-openapi package as a dependency in the smithy-build.json and adding the openapi plugin to the openapi-conversion projection in the smithy-build.json file. This will cause the openapi plugin to run when the openapi-conversion is built, generating an OpenAPI specification as a build artifact of the openapi-conversion projection.

Note: Smithy takes a different approach to modeling APIs from OpenAPI. Smithy is protocol agnostic, which means it focuses on the interfaces and abstractions that are provided to end-users rather than how the data is sent over the wire. OpenAPI, on the other hand only defines RESTful APIs. Because Smithy allows for a wider range of formats and a richer API model, conversions from Smithy to OpenAPI (and vice versa) may be lossy.

For more information on converting Smithy models to OpenAPI, including additional configuration options, see the guide here.

Use as a template

To use this example as a template run the following.

smithy init -t smithy-to-openapi