主要是 swagger(openapi) 的格式里面,一个 API 可能就需要 5-10 行,大量的字符是无用字符,是一种 llm 上下文不友好的 API 格式,所以有如下尝试
TINYAPI
TYPE User id uuid name string email string
GET /users -> 200 User[]
GET /users/:id -> 200 User 404 {error string}
POST /users BODY {name string email string} -> 201 User
PUT /users/:id BODY {name? email?} -> 200 User
DELETE /users/:id -> 204
RESOURCE users User {name string email string} # above is equivalent
RESOURCE comments ONLY index,create # only specific operations
AUTH jwt bearer # auth when needed
GET /admin/stats -> 200 {count int} AUTH jwt
GROUP Admin
GET /admin/stats -> 200 {count int} AUTH jwt
POST /admin/reset -> 204 AUTH jwt
ENDGROUP