Skip to content

Commit a9dd57c

Browse files
committed
add test e2e for import endpoint
1 parent f3fd724 commit a9dd57c

4 files changed

Lines changed: 375 additions & 0 deletions

File tree

cmd/gendoc/docs.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,31 @@ Contains a JSON object with the details of an error.
562562
{StatusCode: http.StatusInternalServerError, Reference: "#/components/responses/InternalServerError"},
563563
},
564564
},
565+
{
566+
OperationId: "importApp",
567+
Method: http.MethodPost,
568+
Path: "/v1/apps/import",
569+
Parameters: nil,
570+
Request: (*struct {
571+
File []byte `form:"file" description:"The ZIP archive containing the application structure. Must contain app.yaml. and python folder" validate:"required"`
572+
})(nil),
573+
CustomSuccessResponse: &CustomResponseDef{
574+
ContentType: "application/json",
575+
StatusCode: http.StatusCreated,
576+
DataStructure: struct {
577+
ID string `json:"id" description:"The Base64 encoded identifier of the imported application."`
578+
}{},
579+
Description: "Application imported successfully.",
580+
},
581+
Description: "Imports a new application from a ZIP file. The system extracts the archive, validates the app.yaml manifest, sanitizes the name, and returns the ID in Base64.",
582+
Summary: "Imports an app from ZIP",
583+
Tags: []Tag{ApplicationTag},
584+
PossibleErrors: []ErrorResponse{
585+
{StatusCode: http.StatusBadRequest, Reference: "#/components/responses/BadRequest"},
586+
{StatusCode: http.StatusConflict, Reference: "#/components/responses/Conflict"},
587+
{StatusCode: http.StatusInternalServerError, Reference: "#/components/responses/InternalServerError"},
588+
},
589+
},
565590
{
566591
OperationId: "exportApp",
567592
Method: http.MethodGet,

internal/api/docs/openapi.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,53 @@ paths:
710710
summary: Get application events
711711
tags:
712712
- Application
713+
/v1/apps/import:
714+
post:
715+
description: Imports a new application from a ZIP file. The system extracts
716+
the archive, validates the app.yaml manifest, sanitizes the name, and returns
717+
the ID in Base64.
718+
operationId: importApp
719+
parameters:
720+
- description: The ZIP archive containing the application structure. Must contain
721+
app.yaml. and python folder
722+
in: query
723+
name: file
724+
schema:
725+
description: The ZIP archive containing the application structure. Must
726+
contain app.yaml. and python folder
727+
format: base64
728+
type: string
729+
requestBody:
730+
content:
731+
application/x-www-form-urlencoded:
732+
schema:
733+
properties:
734+
file:
735+
description: The ZIP archive containing the application structure.
736+
Must contain app.yaml. and python folder
737+
format: base64
738+
type: string
739+
type: object
740+
responses:
741+
"201":
742+
content:
743+
application/json:
744+
schema:
745+
properties:
746+
id:
747+
description: The Base64 encoded identifier of the imported application.
748+
type: string
749+
type: object
750+
description: Application imported successfully.
751+
"400":
752+
$ref: '#/components/responses/BadRequest'
753+
"409":
754+
$ref: '#/components/responses/Conflict'
755+
"500":
756+
$ref: '#/components/responses/InternalServerError'
757+
summary: Imports an app from ZIP
758+
tags:
759+
- Application
713760
/v1/bricks:
714761
get:
715762
description: Returns all the existing bricks. Bricks that are ready to use are

internal/e2e/client/client.gen.go

Lines changed: 206 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)