Files
go-zero/tools/goctl/pkg/parser/api/parser/testdata/invalid.api
2023-03-28 15:45:26 +00:00

136 lines
1.8 KiB
Plaintext

// test case: expected syntax statement
info ()
-----
// test case: duplicate syntax statement
syntax = "v1"
syntax = "v1"
-----
// test case: duplicate info statement
syntax = "v1"
info()
info()
-----
// test case: duplicate type
syntax = "v1"
type Foo{}
type Foo{}
-----
// test case: duplicate type
syntax = "v1"
type Baz{}
type (
Baz{}
)
-----
// test case: multiple service name
syntax = "v1"
service foo{
@handler foo
get /foo
}
service bar{
@handler foo
get /foo
}
-----
// test case: duplicate handler
syntax = "v1"
service foo{
@handler foo
get /foo
@handler foo
get /bar
}
-----
// test case: duplicate path
syntax = "v1"
service foo{
@handler foo
get /foo
@handler bar
get /foo
@handler qux
get /v1/baz
}
@server(
prefix: /v1
)
service foo{
@handler qux
get /baz
@handler quux
get /baz
}
-----
// test case: type declare context
syntax = "v1"
type Foo {
Bar Bar `json:"bar"`
}
-----
// test case: map key expected literal type
syntax = "v1"
type Foo {
Bar map[[]int]string `json:"bar"`
}
-----
// test case: map key expected literal type
syntax = "v1"
type Foo {
Bar map[[]int]string `json:"bar"`
}
-----
// test case: map key expected literal type
syntax = "v1"
type Foo {
Bar *map[[]int]string `json:"bar"`
}
-----
// test case: map valu expected literal type
syntax = "v1"
type Foo {
Bar *map[string]{} `json:"bar"`
}
-----
// test case: invalid slice
syntax = "v1"
type Foo {
Bar []map[[]int]string `json:"bar"`
}
-----
// test case: array
syntax = "v1"
type Foo {
Bar [...]int `json:"bar"`
}
-----
// test case: any
syntax = "v1"
type Foo {
Bar any `json:"bar"`
}
-----
// test case: unresolved type
syntax = "v1"
service example {
@handler nestDemo
post /example/nest (NestDemoReq) returns (NestDemoResp)
}