go - 如何在 go/goa 框架中正确弃用 API 端点?

标签 go

在 go/goa 框架中弃用端点的正确方法是什么,例如:

a.Action("foo", func() {
    a.Routing(
        a.PATCH("/foo"),
    )
    a.Description("Test endpoint")
    a.Response(d.OK, func() {
        a.Media(someTestMediaType)
    })
    a.Response(d.Accepted, func() {
        a.Media(someTestMediaType)
    })
    a.Response(d.BadRequest, JSONAPIErrors)
    a.Response(d.InternalServerError, JSONAPIErrors)
})

在 java/spring 世界中,我只需在 Controller 方法上添加 @Deprecated 注释,如果 swagger 就位,它也会标记它已被弃用,以便这会在代码和 UI 中反射(reflect)出来:

enter image description here

想知道 go/goa 相当于什么?

最佳答案

// Deprecated: Use strings.HasPrefix instead.

会起作用的。

enter image description here

关于go - 如何在 go/goa 框架中正确弃用 API 端点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48764572/

相关文章:

go - Beego如何使用Casbin设置动态RBAC?

compiler-construction - 如何为 Go 构建 8g 和 6g Go 编译器

go - 动态创建结构

go - NATS JetStream : Is it possible to explicitly ask from JetStream to (re)send the last few messages it received in subject foo. *?

http - Go中从前端向后端提交数据

go - 当我添加表达式 "fmt.Println()"时发生了什么

go - 为什么要去 json.Unmarshal auto convert interface{} to map

go - Redis 发布/订阅 Ack/Nack

go - 使用Go创建链接列表

c - (*C.uchar)(&buffer[0]) 与 (*C.uchar)(unsafe.Pointer(&buffer[0]))