v2.0.0 released - supporting Echo v4 now.

master
Alex 2019-12-18 11:26:20 +01:00
parent 2fa7b58c03
commit fb1c53169c
31 changed files with 822 additions and 280 deletions

9
.gitignore vendored
View File

@ -12,4 +12,11 @@
*.out
.DS_Store
tmp
tmp
*.bak
vendor/
.cache/
.idea/
bin/*.macos
bin/*.linux
bin/*.exe

View File

@ -5,6 +5,8 @@ go:
- 1.9.x
- 1.10.x
- 1.11.x
- 1.12.x
- 1.13.x
- tip
before_install:

214
LICENSE
View File

@ -1,21 +1,201 @@
MIT License
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Copyright (c) 2018 陈文强
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
1. Definitions.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
Licensed 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.

View File

@ -1,11 +1,20 @@
English | [简体中文](./README_zh-CN.md)
English version
# Echoswagger
Swagger UI generator for Echo framework
Swagger UI generator for Echo framework, v4
[![Go Report Card](https://goreportcard.com/badge/github.com/pangpanglabs/echoswagger)](https://goreportcard.com/report/github.com/pangpanglabs/echoswagger)
[![Build Status](https://travis-ci.org/pangpanglabs/echoswagger.svg?branch=master)](https://travis-ci.org/pangpanglabs/echoswagger)
[![codecov](https://codecov.io/gh/pangpanglabs/echoswagger/branch/master/graph/badge.svg)](https://codecov.io/gh/pangpanglabs/echoswagger)
[![Go Report Card](https://goreportcard.com/badge/github.com/echo-go/echoswagger)](https://goreportcard.com/report/github.com/echo-go/echoswagger)
[![Build Status](https://travis-ci.org/echo-go/echoswagger.svg?branch=master)](https://travis-ci.org/echo-go/echoswagger)
[![codecov](https://codecov.io/gh/echo-go/echoswagger/branch/master/graph/badge.svg)](https://codecov.io/gh/echo-go/echoswagger)
## Differences
This is fork of [pangpanglabs/echoswagger](https://github.com/pangpanglabs/echoswagger)
With several differences:
* Switched to [Echo framework, v4](https://github.com/labstack/echo/tree/v4.1.11)
* Modular dependencies support
* Switched to [Apache 2.0](https://github.com/echo-go/echoswagger/blob/master/LICENSE) license
* Builder docker script for example code
## Feature
- No SwaggerUI HTML/CSS dependency
@ -15,7 +24,7 @@ Swagger UI generator for Echo framework
## Installation
```
go get github.com/pangpanglabs/echoswagger
go get github.com/echo-go/echoswagger
```
## Example
@ -25,13 +34,20 @@ package main
import (
"net/http"
"github.com/labstack/echo"
"github.com/pangpanglabs/echoswagger"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/echo-go/echoswagger"
)
func main() {
e := echo.New()
e.Use(middleware.Recover())
e.Use(middleware.Logger())
// ApiRoot with Echo instance
r := echoswagger.New(echo.New(), "/doc", nil)
r := echoswagger.New(e, "/doc", nil)
// Routes with parameters & responses
r.POST("/", createUser).
@ -226,4 +242,4 @@ default | * | Default value, which type is same as the field's type.
## License
[MIT](https://github.com/pangpanglabs/echoswagger/blob/master/LICENSE)
[Apache 2.0](https://github.com/echo-go/echoswagger/blob/master/LICENSE)

View File

@ -1,229 +0,0 @@
[English](./README.md) | 简体中文
# Echoswagger
[Echo](https://github.com/labstack/echo) 框架的 [Swagger UI](https://github.com/swagger-api/swagger-ui) 生成器
[![Go Report Card](https://goreportcard.com/badge/github.com/pangpanglabs/echoswagger)](https://goreportcard.com/report/github.com/pangpanglabs/echoswagger)
[![Build Status](https://travis-ci.org/pangpanglabs/echoswagger.svg?branch=master)](https://travis-ci.org/pangpanglabs/echoswagger)
[![codecov](https://codecov.io/gh/pangpanglabs/echoswagger/branch/master/graph/badge.svg)](https://codecov.io/gh/pangpanglabs/echoswagger)
## 特性
- 不依赖任何SwaggerUI的HTML/CSS文件
- 与Echo高度整合低侵入式设计
- 利用强类型语言和链式编程的优势,简单易用
- 及时的垃圾回收,低内存占用
## 安装
```
go get github.com/pangpanglabs/echoswagger
```
## 示例
```go
package main
import (
"net/http"
"github.com/pangpanglabs/echoswagger"
"github.com/labstack/echo"
)
func main() {
// ApiRoot with Echo instance
r := echoswagger.New(echo.New(), "/doc", nil)
// Routes with parameters & responses
r.POST("/", createUser).
AddParamBody(User{}, "body", "User input struct", true).
AddResponse(http.StatusCreated, "successful", nil, nil)
// Start server
r.Echo().Logger.Fatal(r.Echo().Start(":1323"))
}
type User struct {
Name string
}
// Handler
func createUser(c echo.Context) error {
return c.JSON(http.StatusCreated, nil)
}
```
## 用法
#### 用`New()`创建`ApiRoot`,此方法是对`echo.New()`方法的封装
```
r := echoswagger.New(echo.New(), "/doc", nil)
```
你可以用这个`ApiRoot`来:
- 设置Security定义, 请求/响应Content-TypeUI选项Scheme等。
```
r.AddSecurityAPIKey("JWT", "JWT Token", echoswagger.SecurityInHeader).
SetRequestContentType("application/x-www-form-urlencoded", "multipart/form-data").
SetUI(UISetting{HideTop: true}).
SetScheme("https", "http")
```
- 获取`echo.Echo`实例。
```
r.Echo()
```
- 在默认组中注册一个GET、POST、PUT、DELETE、OPTIONS、HEAD或PATCH路由这些是对Echo的注册路由方法的封装。
此方法返回一个`Api`实例。
```
r.GET("/:id", handler)
```
- 以及: ↓
#### 用`Group()`创建`ApiGroup`,此方法是对`echo.Group()`方法的封装
```
g := r.Group("Users", "/users")
```
你可以用这个`ApiGroup`来:
- 设置描述,等。
```
g.SetDescription("The desc of group")
```
- 为此组中的所有路由设置Security。
```
g.SetSecurity("JWT")
```
- 获取`echo.Group`实例。
```
g.EchoGroup()
```
- 以及: ↓
#### 在`ApiGroup`中注册一个新的路由
Echoswagger支持GET、POST、PUT、DELETE、OPTIONS、HEAD或PATCH方法这些是对Echo的注册路由方法的封装。
```
a := g.GET("/:id", handler)
```
你可以使用此`Api`实例来:
- 使用以下方法添加参数:
```
AddParamPath(p interface{}, name, desc string)
AddParamPathNested(p interface{})
AddParamQuery(p interface{}, name, desc string, required bool)
AddParamQueryNested(p interface{})
AddParamForm(p interface{}, name, desc string, required bool)
AddParamFormNested(p interface{})
AddParamHeader(p interface{}, name, desc string, required bool)
AddParamHeaderNested(p interface{})
AddParamBody(p interface{}, name, desc string, required bool)
AddParamFile(name, desc string, required bool)
```
后缀带有`Nested`的方法把参数`p`的字段看做多个参数,所以它必须是结构体类型的。
例:
```
type SearchInput struct {
Q string `query:"q" swagger:"desc(Keywords),required"`
SkipCount int `query:"skipCount"`
}
a.AddParamQueryNested(SearchInput{})
```
等价于:
```
a.AddParamQuery("", "q", "Keywords", true).
AddParamQuery(0, "skipCount", "", false)
```
- 添加响应。
```
a.AddResponse(http.StatusOK, "response desc", body{}, nil)
```
- 设置Security请求/响应的Content-Type概要描述等。
```
a.SetSecurity("JWT").
SetResponseContentType("application/xml").
SetSummary("The summary of API").
SetDescription("The desc of API")
```
- 获取`echo.Route`实例。
```
a.Route()
```
#### 使用swagger标签你可以在`AddParam...`方法中设置更多信息
例:
```
type User struct {
Age int `swagger:"min(0),max(99)"`
Gender string `swagger:"enum(male|female|other),required"`
Money []float64 `swagger:"default(0),readOnly"`
}
a.AddParamBody(&User{}, "Body", "", true)
```
此定义等价于:
```
{
"definitions": {
"User": {
"type": "object",
"properties": {
"Age": {
"type": "integer",
"format": "int32",
"minimum": 0,
"maximum": 99
},
"Gender": {
"type": "string",
"enum": [
"male",
"female",
"other"
],
"format": "string"
},
"Money": {
"type": "array",
"items": {
"type": "number",
"default": 0,
"format": "double"
},
"readOnly": true
}
},
"required": [
"Gender"
]
}
}
}
```
**支持的`swagger`标签:**
Tag | Type | Description
---|:---:|---
desc | `string` | 描述。
maximum | `number` | -
minimum | `number` | -
maxLength | `integer` | -
minLength | `integer` | -
allowEmpty | `boolean` | 设置传递空值参数的功能。 这仅对`query`或`formData`参数有效并允许你发送仅具有名称或空值的参数。默认值为“false”。
required | `boolean` | 确定此参数是否必需。如果参数是`in`“path”则此属性默认为“true”。否则可以设置此属性其默认值为“false”。
readOnly | `boolean` | 仅与Schema`"properties"`定义相关。将属性声明为“只读”。这意味着它可以作为响应的一部分发送但绝不能作为请求的一部分发送。标记为“readOnly”的属性为“true”不应位于已定义模式的“required”列表中。默认值为“false”。
enum | [*] | 枚举值,多个值应以“\|”分隔。
default | * | 默认值,该类型与字段的类型相同。
## 参考
[OpenAPI Specification 2.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md)
## License
[MIT](https://github.com/pangpanglabs/echoswagger/blob/master/LICENSE)

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package echoswagger
// CDN refer to https://www.jsdelivr.com/package/npm/swagger-ui-dist

0
bin/.gitkeep Normal file
View File

13
build/Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM golang
LABEL maintainer="alex@webz.asia"
RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
ENV GOPATH=/go
VOLUME /go
WORKDIR /go
CMD ["go", "version"]

54
build/build.sh Executable file
View File

@ -0,0 +1,54 @@
#!/usr/bin/env bash
# Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
#
# Licensed 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.
#
# @author Alex aka mailoman <alex@webz.asia>
# @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
# @since 18.12.2019
path=$(pwd)
dir="${path%/*}"
path=${dir}
repo="${dir##*/}"
dir="${dir%/*}"
username=${dir##*/}
dir="${dir%/*}"
domain=${dir##*/}
image="go2dep"
image_exists=$(docker images|grep ${image})
volume_cache="-v ${path}/.cache:/go/pkg"
if [[ -z ${image_exists} ]];then
echo "building image ${image}"
docker build -t ${image} .
fi
if [[ ! -d ${path}/vendor ]];then
echo "dep init"
docker run --rm ${volume_cache} -v ${path}:/go/src/$domain/$username/$repo -w="/go/src/$domain/$username/$repo" ${image} dep init
fi
echo "Building $domain/$username/$repo/examples/main.go"
#buildVersion=$(git tag|tail -n1)
#buildHash=$(git log -1 --pretty=format:"%h")
#buildTime=$(date)
#buildFlags="-X '$domain/$username/$repo/version.BuildVersion=${buildVersion}' -X '$domain/$username/$repo/version.BuildHash=${buildHash}' -X '$domain/$username/$repo/version.BuildTime=${buildTime}'"
buildFlags=""
echo " build flags: ${buildFlags}"
docker run --rm ${volume_cache} -v ${path}:/go/src/$domain/$username/$repo -v ${path}/bin:/go/bin -w="/go/src/$domain/$username/$repo" -e GOOS=linux -e GOARCH=amd64 -e CGO_ENABLED=0 ${image} go build -ldflags="${buildFlags}" -o /go/bin/example-main-x64.linux ./examples/
docker run --rm ${volume_cache} -v ${path}:/go/src/$domain/$username/$repo -v ${path}/bin:/go/bin -w="/go/src/$domain/$username/$repo" -e GOOS=darwin -e GOARCH=amd64 -e CGO_ENABLED=0 ${image} go build -ldflags="${buildFlags}" -o /go/bin/example-main-x64.macos ./examples/
docker run --rm ${volume_cache} -v ${path}:/go/src/$domain/$username/$repo -v ${path}/bin:/go/bin -w="/go/src/$domain/$username/$repo" -e GOOS=windows -e GOARCH=amd64 -e CGO_ENABLED=0 ${image} go build -ldflags="${buildFlags}" -o /go/bin/example-main-x64.exe ./examples/

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package echoswagger
import (

View File

@ -1,10 +1,32 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package main
import (
"net/http"
"github.com/labstack/echo"
"github.com/pangpanglabs/echoswagger"
"github.com/labstack/echo/v4"
"github.com/echo-go/echoswagger"
)
type PetController struct{}

View File

@ -1,11 +1,33 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package main
import (
"net/http"
"time"
"github.com/labstack/echo"
"github.com/pangpanglabs/echoswagger"
"github.com/labstack/echo/v4"
"github.com/echo-go/echoswagger"
)
type StoreController struct{}

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package main
import (
@ -5,8 +26,9 @@ import (
"net/http"
"time"
"github.com/labstack/echo"
"github.com/pangpanglabs/echoswagger"
"github.com/labstack/echo/v4"
"github.com/echo-go/echoswagger"
)
type UserController struct{}

View File

@ -1,8 +1,31 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package main
import (
"github.com/labstack/echo"
"github.com/pangpanglabs/echoswagger"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/echo-go/echoswagger"
)
func main() {
@ -13,6 +36,9 @@ func main() {
func initServer() echoswagger.ApiRoot {
e := echo.New()
e.Use(middleware.Recover())
e.Use(middleware.Logger())
se := echoswagger.New(e, "doc/", &echoswagger.Info{
Title: "Swagger Petstore",
Description: "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package main
import (
@ -6,9 +27,10 @@ import (
"net/http/httptest"
"testing"
"github.com/labstack/echo"
"github.com/pangpanglabs/echoswagger"
"github.com/labstack/echo/v4"
"github.com/stretchr/testify/assert"
"github.com/echo-go/echoswagger"
)
func TestMain(t *testing.T) {

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package echoswagger
import (

9
go.mod Normal file
View File

@ -0,0 +1,9 @@
module github.com/echo-go/echoswagger
require (
github.com/labstack/echo v3.3.10+incompatible // indirect
github.com/labstack/echo/v4 v4.1.11
github.com/stretchr/testify v1.4.0
)
go 1.13

39
go.sum Normal file
View File

@ -0,0 +1,39 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/labstack/echo v3.3.10+incompatible h1:pGRcYk231ExFAyoAjAfD85kQzRJCRI8bbnE7CX5OEgg=
github.com/labstack/echo v3.3.10+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s=
github.com/labstack/echo/v4 v4.1.11 h1:z0BZoArY4FqdpUEl+wlHp4hnr/oSR6MTmQmv8OHSoww=
github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g=
github.com/labstack/gommon v0.3.0 h1:JEeO0bvc78PKdyHxloTKiF8BD5iGrH8T6MSeGvSgob0=
github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg=
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.0.1 h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8WdUSz8=
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ=
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package echoswagger
import (
@ -7,7 +28,7 @@ import (
"net/http"
"reflect"
"github.com/labstack/echo"
"github.com/labstack/echo/v4"
)
type ParamInType string

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package echoswagger
import (

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package echoswagger
type (

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package echoswagger
import "errors"

View File

@ -1,10 +1,31 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package echoswagger
import (
"net/http/httptest"
"testing"
"github.com/labstack/echo"
"github.com/labstack/echo/v4"
"github.com/stretchr/testify/assert"
)

23
spec.go
View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package echoswagger
import (
@ -6,7 +27,7 @@ import (
"net/url"
"reflect"
"github.com/labstack/echo"
"github.com/labstack/echo/v4"
)
const (

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package echoswagger
import (
@ -7,7 +28,7 @@ import (
"reflect"
"testing"
"github.com/labstack/echo"
"github.com/labstack/echo/v4"
"github.com/stretchr/testify/assert"
)

21
tag.go
View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package echoswagger
import (

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package echoswagger
import (

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package echoswagger
import (

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package echoswagger
import (

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package echoswagger
import (
@ -5,18 +26,19 @@ import (
"strconv"
"sync"
"github.com/labstack/echo"
"github.com/labstack/echo/v4"
)
/*
TODO:
1.pattern
2.opreationId
@TODO:
1. pattern
2. opreationId repeated
Notice:
1.EmailURL
2.SetSecurity/SetSecurityWithScope SecurityANDSetSecurity/SetSecurityWithScope SecurityOR
3.Map Key
1. Email and URL will not be verified because it does not affect the normal display of the page
2. SetSecurity / SetSecurityWithScope Pass multiple parameters to indicate that the security relationship is an AND relationship;
multiple calls to SetSecurity / SetSecurityWithScope Security are an OR relationship
3. Only support the basic type of Map Key
*/
type ApiRouter interface {

View File

@ -1,3 +1,24 @@
/*
* Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
*
* Licensed 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.
*
* @author Alex aka mailoman <alex@webz.asia>
* @copyright Copyright (c) 2019 Alex aka mailoman <alex@webz.asia>
* @since 18.12.2019
*
*/
package echoswagger
import (
@ -7,7 +28,7 @@ import (
"testing"
"time"
"github.com/labstack/echo"
"github.com/labstack/echo/v4"
"github.com/stretchr/testify/assert"
)
@ -51,7 +72,7 @@ func TestNew(t *testing.T) {
info: &Info{
Title: "Test project",
Contact: &Contact{
URL: "https://github.com/pangpanglabs/echoswagger",
URL: "https://github.com/echo-go/echoswagger",
},
},
expectPaths: []string{"/doc", "/doc/swagger.json"},