Skip to content

Commit

Permalink
Revert "Revert "feat: change openapi spec for transactions to conside…
Browse files Browse the repository at this point in the history
…r resource manager" (#2497)"

This reverts commit 490d47c.
  • Loading branch information
mathnogueira committed May 15, 2023
1 parent 59c9233 commit 291837d
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 23 deletions.
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

0 comments on commit 291837d

Please sign in to comment.