From de990c1d3973893f7c1191f053a35584efbe3c9b Mon Sep 17 00:00:00 2001 From: Cadey Dodrill Date: Thu, 26 Jan 2017 18:43:17 -0800 Subject: [PATCH] routegrpc: add swagger definitions too --- routerpc/routegrpc/regen.sh | 14 +- routerpc/routegrpc/route.proto | 2 + routerpc/routegrpc/route.swagger.json | 284 ++++++++++++++++++++++++++ 3 files changed, 296 insertions(+), 4 deletions(-) create mode 100644 routerpc/routegrpc/route.swagger.json diff --git a/routerpc/routegrpc/regen.sh b/routerpc/routegrpc/regen.sh index 2ad23d6..37a1af5 100755 --- a/routerpc/routegrpc/regen.sh +++ b/routerpc/routegrpc/regen.sh @@ -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 diff --git a/routerpc/routegrpc/route.proto b/routerpc/routegrpc/route.proto index d05f9a6..4096859 100644 --- a/routerpc/routegrpc/route.proto +++ b/routerpc/routegrpc/route.proto @@ -1,5 +1,7 @@ syntax = "proto3"; +// option go_package = "git.xeserv.us/xena/route/routerpc/routegrpc;routegrpc"; + import "google/api/annotations.proto"; message BaseAPICall { diff --git a/routerpc/routegrpc/route.swagger.json b/routerpc/routegrpc/route.swagger.json new file mode 100644 index 0000000..b4d2658 --- /dev/null +++ b/routerpc/routegrpc/route.swagger.json @@ -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" + } + } + } + } +}