Skip to content

Commit

Permalink
chore: update OpenAPI definition to support new CLI features (kubesho…
Browse files Browse the repository at this point in the history
…p#3768)

* wip

* chore: update CLI client

* chore: update server with OpenAPI definitions

* fixing openapi code generation
  • Loading branch information
danielbdias authored Apr 1, 2024
1 parent c2e8f06 commit e6239b7
Show file tree
Hide file tree
Showing 26 changed files with 2,378 additions and 59 deletions.
106 changes: 102 additions & 4 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1336,12 +1336,12 @@ paths:
500:
description: "problem creating an Linter"

/linters/{LinterId}:
/linters/{linterId}:
get:
tags:
- resource-api
parameters:
- $ref: "./parameters.yaml#/components/parameters/LinterId"
- $ref: "./parameters.yaml#/components/parameters/linterId"
summary: "Get a specific Linter"
description: "Get one Linter by its id"
operationId: getLinter
Expand All @@ -1363,7 +1363,7 @@ paths:
tags:
- resource-api
parameters:
- $ref: "./parameters.yaml#/components/parameters/LinterId"
- $ref: "./parameters.yaml#/components/parameters/linterId"
summary: "Update a Linter"
description: "Update a Linter used on Tracetest"
operationId: updateLinter
Expand Down Expand Up @@ -1395,7 +1395,7 @@ paths:
tags:
- resource-api
parameters:
- $ref: "./parameters.yaml#/components/parameters/LinterId"
- $ref: "./parameters.yaml#/components/parameters/linterId"
summary: "Delete an Linter"
description: "Delete an Linter from Tracetest"
operationId: deleteLinter
Expand All @@ -1408,6 +1408,7 @@ paths:
description: "Linter not found"
500:
description: "problem deleting an Linter"

/wizard:
get:
tags:
Expand Down Expand Up @@ -1450,3 +1451,100 @@ paths:
description: "Wizard not found"
500:
description: "problem updating an Wizard"

# Run Groups
/rungroups:
get:
tags:
- api
summary: "Get all run groups"
description: "Get all the run groups in the system"
operationId: getRunGroups
parameters:
- $ref: "./parameters.yaml#/components/parameters/take"
- $ref: "./parameters.yaml#/components/parameters/skip"
- $ref: "./parameters.yaml#/components/parameters/status"
- $ref: "./parameters.yaml#/components/parameters/runnableResourceSortBy"
- $ref: "./parameters.yaml#/components/parameters/sortDirection"
responses:
200:
description: successful operation
headers:
X-Total-Count:
schema:
type: integer
description: Total records count
content:
application/json:
schema:
$ref: "./runGroups.yaml#/components/schemas/RunGroupList"
404:
description: "Run Groups not found"
500:
description: "problem getting the Run Groups"
post:
tags:
- api
summary: "Create a RunGroup"
description: "Create a RunGroup used on Tracetest"
operationId: createRunGroup
requestBody:
content:
application/json:
schema:
$ref: "./runGroups.yaml#/components/schemas/RunGroup"
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: "./runGroups.yaml#/components/schemas/RunGroup"
400:
description: "invalid RunGroup, some data was sent in incorrect format."
404:
description: "RunGroup not found"
500:
description: "problem updating an RunGroup"
/rungroups/{runGroupId}:
parameters:
- $ref: "./parameters.yaml#/components/parameters/runGroupId"
get:
tags:
- api
summary: "Get a run group"
description: "Get a run groups in the system"
operationId: getRunGroup
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: "./runGroups.yaml#/components/schemas/RunGroup"
404:
description: "Run Group not found"
500:
description: "problem getting the Run Group"
/runs:
get:
tags:
- api
summary: "Get all runs from a run group"
description: "Get all runs from a run group"
operationId: getRunsFromRunGroup
parameters:
- $ref: "./parameters.yaml#/components/parameters/take"
- $ref: "./parameters.yaml#/components/parameters/skip"
- $ref: "./parameters.yaml#/components/parameters/runGroupIds"
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: "./runGroups.yaml#/components/schemas/RunGroupRun"
404:
description: "Run Group not found"
500:
description: "problem getting the Run Group runs"
100 changes: 60 additions & 40 deletions api/parameters.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,7 @@
version: 3.0.0
components:
parameters:
# Test parameters
testId:
in: path
name: testId
required: true
description: id of the test
schema:
type: string

# versioning and runs
runId:
in: path
name: runId
required: true
description: id of the run
schema:
type: integer

version:
in: path
name: version
required: true
description: version of the test
schema:
type: integer

# TestSuite
testSuiteId:
in: path
name: testSuiteId
required: true
description: id of the TestSuite
schema:
type: string

# Query parameters
# Query parameters for API
take:
in: query
name: take
Expand All @@ -60,13 +25,20 @@ components:
schema:
type: string

status:
in: query
name: status
description: "query to search resources by status"
schema:
type: string

runnableResourceSortBy:
in: query
name: sortBy
description: "indicates the sort field for the resources"
schema:
type: string
enum: [created, name, last_run]
enum: [created, name, status, last_run]

sortBy:
in: query
Expand All @@ -92,7 +64,7 @@ components:
type: string
enum: [asc, desc]

# resource ids
# Resource Manager IDs
configId:
in: path
name: configId
Expand Down Expand Up @@ -133,9 +105,9 @@ components:
schema:
type: string

LinterId:
linterId:
in: path
name: LinterId
name: linterId
required: true
description: "ID of an Linter"
schema:
Expand All @@ -147,3 +119,51 @@ components:
required: true
schema:
type: string

testId:
in: path
name: testId
required: true
description: id of the test
schema:
type: string

runId:
in: path
name: runId
required: true
description: id of the run
schema:
type: integer

version:
in: path
name: version
required: true
description: version of the test
schema:
type: integer

testSuiteId:
in: path
name: testSuiteId
required: true
description: id of the TestSuite
schema:
type: string

# Cloud parameters
runGroupId:
in: path
name: runGroupId
required: true
description: "ID of an RunGroup"
schema:
type: string

runGroupIds:
in: query
name: runGroupIds
description: "IDs for RunGroup"
schema:
type: string
95 changes: 95 additions & 0 deletions api/runGroups.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
openapi: 3.0.0
components:
schemas:
RunGroupList:
type: object
properties:
items:
type: array
items:
$ref: "#/components/schemas/RunGroup"

RunGroup:
type: object
required:
- id
nullable: false
properties:
id:
type: string
createdAt:
type: string
format: date-time
readOnly: true
status:
type: string
enum:
- created
- inProgress
- succeed
- failed
readOnly: true
summary:
type: object
properties:
pending:
type: integer
succeed:
type: integer
failed:
type: integer
metadata:
type: object
additionalProperties:
type: string


RunGroupRun:
type: object
properties:
testId:
type: string
testVersion:
type: integer
name:
type: string
createdAt:
type: string
format: date-time
completedAt:
type: string
format: date-time
linter:
$ref: "linters.yaml#/components/schemas/LinterResult"
requiredGatesResult:
$ref: "./testRunner.yaml#/components/schemas/RequiredGatesResult"
metadata:
type: object
additionalProperties:
type: string
executionTime:
type: integer
description: time in seconds it took for the test to complete, either success or fail. If the test is still running, it will show the time up to the time of the request
runId:
type: integer
trigger:
$ref: "./triggers.yaml#/components/schemas/Trigger"
state:
type: string
enum:
[
CREATED,
EXECUTING,
AWAITING_TRACE,
AWAITING_TEST_RESULTS,
ANALYZING_TRACE,
ANALYZING_ERROR,
FINISHED,
STOPPED,
TRIGGER_FAILED,
TRACE_FAILED,
ASSERTION_FAILED,
]
description: Current execution state
result:
$ref: "./tests.yaml#/components/schemas/AssertionResults"
4 changes: 4 additions & 0 deletions api/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ components:
testVersion:
type: integer
description: Test version used when running this test run
runGroupId:
type: string
state:
type: string
enum:
Expand Down Expand Up @@ -243,6 +245,8 @@ components:
type: string
variableSetId:
type: string
runGroupId:
type: string
variables:
type: array
items:
Expand Down
Loading

0 comments on commit e6239b7

Please sign in to comment.