Skip to content

Instantly share code, notes, and snippets.

@TharmiganK
Created June 7, 2024 06:34
Show Gist options
  • Save TharmiganK/6e8805c56106f7519c2f68ce711aeaf4 to your computer and use it in GitHub Desktop.
Save TharmiganK/6e8805c56106f7519c2f68ce711aeaf4 to your computer and use it in GitHub Desktop.
Conversion API OpenAPI specification
openapi: 3.0.1
info:
title: Api
version: 0.1.0
servers:
- url: "{server}:{port}/api"
variables:
server:
default: http://localhost
port:
default: "9090"
paths:
/conversion-rates:
get:
operationId: getConversionRates
parameters:
- name: X-API-KEY
in: header
required: true
schema:
type: string
responses:
"400":
description: BadRequest
content:
application/conversion.api+json:
schema:
required:
- message
type: object
properties:
message:
type: string
additionalProperties: false
application/json:
schema:
$ref: '#/components/schemas/ErrorPayload'
"500":
description: InternalServerError
content:
application/conversion.api+json:
schema:
required:
- message
type: object
properties:
message:
type: string
additionalProperties: false
"401":
description: Unauthorized
content:
application/conversion.api+json:
schema:
required:
- message
type: object
properties:
message:
type: string
additionalProperties: false
"200":
description: Ok
headers:
Last-Modified:
schema:
type: string
Cache-Control:
schema:
type: string
default: "must-revalidate,public,max-age=18000"
ETag:
schema:
type: string
content:
application/conversion.api+json:
schema:
$ref: '#/components/schemas/ConversionRates'
links:
get-conversion:
operationId: getConversion
get-conversion-rate:
operationId: getConversionRate
/conversion-rate:
get:
operationId: getConversionRate
parameters:
- name: X-API-KEY
in: header
required: true
schema:
type: string
- name: from
in: query
required: true
schema:
type: string
- name: to
in: query
required: true
schema:
type: string
responses:
"400":
description: BadRequest
content:
application/conversion.api+json:
schema:
required:
- message
type: object
properties:
message:
type: string
additionalProperties: false
application/json:
schema:
$ref: '#/components/schemas/ErrorPayload'
"500":
description: InternalServerError
content:
application/conversion.api+json:
schema:
required:
- message
type: object
properties:
message:
type: string
additionalProperties: false
"401":
description: Unauthorized
content:
application/conversion.api+json:
schema:
required:
- message
type: object
properties:
message:
type: string
additionalProperties: false
"200":
description: Ok
headers:
Last-Modified:
schema:
type: string
Cache-Control:
schema:
type: string
default: "must-revalidate,public,max-age=18000"
ETag:
schema:
type: string
content:
application/conversion.api+json:
schema:
$ref: '#/components/schemas/ConvertionRate'
links:
update-conversion-rate:
operationId: getConversionRate
get-conversion:
operationId: getConversion
delete-conversion-rate:
operationId: getConversionRate
"404":
description: NotFound
content:
application/conversion.api+json:
schema:
required:
- fromCurrency
- message
- toCurrency
type: object
properties:
message:
type: string
fromCurrency:
type: string
toCurrency:
type: string
additionalProperties:
type: string
put:
operationId: putConversionRate
parameters:
- name: X-API-KEY
in: header
required: true
schema:
type: string
- name: from
in: query
required: true
schema:
type: string
- name: to
in: query
required: true
schema:
type: string
requestBody:
content:
application/conversion.api+json:
schema:
$ref: '#/components/schemas/ConversionRateUpdate'
required: true
responses:
"400":
description: BadRequest
content:
application/conversion.api+json:
schema:
required:
- message
type: object
properties:
message:
type: string
additionalProperties: false
application/json:
schema:
$ref: '#/components/schemas/ErrorPayload'
"500":
description: InternalServerError
content:
application/conversion.api+json:
schema:
required:
- message
type: object
properties:
message:
type: string
additionalProperties: false
"401":
description: Unauthorized
content:
application/conversion.api+json:
schema:
required:
- message
type: object
properties:
message:
type: string
additionalProperties: false
"200":
description: Ok
content:
application/conversion.api+json:
schema:
required:
- message
type: object
properties:
message:
type: string
additionalProperties: false
links:
get-conversion:
operationId: getConversion
get-conversion-rate:
operationId: getConversionRate
delete-conversion-rate:
operationId: getConversionRate
"404":
description: NotFound
content:
application/conversion.api+json:
schema:
required:
- fromCurrency
- message
- toCurrency
type: object
properties:
message:
type: string
fromCurrency:
type: string
toCurrency:
type: string
additionalProperties:
type: string
post:
operationId: postConversionRate
parameters:
- name: X-API-KEY
in: header
required: true
schema:
type: string
requestBody:
content:
application/conversion.api+json:
schema:
$ref: '#/components/schemas/ConvertionRate'
required: true
responses:
"400":
description: BadRequest
content:
application/conversion.api+json:
schema:
required:
- message
type: object
properties:
message:
type: string
additionalProperties: false
application/json:
schema:
$ref: '#/components/schemas/ErrorPayload'
"500":
description: InternalServerError
content:
application/conversion.api+json:
schema:
required:
- message
type: object
properties:
message:
type: string
additionalProperties: false
"401":
description: Unauthorized
content:
application/conversion.api+json:
schema:
required:
- message
type: object
properties:
message:
type: string
additionalProperties: false
"201":
description: Created
content:
application/conversion.api+json:
schema:
required:
- message
type: object
properties:
message:
type: string
additionalProperties: false
links:
update-conversion-rate:
operationId: getConversionRate
get-conversion:
operationId: getConversion
get-conversion-rate:
operationId: getConversionRate
delete-conversion-rate:
operationId: getConversionRate
"409":
description: Conflict
content:
application/conversion.api+json:
schema:
required:
- fromCurrency
- message
- toCurrency
type: object
properties:
message:
type: string
fromCurrency:
type: string
toCurrency:
type: string
additionalProperties: false
delete:
operationId: deleteConversionRate
parameters:
- name: X-API-KEY
in: header
required: true
schema:
type: string
- name: from
in: query
required: true
schema:
type: string
- name: to
in: query
required: true
schema:
type: string
responses:
"400":
description: BadRequest
content:
application/conversion.api+json:
schema:
required:
- message
type: object
properties:
message:
type: string
additionalProperties: false
application/json:
schema:
$ref: '#/components/schemas/ErrorPayload'
"500":
description: InternalServerError
content:
application/conversion.api+json:
schema:
required:
- message
type: object
properties:
message:
type: string
additionalProperties: false
"401":
description: Unauthorized
content:
application/conversion.api+json:
schema:
required:
- message
type: object
properties:
message:
type: string
additionalProperties: false
"204":
description: NoContent
"404":
description: NotFound
content:
application/conversion.api+json:
schema:
required:
- fromCurrency
- message
- toCurrency
type: object
properties:
message:
type: string
fromCurrency:
type: string
toCurrency:
type: string
additionalProperties:
type: string
/conversion:
get:
operationId: getConversion
parameters:
- name: amount
in: query
required: true
schema:
type: number
format: double
- name: X-API-KEY
in: header
required: true
schema:
type: string
- name: from
in: query
required: true
schema:
type: string
- name: to
in: query
required: true
schema:
type: string
responses:
"400":
description: BadRequest
content:
application/conversion.api+json:
schema:
required:
- message
type: object
properties:
message:
type: string
additionalProperties: false
application/json:
schema:
$ref: '#/components/schemas/ErrorPayload'
"500":
description: InternalServerError
content:
application/conversion.api+json:
schema:
required:
- message
type: object
properties:
message:
type: string
additionalProperties: false
"401":
description: Unauthorized
content:
application/conversion.api+json:
schema:
required:
- message
type: object
properties:
message:
type: string
additionalProperties: false
"200":
description: Ok
headers:
Last-Modified:
schema:
type: string
Cache-Control:
schema:
type: string
default: "must-revalidate,public,max-age=18000"
ETag:
schema:
type: string
content:
application/conversion.api+json:
schema:
$ref: '#/components/schemas/ConversionResult'
links:
get-conversion-rates:
operationId: getConversionRates
get-conversion-rate:
operationId: getConversionRate
"404":
description: NotFound
content:
application/conversion.api+json:
schema:
required:
- fromCurrency
- message
- toCurrency
type: object
properties:
message:
type: string
fromCurrency:
type: string
toCurrency:
type: string
additionalProperties:
type: string
components:
schemas:
ConversionRateUpdate:
required:
- conversionRate
type: object
properties:
conversionRate:
type: number
format: double
additionalProperties: false
ConversionRates:
required:
- conversionRates
type: object
properties:
conversionRates:
type: array
items:
$ref: '#/components/schemas/ConvertionRate'
additionalProperties: false
ConversionResult:
required:
- amount
type: object
properties:
amount:
type: number
format: double
additionalProperties: false
ConvertionRate:
required:
- conversionRate
- fromCurrency
- toCurrency
type: object
properties:
fromCurrency:
type: string
toCurrency:
type: string
conversionRate:
type: number
format: double
additionalProperties: false
ErrorPayload:
required:
- message
- method
- path
- reason
- status
- timestamp
type: object
properties:
timestamp:
type: string
status:
type: integer
format: int64
reason:
type: string
message:
type: string
path:
type: string
method:
type: string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment