{ "swagger": "2.0", "info": { "title": "Currency Conversion API", "description": "Convert between different currencies at real-time rates.", "version": "1.0.0" }, "basePath": "/api", "schemes": ["http", "https"], "paths": { "/currencies": { "get": { "summary": "Get Available Currencies", "description": "Endpoint to get a list of available currencies for conversion.", "produces": ["application/json"], "responses": { "200": { "description": "Successful response", "schema": { "$ref": "#/definitions/CurrencyList" } }, "400": { "description": "Bad request", "schema": { "$ref": "#/definitions/ErrorModel" } } } } }, "/convert": { "post": { "summary": "Currency Conversion", "description": "Endpoint to convert between different currencies.", "consumes": ["application/json"], "produces": ["application/json"], "parameters": [ { "in": "body", "name": "conversionData", "description": "Currency conversion data", "schema": { "$ref": "#/definitions/CurrencyConversionData" } } ], "responses": { "200": { "description": "Successful response", "schema": { "$ref": "#/definitions/CurrencyConversionResult" } }, "400": { "description": "Bad request", "schema": { "$ref": "#/definitions/ErrorModel" } } } } }, "/exchange-rates": { "get": { "summary": "Get Real-Time Exchange Rates", "description": "Endpoint to get real-time exchange rates between different currencies.", "produces": ["application/json"], "responses": { "200": { "description": "Successful response", "schema": { "$ref": "#/definitions/ExchangeRates" } }, "400": { "description": "Bad request", "schema": { "$ref": "#/definitions/ErrorModel" } } } } } }, "definitions": { "ErrorModel": { "type": "object", "properties": { "error": { "type": "string", "description": "Error message." } } }, "CurrencyList": { "type": "object", "properties": { "currencies": { "type": "array", "items": { "type": "string" }, "description": "List of available currencies for conversion." } } }, "CurrencyConversionData": { "type": "object", "properties": { "fromCurrency": { "type": "string", "description": "Currency code of the currency to convert from." }, "toCurrency": { "type": "string", "description": "Currency code of the currency to convert to." }, "amount": { "type": "number", "description": "Amount to convert." } }, "required": ["fromCurrency", "toCurrency", "amount"] }, "CurrencyConversionResult": { "type": "object", "properties": { "fromCurrency": { "type": "string", "description": "Currency code of the original currency." }, "toCurrency": { "type": "string", "description": "Currency code of the converted currency." }, "originalAmount": { "type": "number", "description": "Original amount before conversion." }, "convertedAmount": { "type": "number", "description": "Amount after conversion." } } }, "ExchangeRates": { "type": "object", "properties": { "rates": { "type": "object", "description": "Real-time exchange rates between different currencies." } } } } }