65 lines
1.1 KiB
Plaintext
65 lines
1.1 KiB
Plaintext
syntax = "v1"
|
|
|
|
scalar BusinessID (
|
|
goImport: "git.yuntuo.hk/k2safe/go-omni/examples/compatibility/ids"
|
|
goType: ID
|
|
jsonInput: string | int64
|
|
jsonOutput: string
|
|
text: true
|
|
)
|
|
|
|
type EchoReq {
|
|
ID BusinessID `json:"id"`
|
|
Data any `json:"data"`
|
|
Legacy interface{} `json:"legacy,optional"`
|
|
}
|
|
type EchoResp {
|
|
ID BusinessID `json:"id"`
|
|
Data any `json:"data"`
|
|
}
|
|
type ItemReq {
|
|
ID BusinessID `path:"id"`
|
|
}
|
|
type CustomReq {
|
|
Value string `json:"value"`
|
|
}
|
|
type CustomResp {
|
|
Value string `json:"value"`
|
|
}
|
|
|
|
@server (group: demo)
|
|
service compatibility-api {
|
|
@body (maxBytes: 2097152)
|
|
@handler echo
|
|
post /echo (EchoReq) returns (EchoResp)
|
|
|
|
@handler item
|
|
get /items/:id (ItemReq) returns (EchoResp)
|
|
|
|
@binding custom
|
|
@body (maxBytes: 512)
|
|
@handler custom
|
|
post /custom (CustomReq) returns (CustomResp)
|
|
|
|
@handlerMode manual
|
|
@body (mode: multipart
|
|
maxBytes: 65536)
|
|
@handler upload
|
|
post /upload
|
|
|
|
@handlerMode manual
|
|
@body (mode: raw
|
|
maxBytes: 128)
|
|
@produces "text/plain"
|
|
@handler callback
|
|
post /callback
|
|
}
|
|
|
|
@server (group: files)
|
|
service compatibility-api {
|
|
@handlerMode manual
|
|
@produces "application/octet-stream"
|
|
@handler download
|
|
get /download
|
|
}
|