481 lines
11 KiB
JSON
481 lines
11 KiB
JSON
{
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"title": "Your API Title",
|
|
"description": "Your API description",
|
|
"version": "v1.0"
|
|
},
|
|
"tags": [
|
|
{
|
|
"name": "Peach"
|
|
}
|
|
],
|
|
"host": "localhost:8080",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"paths": {
|
|
"/v1/Product": {
|
|
"get": {
|
|
"operationId": "Peach_ListProducts",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/peachListProductsResponse"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "An unexpected error response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/rpcStatus"
|
|
}
|
|
}
|
|
},
|
|
"tags": [
|
|
"Peach"
|
|
]
|
|
},
|
|
"post": {
|
|
"operationId": "Peach_CreateProduct",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/peachCreateProductResponse"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "An unexpected error response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/rpcStatus"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/peachCreateProductRequest"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"Peach"
|
|
]
|
|
},
|
|
"put": {
|
|
"operationId": "Peach_UpdateProduct",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/peachUpdateProductResponse"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "An unexpected error response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/rpcStatus"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/peachUpdateProductRequest"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"Peach"
|
|
]
|
|
}
|
|
},
|
|
"/v1/Product/{id}": {
|
|
"get": {
|
|
"operationId": "Peach_ReadProduct",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/peachReadProductResponse"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "An unexpected error response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/rpcStatus"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true,
|
|
"type": "string",
|
|
"format": "uint64"
|
|
}
|
|
],
|
|
"tags": [
|
|
"Peach"
|
|
]
|
|
},
|
|
"delete": {
|
|
"operationId": "Peach_DeleteProduct",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/peachDeleteProductResponse"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "An unexpected error response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/rpcStatus"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true,
|
|
"type": "string",
|
|
"format": "uint64"
|
|
}
|
|
],
|
|
"tags": [
|
|
"Peach"
|
|
]
|
|
}
|
|
},
|
|
"/v1/users": {
|
|
"get": {
|
|
"operationId": "Peach_ListUsers",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/peachListUsersResponse"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "An unexpected error response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/rpcStatus"
|
|
}
|
|
}
|
|
},
|
|
"tags": [
|
|
"Peach"
|
|
]
|
|
},
|
|
"post": {
|
|
"operationId": "Peach_CreateUser",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/peachCreateUserResponse"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "An unexpected error response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/rpcStatus"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/peachCreateUserRequest"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"Peach"
|
|
]
|
|
},
|
|
"put": {
|
|
"operationId": "Peach_UpdateUser",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/peachUpdateUserResponse"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "An unexpected error response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/rpcStatus"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/peachUpdateUserRequest"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"Peach"
|
|
]
|
|
}
|
|
},
|
|
"/v1/users/{id}": {
|
|
"get": {
|
|
"operationId": "Peach_ReadUser",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/peachReadUserResponse"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "An unexpected error response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/rpcStatus"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true,
|
|
"type": "string",
|
|
"format": "uint64"
|
|
}
|
|
],
|
|
"tags": [
|
|
"Peach"
|
|
]
|
|
},
|
|
"delete": {
|
|
"operationId": "Peach_DeleteUser",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/peachDeleteUserResponse"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "An unexpected error response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/rpcStatus"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true,
|
|
"type": "string",
|
|
"format": "uint64"
|
|
}
|
|
],
|
|
"tags": [
|
|
"Peach"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"peachCreateProductRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "#/definitions/peachProduct"
|
|
}
|
|
}
|
|
},
|
|
"peachCreateProductResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"result": {
|
|
"$ref": "#/definitions/peachProduct"
|
|
}
|
|
}
|
|
},
|
|
"peachCreateUserRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "#/definitions/peachUser"
|
|
}
|
|
}
|
|
},
|
|
"peachCreateUserResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"result": {
|
|
"$ref": "#/definitions/peachUser"
|
|
}
|
|
}
|
|
},
|
|
"peachDeleteProductResponse": {
|
|
"type": "object"
|
|
},
|
|
"peachDeleteUserResponse": {
|
|
"type": "object"
|
|
},
|
|
"peachListProductsResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"results": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"$ref": "#/definitions/peachProduct"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"peachListUsersResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"results": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"$ref": "#/definitions/peachUser"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"peachProduct": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"format": "uint64"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"description": {
|
|
"type": "string"
|
|
},
|
|
"price": {
|
|
"type": "number",
|
|
"format": "float"
|
|
}
|
|
}
|
|
},
|
|
"peachReadProductResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"result": {
|
|
"$ref": "#/definitions/peachProduct"
|
|
}
|
|
}
|
|
},
|
|
"peachReadUserResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"result": {
|
|
"$ref": "#/definitions/peachUser"
|
|
}
|
|
}
|
|
},
|
|
"peachUpdateProductRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "#/definitions/peachProduct"
|
|
}
|
|
}
|
|
},
|
|
"peachUpdateProductResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"result": {
|
|
"$ref": "#/definitions/peachProduct"
|
|
}
|
|
}
|
|
},
|
|
"peachUpdateUserRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"payload": {
|
|
"$ref": "#/definitions/peachUser"
|
|
}
|
|
}
|
|
},
|
|
"peachUpdateUserResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"result": {
|
|
"$ref": "#/definitions/peachUser"
|
|
}
|
|
}
|
|
},
|
|
"peachUser": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"format": "uint64"
|
|
},
|
|
"username": {
|
|
"type": "string"
|
|
},
|
|
"bio": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"protobufAny": {
|
|
"type": "object",
|
|
"properties": {
|
|
"@type": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": {}
|
|
},
|
|
"rpcStatus": {
|
|
"type": "object",
|
|
"properties": {
|
|
"code": {
|
|
"type": "integer",
|
|
"format": "int32"
|
|
},
|
|
"message": {
|
|
"type": "string"
|
|
},
|
|
"details": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"$ref": "#/definitions/protobufAny"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|