routegrpc: add swagger definitions too

This commit is contained in:
Cadey Ratio 2017-01-26 18:43:17 -08:00
parent b75f909362
commit de990c1d39
3 changed files with 296 additions and 4 deletions

View File

@ -1,13 +1,19 @@
#!/bin/bash
protoc -I/usr/local/include -I. \
-I$GOPATH/src \
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
--go_out=Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api,plugins=grpc:. \
route.proto
-I$GOPATH/src \
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
--go_out=Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api,plugins=grpc:. \
route.proto
protoc -I/usr/local/include -I. \
-I$GOPATH/src \
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
--grpc-gateway_out=logtostderr=true:. \
route.proto
protoc -I/usr/local/include -I. \
-I$GOPATH/src \
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
--swagger_out=logtostderr=true:. \
route.proto

View File

@ -1,5 +1,7 @@
syntax = "proto3";
// option go_package = "git.xeserv.us/xena/route/routerpc/routegrpc;routegrpc";
import "google/api/annotations.proto";
message BaseAPICall {

View File

@ -0,0 +1,284 @@
{
"swagger": "2.0",
"info": {
"title": "route.proto",
"version": "version not set"
},
"schemes": [
"http",
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/v1/hosts/create": {
"post": {
"operationId": "AddHost",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/AddHostResponse"
}
}
},
"tags": [
"Hosts"
]
}
},
"/v1/hosts/{host}": {
"get": {
"operationId": "GetHost",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/GetHostResponse"
}
}
},
"parameters": [
{
"name": "host",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "base.token",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "onionHost",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "id",
"in": "query",
"required": false,
"type": "string"
}
],
"tags": [
"Hosts"
]
},
"delete": {
"operationId": "RemoveHost",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/RemoveHostResponse"
}
}
},
"parameters": [
{
"name": "host",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"Hosts"
]
}
},
"/v1/tokens/createInitialToken": {
"post": {
"operationId": "CreateInitialToken",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/CreateInitialTokenResponse"
}
}
},
"tags": [
"Tokens"
]
}
},
"/v1/users/login": {
"post": {
"operationId": "Login",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/LoginResponse"
}
}
},
"tags": [
"Users"
]
}
}
},
"definitions": {
"AddHostRequest": {
"type": "object",
"properties": {
"base": {
"$ref": "#/definitions/BaseAPICall"
},
"hostname": {
"type": "string"
},
"onionKey": {
"type": "string",
"format": "byte"
}
}
},
"AddHostResponse": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"token": {
"type": "string"
},
"hostname": {
"type": "string"
},
"onionHostname": {
"type": "string"
}
}
},
"BaseAPICall": {
"type": "object",
"properties": {
"token": {
"type": "string"
}
}
},
"CreateInitialTokenRequest": {
"type": "object",
"properties": {
"username": {
"type": "string"
}
}
},
"CreateInitialTokenResponse": {
"type": "object",
"properties": {
"token": {
"type": "string"
},
"tokenid": {
"type": "string"
}
}
},
"GetHostRequest": {
"type": "object",
"properties": {
"base": {
"$ref": "#/definitions/BaseAPICall"
},
"host": {
"type": "string"
},
"onionHost": {
"type": "string"
},
"id": {
"type": "string"
}
}
},
"GetHostResponse": {
"type": "object",
"properties": {
"host": {
"$ref": "#/definitions/Host"
}
}
},
"Host": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"hostname": {
"type": "string"
},
"onionHostname": {
"type": "string"
},
"token": {
"type": "string"
},
"onionKey": {
"type": "string",
"format": "byte"
},
"kind": {
"type": "integer",
"format": "int32"
},
"port": {
"type": "string"
}
}
},
"LoginRequest": {
"type": "object",
"properties": {
"oauth2provider": {
"type": "string"
}
}
},
"LoginResponse": {
"type": "object",
"properties": {
"token": {
"type": "string"
},
"uid": {
"type": "string"
}
}
},
"RemoveHostRequest": {
"type": "object",
"properties": {
"base": {
"$ref": "#/definitions/BaseAPICall"
},
"host": {
"type": "string"
}
}
},
"RemoveHostResponse": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"format": "boolean"
}
}
}
}
}