Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: change openapi spec for transactions to consider resource manager #2486

Merged
merged 3 commits into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 66 additions & 23 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ paths:
/transactions:
get:
tags:
- api
- resource-api
summary: "Get transactions"
description: "get transactions"
operationId: getTransactions
Expand All @@ -74,43 +74,63 @@ paths:
responses:
200:
description: successful operation
headers:
X-Total-Count:
schema:
type: integer
description: Total records count
content:
application/json:
schema:
type: array
items:
$ref: "./transactions.yaml#/components/schemas/Transaction"
type: object
properties:
count:
type: integer
items:
type: array
items:
$ref: "./transactions.yaml#/components/schemas/TransactionResource"
text/yaml:
schema:
type: object
properties:
count:
type: integer
items:
type: array
items:
$ref: "./transactions.yaml#/components/schemas/TransactionResource"
400:
description: "invalid query for transactions, some data was sent in incorrect format."
500:
description: "problem with getting transactions"
post:
tags:
- api
- resource-api
summary: "Create new transaction"
description: "Create new transaction"
operationId: createTransaction
requestBody:
content:
application/json:
schema:
$ref: "./transactions.yaml#/components/schemas/Transaction"
$ref: "./transactions.yaml#/components/schemas/TransactionResource"
text/yaml:
schema:
$ref: "./transactions.yaml#/components/schemas/TransactionResource"
responses:
200:
201:
description: successful operation
content:
application/json:
schema:
$ref: "./transactions.yaml#/components/schemas/Transaction"
$ref: "./transactions.yaml#/components/schemas/TransactionResource"
text/yaml:
schema:
$ref: "./transactions.yaml#/components/schemas/TransactionResource"
400:
description: "trying to create a transaction with an already existing ID"
500:
description: "problem creating a transaction"
/transactions/{transactionId}:
get:
tags:
- api
- resource-api
parameters:
- $ref: "./parameters.yaml#/components/parameters/transactionId"
summary: "get transaction"
Expand All @@ -122,12 +142,17 @@ paths:
content:
application/json:
schema:
$ref: "./transactions.yaml#/components/schemas/Transaction"
$ref: "./transactions.yaml#/components/schemas/TransactionResource"
text/yaml:
schema:
$ref: "./transactions.yaml#/components/schemas/TransactionResource"
404:
description: "transaction not found"
500:
description: "problem with getting a transaction"
description: "problem getting an transaction"
put:
tags:
- api
- resource-api
parameters:
- $ref: "./parameters.yaml#/components/parameters/transactionId"
summary: "update transaction"
Expand All @@ -137,23 +162,41 @@ paths:
content:
application/json:
schema:
$ref: "./transactions.yaml#/components/schemas/Transaction"
$ref: "./transactions.yaml#/components/schemas/TransactionResource"
text/yaml:
schema:
$ref: "./transactions.yaml#/components/schemas/TransactionResource"
responses:
204:
200:
description: successful operation
content:
application/json:
schema:
$ref: "./transactions.yaml#/components/schemas/TransactionResource"
text/yaml:
schema:
$ref: "./transactions.yaml#/components/schemas/TransactionResource"
400:
description: "invalid transaction, some data was sent in incorrect format."
404:
description: "transaction not found"
500:
description: "problem with updating transaction"
description: "problem updating a transaction"
delete:
tags:
- api
- resource-api
parameters:
- $ref: "./parameters.yaml#/components/parameters/transactionId"
summary: "delete a transaction"
description: "delete a transaction"
operationId: deleteTransaction
responses:
"204":
description: OK
204:
description: successful operation
404:
description: "transaction not found"
500:
description: "problem deleting a transaction"
/transactions/{transactionId}/version/{version}:
get:
tags:
Expand Down
19 changes: 19 additions & 0 deletions api/transactions.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
openapi: 3.0.0
components:
schemas:

TransactionResource:
type: object
description: "Represents a transaction structured into the Resources format."
properties:
type:
type: string
description: "Represents the type of this resource. It should always be set as 'Transaction'."
enum:
- Transaction
spec:
$ref: "#/components/schemas/Transaction"

Transaction:
type: object
properties:
Expand All @@ -16,6 +29,12 @@ components:
description: version number of the test
steps:
type: array
description: list of steps of the transaction containing just each test id
items:
type: string
fullSteps:
type: array
description: list of steps of the transaction containing the whole test object
items:
$ref: "./tests.yaml#/components/schemas/Test"
createdAt:
Expand Down