Skip to content

Instantly share code, notes, and snippets.

@rvennam
Last active April 18, 2023 16:47
Show Gist options
  • Save rvennam/9aa34f9f1d8a32e5efb4b1c63e6b3e8d to your computer and use it in GitHub Desktop.
Save rvennam/9aa34f9f1d8a32e5efb4b1c63e6b3e8d to your computer and use it in GitHub Desktop.
{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "Currencies API",
"description": "International currency support"
},
"servers": [
{
"url": "https://currency.solo.io:443/",
"description": "Solo.io Currency server API"
},
{
"url": "http://localhost:8080/",
"description": "Local development"
}
],
"paths": {
"/currencies": {
"get": {
"summary": "Get supported currencies",
"responses": {
"200": {
"description": "Supported currencies",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetSupportedCurrenciesResponse"
}
}
}
}
}
}
},
"/currencies/convert": {
"post": {
"requestBody": {
"description": "Currency to convert",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CurrencyConversionRequest"
}
}
}
},
"summary": "Convert one currency to another",
"responses": {
"200": {
"description": "Converted currency",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Money"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"GetSupportedCurrenciesResponse": {
"properties": {
"currency_codes": {
"description": "The 3-letter currency code defined in ISO 4217.",
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
},
"CurrencyConversionRequest": {
"properties": {
"from": {
"properties": {
"currency_code": {
"description": "The 3-letter currency code defined in ISO 4217.",
"type": "string"
},
"nanos": {
"description": "Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If `units` is positive, `nanos` must be positive or zero. If `units` is zero, `nanos` can be positive, zero, or negative. If `units` is negative, `nanos` must be negative or zero. For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.",
"format": "int32",
"type": "integer"
},
"units": {
"description": "The whole units of the amount. For example if `currency_code` is `\"USD\"`, then 1 unit is one US dollar.",
"format": "int64",
"type": "integer",
"x-kubernetes-int-or-string": true
}
},
"type": "object"
},
"to_code": {
"description": "The 3-letter currency code defined in ISO 4217.",
"type": "string"
}
},
"type": "object"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment