From ebc29e31f35ea3b303e5e7d4d8e9433332a63747 Mon Sep 17 00:00:00 2001 From: walterlife Date: Tue, 10 Jan 2023 09:19:52 +0800 Subject: [PATCH] add catalog swagger doc --- .../cmd/controller/docs/docs.go | 242 ++++++++++++++++++ .../cmd/controller/docs/swagger.json | 217 ++++++++++++++++ .../cmd/controller/docs/swagger.yaml | 148 +++++++++++ 3 files changed, 607 insertions(+) create mode 100644 eventmesh-catalog-go/cmd/controller/docs/docs.go create mode 100644 eventmesh-catalog-go/cmd/controller/docs/swagger.json create mode 100644 eventmesh-catalog-go/cmd/controller/docs/swagger.yaml diff --git a/eventmesh-catalog-go/cmd/controller/docs/docs.go b/eventmesh-catalog-go/cmd/controller/docs/docs.go new file mode 100644 index 0000000000..05c922a13e --- /dev/null +++ b/eventmesh-catalog-go/cmd/controller/docs/docs.go @@ -0,0 +1,242 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package docs GENERATED BY SWAG; DO NOT EDIT +// This file was generated by swaggo/swag +package docs + +import "github.com/swaggo/swag" + +const docTemplate = `{ + "schemes": {{ marshal .Schemes }}, + "swagger": "2.0", + "info": { + "description": "{{escape .Description}}", + "title": "{{.Title}}", + "contact": {}, + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" + }, + "version": "{{.Version}}" + }, + "host": "{{.Host}}", + "basePath": "{{.BasePath}}", + "paths": { + "/catalog": { + "get": { + "description": "query event catalog list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Catalog" + ], + "summary": "query event catalog list", + "parameters": [ + { + "type": "string", + "description": "query page", + "name": "page", + "in": "query" + }, + { + "type": "string", + "description": "query size", + "name": "size", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/main.QueryEventsResponse" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "500": { + "description": "Internal Server Error" + } + } + }, + "post": { + "description": "save event catalog", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Catalog" + ], + "summary": "save event catalog", + "parameters": [ + { + "description": "event catalog data", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/main.SaveEventRequest" + } + } + ], + "responses": { + "200": { + "description": "OK" + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "500": { + "description": "Internal Server Error" + } + } + } + }, + "/catalog/{eventId}": { + "get": { + "description": "query event catalog detail info", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Catalog" + ], + "summary": "query event catalog detail info", + "parameters": [ + { + "type": "string", + "description": "event id", + "name": "eventId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/main.QueryEventResponse" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "500": { + "description": "Internal Server Error" + } + } + } + } + }, + "definitions": { + "main.QueryEventResponse": { + "type": "object", + "properties": { + "event": { + "$ref": "#/definitions/model.Event" + } + } + }, + "main.QueryEventsResponse": { + "type": "object", + "properties": { + "events": { + "type": "array", + "items": { + "$ref": "#/definitions/model.Event" + } + }, + "total": { + "description": "total count", + "type": "integer" + } + } + }, + "main.SaveEventRequest": { + "type": "object", + "properties": { + "event": { + "$ref": "#/definitions/model.Event" + } + } + }, + "model.Event": { + "type": "object", + "properties": { + "create_time": { + "type": "string" + }, + "definition": { + "type": "string" + }, + "file_name": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "status": { + "type": "integer" + }, + "title": { + "type": "string" + }, + "update_time": { + "type": "string" + }, + "version": { + "type": "string" + } + } + } + } +}` + +// SwaggerInfo holds exported Swagger Info so clients can modify it +var SwaggerInfo = &swag.Spec{ + Version: "1.0", + Host: "", + BasePath: "", + Schemes: []string{}, + Title: "Event Catalog API", + Description: "This is a event catalog server.", + InfoInstanceName: "swagger", + SwaggerTemplate: docTemplate, +} + +func init() { + swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) +} diff --git a/eventmesh-catalog-go/cmd/controller/docs/swagger.json b/eventmesh-catalog-go/cmd/controller/docs/swagger.json new file mode 100644 index 0000000000..f1aa471326 --- /dev/null +++ b/eventmesh-catalog-go/cmd/controller/docs/swagger.json @@ -0,0 +1,217 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +{ + "swagger": "2.0", + "info": { + "description": "This is a event catalog server.", + "title": "Event Catalog API", + "contact": {}, + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" + }, + "version": "1.0" + }, + "paths": { + "/catalog": { + "get": { + "description": "query event catalog list", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Catalog" + ], + "summary": "query event catalog list", + "parameters": [ + { + "type": "string", + "description": "query page", + "name": "page", + "in": "query" + }, + { + "type": "string", + "description": "query size", + "name": "size", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/main.QueryEventsResponse" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "500": { + "description": "Internal Server Error" + } + } + }, + "post": { + "description": "save event catalog", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Catalog" + ], + "summary": "save event catalog", + "parameters": [ + { + "description": "event catalog data", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/main.SaveEventRequest" + } + } + ], + "responses": { + "200": { + "description": "OK" + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "500": { + "description": "Internal Server Error" + } + } + } + }, + "/catalog/{eventId}": { + "get": { + "description": "query event catalog detail info", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Catalog" + ], + "summary": "query event catalog detail info", + "parameters": [ + { + "type": "string", + "description": "event id", + "name": "eventId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/main.QueryEventResponse" + } + }, + "400": { + "description": "Bad Request" + }, + "404": { + "description": "Not Found" + }, + "500": { + "description": "Internal Server Error" + } + } + } + } + }, + "definitions": { + "main.QueryEventResponse": { + "type": "object", + "properties": { + "event": { + "$ref": "#/definitions/model.Event" + } + } + }, + "main.QueryEventsResponse": { + "type": "object", + "properties": { + "events": { + "type": "array", + "items": { + "$ref": "#/definitions/model.Event" + } + }, + "total": { + "description": "total count", + "type": "integer" + } + } + }, + "main.SaveEventRequest": { + "type": "object", + "properties": { + "event": { + "$ref": "#/definitions/model.Event" + } + } + }, + "model.Event": { + "type": "object", + "properties": { + "create_time": { + "type": "string" + }, + "definition": { + "type": "string" + }, + "file_name": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "status": { + "type": "integer" + }, + "title": { + "type": "string" + }, + "update_time": { + "type": "string" + }, + "version": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/eventmesh-catalog-go/cmd/controller/docs/swagger.yaml b/eventmesh-catalog-go/cmd/controller/docs/swagger.yaml new file mode 100644 index 0000000000..2984b7ec4d --- /dev/null +++ b/eventmesh-catalog-go/cmd/controller/docs/swagger.yaml @@ -0,0 +1,148 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +definitions: + main.QueryEventResponse: + properties: + event: + $ref: '#/definitions/model.Event' + type: object + main.QueryEventsResponse: + properties: + events: + items: + $ref: '#/definitions/model.Event' + type: array + total: + description: total count + type: integer + type: object + main.SaveEventRequest: + properties: + event: + $ref: '#/definitions/model.Event' + type: object + model.Event: + properties: + create_time: + type: string + definition: + type: string + file_name: + type: string + id: + type: integer + status: + type: integer + title: + type: string + update_time: + type: string + version: + type: string + type: object +info: + contact: {} + description: This is a event catalog server. + license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: Event Catalog API + version: "1.0" +paths: + /catalog: + get: + consumes: + - application/json + description: query event catalog list + parameters: + - description: query page + in: query + name: page + type: string + - description: query size + in: query + name: size + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/main.QueryEventsResponse' + "400": + description: Bad Request + "404": + description: Not Found + "500": + description: Internal Server Error + summary: query event catalog list + tags: + - Catalog + post: + consumes: + - application/json + description: save event catalog + parameters: + - description: event catalog data + in: body + name: request + required: true + schema: + $ref: '#/definitions/main.SaveEventRequest' + produces: + - application/json + responses: + "200": + description: OK + "400": + description: Bad Request + "404": + description: Not Found + "500": + description: Internal Server Error + summary: save event catalog + tags: + - Catalog + /catalog/{eventId}: + get: + consumes: + - application/json + description: query event catalog detail info + parameters: + - description: event id + in: path + name: eventId + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/main.QueryEventResponse' + "400": + description: Bad Request + "404": + description: Not Found + "500": + description: Internal Server Error + summary: query event catalog detail info + tags: + - Catalog +swagger: "2.0"