You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
1.8 KiB
Plaintext
100 lines
1.8 KiB
Plaintext
// only one
|
|
syntax = "v1"
|
|
|
|
// import
|
|
import "foo.api"
|
|
|
|
// import group
|
|
import(
|
|
"foo.api"
|
|
"foo/bar.api"
|
|
)
|
|
|
|
// only one
|
|
info(
|
|
title: "foo title"
|
|
desc: "foo
|
|
desc"
|
|
author: "foo author"
|
|
email: "foo email"
|
|
version: "foo version"
|
|
)
|
|
|
|
// ignore the following duplicate name
|
|
|
|
type Foo int
|
|
|
|
// type single
|
|
type Foo {
|
|
Bar string
|
|
}
|
|
|
|
type Foo {
|
|
Bar string `json:"bar"`
|
|
Inline
|
|
}
|
|
// go struct
|
|
type Foo struct {
|
|
Bar string `json:"bar"`
|
|
}
|
|
|
|
// type group
|
|
type (
|
|
Foo int
|
|
|
|
// go struct
|
|
Foo struct {
|
|
Bar string `json:"bar"`
|
|
}
|
|
|
|
Foo {
|
|
VString string `json:"vString"`
|
|
VBool bool `json:"vBool"`
|
|
VInt8 int8 `json:"vInt8"`
|
|
VInt16 int16 `json:"vInt16"`
|
|
VInt32 int32 `json:"vInt32"`
|
|
VInt64 int64 `json:"vInt64"`
|
|
VInt int `json:"vInt"`
|
|
VUInt8 uint8 `json:"vUInt8"`
|
|
VUInt16 uint16 `json:"vUInt16"`
|
|
VUInt32 uint32 `json:"vUInt32"`
|
|
VUInt64 uint64 `json:"vUInt64"`
|
|
VFloat32 float32 `json:"vFloat32"`
|
|
VFloat64 float64 `json:"vFloat64"`
|
|
VByte byte `json:"vByte"`
|
|
VRune rune `json:"vRune"`
|
|
VMap map[string]int `json:"vMap"`
|
|
VArray []int `json:"vArray"`
|
|
VStruct Foo `json:"vStruct"`
|
|
VStructPointer *Foo `json:"vStructPointer"`
|
|
VInterface interface{} `json:"vInterface"`
|
|
T time.Time
|
|
}
|
|
)
|
|
|
|
@server(
|
|
jwt: Foo
|
|
group: foo/bar
|
|
anotherKey: anotherValue
|
|
)
|
|
service example-api {
|
|
@doc(
|
|
summary: "foo1"
|
|
)
|
|
@server(
|
|
handler: fooHandler1
|
|
anotherKey: anotherValue
|
|
)
|
|
post /api/foo1 (SingleExample)
|
|
|
|
@doc "foo2"
|
|
@handler fooHandler2
|
|
get /api/foo2 (SingleExample) returns (SingleExample2)
|
|
|
|
@handler fooHandler3
|
|
post /api/foo3/:id returns (SingleExample2)
|
|
|
|
@handler fooHandler4
|
|
get /api/foo4
|
|
}
|