# API Development Tools This directory contains development tools for the eMoney Token Factory API. ## Tools ### OpenAPI Generator Generates SDKs and Postman collections from OpenAPI specifications. ```bash cd openapi-generator pnpm install pnpm run generate:typescript pnpm run generate:python pnpm run generate:go pnpm run generate:java pnpm run generate:postman ``` Or use the shell script: ```bash ./generate-sdks.sh ``` ### Mock Servers Mock servers for testing without full infrastructure. #### REST API Mock (Prism) ```bash cd mock-server pnpm install pnpm run start:rest ``` Mocks all REST endpoints based on OpenAPI spec. #### GraphQL Mock ```bash npm run start:graphql ``` Mocks GraphQL queries, mutations, and subscriptions. #### Rail Simulator ```bash npm run start:rail ``` Simulates Fedwire/SWIFT/SEPA/RTGS responses. #### Packet Simulator ```bash npm run start:packet ``` Simulates AS4 receipts and email acknowledgements. #### Start All ```bash npm run start:all ``` Starts all mock servers concurrently. ### SDK Templates Templates and examples for SDK implementations: - `typescript-sdk-template/` - TypeScript SDK structure - Generated SDKs from OpenAPI (after running generator) ## Usage ### Generating SDKs 1. Ensure OpenAPI spec is up to date 2. Run generator: `cd openapi-generator && pnpm run generate:typescript` 3. SDKs will be generated in `sdk-templates/` directory 4. Copy to separate repositories for publishing ### Using Mock Servers 1. Start mock servers: `cd mock-server && pnpm run start:all` 2. Point tests to mock endpoints 3. Use for local development and CI/CD ## CI/CD Integration ### Generate SDKs in CI ```yaml - name: Generate SDKs run: | cd api/tools/openapi-generator pnpm install pnpm run generate:typescript pnpm run generate:python ``` ### Run Contract Tests ```yaml - name: Validate OpenAPI Contract run: | pnpm test -- test/api/contract ```