couponing-bff-spec
v3.0.8
Published
This repository defines the Couponing BfF API model using Smithy, which generates both client and API code. ## Client and API Generation To generate the client and api (ssdk), execute the following command in the root directory: ```bash cd smithy && smith
Readme
Couponing-BfF API Model
This repository defines the Couponing BfF API model using Smithy, which generates both client and API code.
Client and API Generation
To generate the client and api (ssdk), execute the following command in the root directory:
cd smithy && smithy clean && smithy buildor alternatively
npm run genHow It Works
This project uses Smithy to define and generate the API code.
Project Structure
- The API model is defined in the
smithy/modeldirectory. - Smithy is configured via the
smithy/smithy-build.jsonfile. - The
package.jsonin the root directory is only used to define useful scripts likenpm run gen.
Code Generation
To validate the model and generate the code, you can either:
- Run the Smithy CLI manually from within the smithy directory:
cd smithy && smithy clean && smithy build - Or simply use the provided npm script from the root directory:
npm run gen
Generated Output
After running the build, the generated code will be placed in:
smithy/build/smithy/source/typescript-client-codegen– for the clientsmithy/build/smithy/source/typescript-ssdk-codegen– for the api (ssdk)
Why Yarn is used
Smithy generates code with a package.json that includes build scripts.
These scripts are designed to work with Yarn.
To keep things simple, we leave the generated package.json as-is and use the provided scripts.
This means that Yarn is used for building the generated projects.
OpenAPI
An OpenAPI specification is also automatically generated using the OpenAPI plugin configured in smithy-build.json.
Publishing
The GitHub Action handles publishing automatically.
All you need to do is update the model under smithy/ and commit your changes.
- If you're working on a feature branch, a prerelease version of both the client and the server SDK will be published.
- Once you merge into
master/v3, a stable release of the client and server SDK will be published, and theopenapi.jsonfile will be uploaded to S3.
