add swagger config
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-05-22 03:46:56 +07:00
parent 30af992172
commit ffd1396739
11 changed files with 797 additions and 16 deletions
+7 -3
View File
@@ -4,9 +4,10 @@
// protoc v5.26.1
// source: main.proto
package crm
package proto
import (
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
_ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
@@ -828,6 +829,9 @@ var file_main_proto_rawDesc = []byte{
0x0a, 0x0a, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x63, 0x72,
0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65,
0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0f, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x43, 0x61, 0x74, 0x61,
0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x22, 0x41, 0x0a, 0x0a, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f,
0x67, 0x52, 0x73, 0x70, 0x12, 0x33, 0x0a, 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x69,
@@ -926,8 +930,8 @@ var file_main_proto_rawDesc = []byte{
0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x42, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72, 0x75,
0x6d, 0x62, 0x73, 0x52, 0x73, 0x70, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11,
0x2f, 0x62, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x2f, 0x7b, 0x69, 0x64,
0x7d, 0x42, 0x09, 0x5a, 0x07, 0x70, 0x6b, 0x67, 0x2f, 0x63, 0x72, 0x6d, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
0x7d, 0x42, 0x0e, 0x92, 0x41, 0x00, 0x5a, 0x09, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
+2 -2
View File
@@ -2,11 +2,11 @@
// source: main.proto
/*
Package crm is a reverse proxy.
Package proto is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package crm
package proto
import (
"context"
-334
View File
@@ -1,334 +0,0 @@
{
"swagger": "2.0",
"info": {
"title": "main.proto",
"version": "version not set"
},
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/breadcrumbs/{id}": {
"get": {
"operationId": "CRM_GetBreadcrumbs",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/crmBreadcrumbsRsp"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/runtimeError"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string",
"format": "int64"
}
],
"tags": [
"CRM"
]
}
},
"/catalog": {
"get": {
"operationId": "CRM_GetCatalog",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/crmCatalogRsp"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/runtimeError"
}
}
},
"tags": [
"CRM"
]
}
},
"/positions/{id}": {
"get": {
"operationId": "CRM_GetPositions",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/crmPositionsRsp"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/runtimeError"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string",
"format": "int64"
}
],
"tags": [
"CRM"
]
}
},
"/products/{id}": {
"get": {
"operationId": "CRM_GetProduct",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/crmProductRsp"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/runtimeError"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string",
"format": "int64"
}
],
"tags": [
"CRM"
]
}
}
},
"definitions": {
"crmBreadcrumbsRsp": {
"type": "object",
"properties": {
"categories": {
"type": "array",
"items": {
"$ref": "#/definitions/crmCategory"
}
}
}
},
"crmCatalogRsp": {
"type": "object",
"properties": {
"categories": {
"type": "array",
"items": {
"$ref": "#/definitions/crmCategory"
}
}
}
},
"crmCategory": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "int64"
},
"name": {
"type": "string"
},
"uri": {
"type": "string"
},
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/crmCategory"
}
}
}
},
"crmCharacteristic": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"crmGroupedProduct": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"uri": {
"type": "string"
},
"image": {
"type": "string"
}
}
},
"crmPositionsRsp": {
"type": "object",
"properties": {
"products": {
"type": "array",
"items": {
"$ref": "#/definitions/crmProduct"
}
}
}
},
"crmProduct": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "int64"
},
"article": {
"type": "string"
},
"name": {
"type": "string"
},
"uri": {
"type": "string"
},
"images": {
"type": "array",
"items": {
"type": "string"
}
},
"description": {
"type": "string"
},
"grouped_products": {
"type": "array",
"items": {
"$ref": "#/definitions/crmGroupedProduct"
}
},
"unit": {
"type": "string"
},
"inventory": {
"type": "number",
"format": "double"
},
"variants": {
"type": "array",
"items": {
"$ref": "#/definitions/crmVariant"
}
},
"characteristics": {
"type": "array",
"items": {
"$ref": "#/definitions/crmCharacteristic"
}
},
"category": {
"type": "string",
"format": "int64"
}
}
},
"crmProductRsp": {
"type": "object",
"properties": {
"product": {
"$ref": "#/definitions/crmProduct"
}
}
},
"crmProperty": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"crmVariant": {
"type": "object",
"properties": {
"price": {
"type": "string",
"format": "int64"
},
"properties": {
"type": "array",
"items": {
"$ref": "#/definitions/crmProperty"
}
}
}
},
"protobufAny": {
"type": "object",
"properties": {
"type_url": {
"type": "string"
},
"value": {
"type": "string",
"format": "byte"
}
}
},
"runtimeError": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/protobufAny"
}
}
}
}
}
}
+1 -1
View File
@@ -4,7 +4,7 @@
// - protoc v5.26.1
// source: main.proto
package crm
package proto
import (
context "context"