diff --git a/api/v1/testkube.yaml b/api/v1/testkube.yaml index 678abda5cda..7cf355b3122 100644 --- a/api/v1/testkube.yaml +++ b/api/v1/testkube.yaml @@ -1087,13 +1087,14 @@ components: name: type: string description: script name + namespace: + type: string + description: script namespace type: type: string description: script type - enum: - - postman/collection content: - type: string + $ref: "#/components/schemas/ScriptContent" description: script content created: type: string @@ -1104,6 +1105,26 @@ components: type: string description: script tags + ScriptContent: + type: object + properties: + type: + type: string + description: script type + enum: + - file-string + - file-uri + - git-file + - git-dir + repository: + $ref: "#/components/schemas/Repository" + content: + type: string + description: script content + uri: + type: string + description: script content + Execution: type: object description: API server script execution @@ -1143,11 +1164,8 @@ components: example: users: "3" prefix: "some-" - scriptContent: - type: string - description: script metadata content - repository: - $ref: "#/components/schemas/Repository" + content: + $ref: "#/components/schemas/ScriptContent" startTime: type: string description: "test start time" @@ -1459,55 +1477,8 @@ components: ScriptUpsertRequest: description: scripts create request body - type: object - properties: - name: - type: string - description: script name - Custom Resource name - must be unique, use only lowercase numbers and dashes (-) - example: kubeshop-homepage-test - type: - type: string - description: script type - what executor type should be used during test execution - example: postman/collection - namespace: - type: string - description: kubernetes namespace (defaults to 'testkube') - example: testkube - inputType: - type: string - description: > - script content type can be: - - direct content - created from file, - - git repo directory checkout in case when test is some kind of project or have more than one file, - enum: - - content - - git - tags: - type: array - items: - type: string - repository: - $ref: "#/components/schemas/Repository" - content: - type: string - description: script content - executor specific e.g. fo postman-collections executor - example: > - { - "info": { - "_postman_id": "57ad6291-5b8f-4b2d-b24d-d2d2ce8785bb", - "name": "SimpleKubeshop", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "Homepage", - "request": { - "method": "GET", - "header": [], - "url": null - }, - "response": [] - } + allOf: + - $ref: "#/components/schemas/Script" TestUpsertRequest: description: test create request body diff --git a/pkg/api/v1/testkube/model_execution.go b/pkg/api/v1/testkube/model_execution.go index 273e409377b..d588d69d22f 100644 --- a/pkg/api/v1/testkube/model_execution.go +++ b/pkg/api/v1/testkube/model_execution.go @@ -28,10 +28,8 @@ type Execution struct { // additional arguments/flags passed to executor binary Args []string `json:"args,omitempty"` // execution params passed to executor converted to vars for usage in tests - Params map[string]string `json:"params,omitempty"` - // script metadata content - ScriptContent string `json:"scriptContent,omitempty"` - Repository *Repository `json:"repository,omitempty"` + Params map[string]string `json:"params,omitempty"` + Content *ScriptContent `json:"content,omitempty"` // test start time StartTime time.Time `json:"startTime,omitempty"` // test end time diff --git a/pkg/api/v1/testkube/model_script.go b/pkg/api/v1/testkube/model_script.go index efc47792b99..5bfafae9cea 100644 --- a/pkg/api/v1/testkube/model_script.go +++ b/pkg/api/v1/testkube/model_script.go @@ -16,11 +16,12 @@ import ( type Script struct { // script name Name string `json:"name,omitempty"` + // script namespace + Namespace string `json:"namespace,omitempty"` // script type - Type_ string `json:"type,omitempty"` - // script content - Content string `json:"content,omitempty"` - Created time.Time `json:"created,omitempty"` + Type_ string `json:"type,omitempty"` + Content *ScriptContent `json:"content,omitempty"` + Created time.Time `json:"created,omitempty"` // script tags Tags []string `json:"tags,omitempty"` } diff --git a/pkg/api/v1/testkube/model_script_content.go b/pkg/api/v1/testkube/model_script_content.go new file mode 100644 index 00000000000..7725ece1489 --- /dev/null +++ b/pkg/api/v1/testkube/model_script_content.go @@ -0,0 +1,20 @@ +/* + * TestKube API + * + * TestKube provides a Kubernetes-native framework for test definition, execution and results + * + * API version: 1.0.0 + * Contact: testkube@kubeshop.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package testkube + +type ScriptContent struct { + // script type + Type_ string `json:"type,omitempty"` + Repository *Repository `json:"repository,omitempty"` + // script content + Content string `json:"content,omitempty"` + // script content + Uri string `json:"uri,omitempty"` +} diff --git a/pkg/api/v1/testkube/model_script_upsert_request.go b/pkg/api/v1/testkube/model_script_upsert_request.go index 9c0bd232af5..408a4d77875 100644 --- a/pkg/api/v1/testkube/model_script_upsert_request.go +++ b/pkg/api/v1/testkube/model_script_upsert_request.go @@ -9,18 +9,20 @@ */ package testkube +import ( + "time" +) + // scripts create request body type ScriptUpsertRequest struct { - // script name - Custom Resource name - must be unique, use only lowercase numbers and dashes (-) + // script name Name string `json:"name,omitempty"` - // script type - what executor type should be used during test execution - Type_ string `json:"type,omitempty"` - // kubernetes namespace (defaults to 'testkube') + // script namespace Namespace string `json:"namespace,omitempty"` - // script content type can be: - direct content - created from file, - git repo directory checkout in case when test is some kind of project or have more than one file, - InputType string `json:"inputType,omitempty"` - Tags []string `json:"tags,omitempty"` - Repository *Repository `json:"repository,omitempty"` - // script content - executor specific e.g. fo postman-collections executor - Content string `json:"content,omitempty"` + // script type + Type_ string `json:"type,omitempty"` + Content *ScriptContent `json:"content,omitempty"` + Created time.Time `json:"created,omitempty"` + // script tags + Tags []string `json:"tags,omitempty"` }