Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
35 changes: 20 additions & 15 deletions experiments/tibuild-v2/design/design.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,27 @@ var _ = API("tibuild", func() {
URI("http://0.0.0.0:8080")
})
})

HTTP(func() {
// Add prefix to all API paths
Path("/api/v2")
})
})

var _ = Service("artifact", func() {
Description("The artifact service provides operations to manage artifacts.")
Error("BadRequest", HTTPError, "Bad Request")
Error("InternalServerError", HTTPError, "Internal Server Error")
HTTP(func() {
Path("/artifact")
})
Method("syncImage", func() {
Description("Sync hotfix image to dockerhub")
Payload(func() {
Attribute("ImageSyncRequest", ImageSyncRequest, "Image sync to public, only hotfix is accepted right now")
Required("ImageSyncRequest")
})
Payload(ImageSyncRequest)
Comment on lines 40 to +41
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider adding a comment explaining why the payload is directly ImageSyncRequest instead of ImageSyncRequest within a payload attribute. This can improve readability and understanding for future developers.

Style Guide References

Suggested change
Description("Sync hotfix image to dockerhub")
Payload(func() {
Attribute("ImageSyncRequest", ImageSyncRequest, "Image sync to public, only hotfix is accepted right now")
Required("ImageSyncRequest")
})
Payload(ImageSyncRequest)
// Payload(ImageSyncRequest) - Image sync to public, only hotfix is accepted right now
Payload(ImageSyncRequest)

Result(ImageSyncRequest)

HTTP(func() {
POST("/api/artifact/sync-image")
POST("/sync-image")
Response(StatusOK)
Response("BadRequest", StatusBadRequest)
Response("InternalServerError", StatusInternalServerError)
Expand All @@ -49,6 +54,9 @@ var _ = Service("devbuild", func() {
Description("The devbuild service provides operations to manage dev builds.")
Error("BadRequest", HTTPError, "Bad Request")
Error("InternalServerError", HTTPError, "Internal Server Error")
HTTP(func() {
Path("/devbuilds")
})
Method("list", func() {
Description("List devbuild with pagination support")
Payload(func() {
Expand All @@ -67,20 +75,17 @@ var _ = Service("devbuild", func() {
Default("desc")
})
Attribute("hotfix", Boolean, "Filter hotfix")
Attribute("pageSize", Int32, "Page size")
Attribute("createdBy", String, "Filter created by")
})
Result(ArrayOf(DevBuild), "List of dev builds")
HTTP(func() {
GET("/api/devbuilds")
GET("/")
Param("page")
Param("pageSize")
Param("hotfix")
Param("createdBy")
Response(StatusOK, func() {
Header("X-Next-Page", Int, "The next page number")
Header("X-Total-Count", Int, "The total number of items")
Header("X-Total-Pages", Int, "The total number of pages")
})
Response(StatusOK)
Response("BadRequest", StatusBadRequest)
})
})
Expand All @@ -99,7 +104,7 @@ var _ = Service("devbuild", func() {
})
Result(DevBuild)
HTTP(func() {
POST("/api/devbuilds")
POST("/")
Param("dryrun")
Response(StatusOK)
Response("BadRequest", StatusBadRequest)
Expand All @@ -121,7 +126,7 @@ var _ = Service("devbuild", func() {
Result(DevBuild)
Error("http_error", HTTPError, "Bad Request")
HTTP(func() {
GET("/api/devbuilds/{id}")
GET("/{id}")
Param("sync")
Response(StatusOK)
Response("BadRequest", StatusBadRequest)
Expand All @@ -143,7 +148,7 @@ var _ = Service("devbuild", func() {
})
Result(DevBuild)
HTTP(func() {
PUT("/api/devbuilds/{id}")
PUT("/{id}")
Param("dryrun")
Response(StatusOK)
Response("BadRequest", StatusBadRequest)
Expand All @@ -164,7 +169,7 @@ var _ = Service("devbuild", func() {
})
Result(DevBuild)
HTTP(func() {
POST("/api/devbuilds/{id}/rerun")
POST("/{id}/rerun")
Param("dryrun")
Response(StatusOK)
Response("BadRequest", StatusBadRequest)
Expand Down
2 changes: 1 addition & 1 deletion experiments/tibuild-v2/gen/artifact/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion experiments/tibuild-v2/gen/artifact/endpoints.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 3 additions & 9 deletions experiments/tibuild-v2/gen/artifact/service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 11 additions & 5 deletions experiments/tibuild-v2/gen/devbuild/service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 5 additions & 12 deletions experiments/tibuild-v2/gen/http/artifact/client/cli.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 2 additions & 26 deletions experiments/tibuild-v2/gen/http/artifact/client/encode_decode.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion experiments/tibuild-v2/gen/http/artifact/client/paths.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 6 additions & 12 deletions experiments/tibuild-v2/gen/http/artifact/client/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 1 addition & 13 deletions experiments/tibuild-v2/gen/http/artifact/server/encode_decode.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion experiments/tibuild-v2/gen/http/artifact/server/paths.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions experiments/tibuild-v2/gen/http/artifact/server/server.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading