Created
February 23, 2019 09:48
-
-
Save jccguimaraes/9b54cd8a6468d801753ba0771253a312 to your computer and use it in GitHub Desktop.
Post - Design an API - OpenAPI Spec file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: 3.0.2 | |
tags: | |
- name: capture | |
info: | |
version: 1.0.0 | |
title: Process Transactions Micro-service | |
description: 'Capture, void and refund an account.' | |
paths: | |
'/capture/{authorizationId}': | |
post: | |
summary: Capture an amount | |
tags: | |
- capture | |
operationId: capturePost | |
parameters: | |
- name: authorizationId | |
description: Authorization Id which allows to capture the locked funds | |
in: path | |
required: true | |
schema: | |
type: string | |
- name: X-Correlation-Id | |
description: Correlation Id to keep track of workflow | |
in: header | |
schema: | |
type: string | |
requestBody: | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/capture' | |
responses: | |
'200': | |
$ref: '#/components/responses/capture-200' | |
'422': | |
$ref: '#/components/responses/capture-422' | |
components: | |
securitySchemes: | |
X-Api-Key: | |
type: apiKey | |
in: header | |
name: X-Api-Key | |
responses: | |
capture-200: | |
description: Capture of funds has succedeed | |
headers: | |
X-Correlation-Id: | |
$ref: '#/components/headers/X-Correlation-Id' | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/capture-200' | |
capture-422: | |
description: Capture did not succeed | |
headers: | |
X-Correlation-Id: | |
$ref: '#/components/headers/X-Correlation-Id' | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/capture-422' | |
schemas: | |
capture: | |
type: object | |
required: | |
- accountId | |
- amount | |
- currency | |
properties: | |
accountId: | |
type: string | |
amount: | |
type: number | |
example: 9.99 | |
currency: | |
type: string | |
example: EUR | |
capture-200: | |
type: object | |
properties: | |
transactionId: | |
type: string | |
description: The transaction id which will allow to refund | |
capture-422: | |
type: object | |
properties: | |
success: | |
type: boolean | |
default: false | |
reason: | |
type: string | |
example: Conditions could not be met | |
headers: | |
X-Correlation-Id: | |
schema: | |
type: string | |
security: | |
- X-Api-Key: [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment