title: Swagger Petstore
version: 1.0.0
Swagger Petstore
A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification
paths
main.ListUser GET /users
output (application/json)
// GET /users (200)
type Output200 struct { // Pagination[main.User]
hasMore boolean // default: false
items []struct { // User
// Name of the user
name string
// Age of the user
age? integer
}
}
// GET /users (default)
// default error
type OutputDefault struct { // Error
// Error code
code integer `format:"int32"`
// Error message
message string
}
examples
// GET /users (default)
{
"code": 444,
"message": "unexpected error!"
}
main.GetUser GET /users/{id}
get user
// GET /users/{id}
type Input struct {
pretty? boolean `in:"query"`
id string `in:"path"`
}
output (application/json)
// GET /users/{id} (200)
type Output200 struct { // GetUserOutput
user struct { // User
// Name of the user
name string
// Age of the user
age? integer
}
}
// GET /users/{id} (default)
// default error
type OutputDefault struct { // Error
// Error code
code integer `format:"int32"`
// Error message
message string
}
examples
// GET /users/{id} (default)
{
"code": 444,
"message": "unexpected error!"
}
description
get user
schemas
Error
type Error struct {
// Error code
code integer `format:"int32"`
// Error message
message string
}
exmaples
//
{
"code": 444,
"message": "unexpected error!"
}
User
type User struct {
// Name of the user
name string
// Age of the user
age? integer
}