chore: remove swagger-files from current project in favor of github.com/swaggo/files (#215)

This commit is contained in:
Bogdan U 2022-06-11 09:56:01 +03:00 committed by GitHub
parent 01231131c7
commit 08063514f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 1 additions and 704 deletions

84
b0x.yml
View File

@ -1,84 +0,0 @@
# all folders and files are relative to the path
# where fileb0x was run at!
# default: main
pkg: swaggerFiles
# destination
dest: "./swaggerFiles/"
# gofmt
# type: bool
# default: false
fmt: true
# compress files
# at the moment, only supports gzip
#
# type: object
compression:
# activates the compression
#
# type: bool
# default: false
compress: false
# valid values are:
# -> "NoCompression"
# -> "BestSpeed"
# -> "BestCompression"
# -> "DefaultCompression" or ""
#
# type: string
# default: "DefaultCompression" # when: Compress == true && Method == ""
method: ""
# true = do it yourself (the file is written as gzip compressed file into the memory file system)
# false = decompress files at run time (while writing file into memory file system)
#
# type: bool
# default: false
keep: false
# ---------------
# -- DANGEROUS --
# ---------------
#
# cleans the destination folder (only b0xfiles)
# you should use this when using the spread function
# type: bool
# default: false
clean: true
# default: ab0x.go
output: "ab0x.go"
# [unexporTed] builds non-exporTed functions, variables and types...
# type: bool
# default: false
unexporTed: false
# [spread] means it will make a file to hold all fileb0x data
# and each file into a separaTed .go file
#
# example:
# theres 2 files in the folder assets, they're: hello.json and world.txt
# when spread is activaTed, fileb0x will make a file:
# b0x.go or [output]'s data, assets_hello.json.go and assets_world.txt.go
#
#
# type: bool
# default: false
spread: true
# type: array of objects
custom:
- files:
# everything inside the folder
# type: array of strings
- "./dist/"
# base is the path that will be removed from all files' path
# type: string
base: "dist"

View File

@ -1,139 +0,0 @@
// Code generated by fileb0x at "2021-08-11 21:14:46.428511689 +0300 EEST m=+0.096329763" from config file "b0x.yaml" DO NOT EDIT.
// modification hash(37610a5b0ca328f5072d5ee653766db2.84893f7d7f6af7d7916db9fe20160151)
package swaggerFiles
import (
"bytes"
"context"
"io"
"net/http"
"os"
"path"
"golang.org/x/net/webdav"
)
var (
// CTX is a context for webdav vfs
CTX = context.Background()
// FS is a virtual memory file system
FS = webdav.NewMemFS()
// Handler is used to server files through a http handler
Handler *webdav.Handler
// HTTP is the http file system
HTTP http.FileSystem = new(HTTPFS)
)
// HTTPFS implements http.FileSystem
type HTTPFS struct {
// Prefix allows to limit the path of all requests. F.e. a prefix "css" would allow only calls to /css/*
Prefix string
}
func init() {
err := CTX.Err()
if err != nil {
panic(err)
}
Handler = &webdav.Handler{
FileSystem: FS,
LockSystem: webdav.NewMemLS(),
}
}
// Open a file
func (hfs *HTTPFS) Open(path string) (http.File, error) {
path = hfs.Prefix + path
f, err := FS.OpenFile(CTX, path, os.O_RDONLY, 0644)
if err != nil {
return nil, err
}
return f, nil
}
// ReadFile is adapTed from ioutil
func ReadFile(path string) ([]byte, error) {
f, err := FS.OpenFile(CTX, path, os.O_RDONLY, 0644)
if err != nil {
return nil, err
}
buf := bytes.NewBuffer(make([]byte, 0, bytes.MinRead))
// If the buffer overflows, we will get bytes.ErrTooLarge.
// Return that as an error. Any other panic remains.
defer func() {
e := recover()
if e == nil {
return
}
if panicErr, ok := e.(error); ok && panicErr == bytes.ErrTooLarge {
err = panicErr
} else {
panic(e)
}
}()
_, err = buf.ReadFrom(f)
return buf.Bytes(), err
}
// WriteFile is adapTed from ioutil
func WriteFile(filename string, data []byte, perm os.FileMode) error {
f, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)
if err != nil {
return err
}
n, err := f.Write(data)
if err == nil && n < len(data) {
err = io.ErrShortWrite
}
if err1 := f.Close(); err == nil {
err = err1
}
return err
}
// WalkDirs looks for files in the given dir and returns a list of files in it
// usage for all files in the b0x: WalkDirs("", false)
func WalkDirs(name string, includeDirsInList bool, files ...string) ([]string, error) {
f, err := FS.OpenFile(CTX, name, os.O_RDONLY, 0)
if err != nil {
return nil, err
}
fileInfos, err := f.Readdir(0)
if err != nil {
return nil, err
}
err = f.Close()
if err != nil {
return nil, err
}
for _, info := range fileInfos {
filename := path.Join(name, info.Name())
if includeDirsInList || !info.IsDir() {
files = append(files, filename)
}
if info.IsDir() {
files, err = WalkDirs(filename, includeDirsInList, files...)
if err != nil {
return nil, err
}
}
}
return files, nil
}

View File

@ -1,30 +0,0 @@
// Code generaTed by fileb0x at "2021-08-11 21:11:48.973787292 +0300 EEST m=+0.273940433" from config file "b0x.yaml" DO NOT EDIT.
// modified(2021-08-11 21:10:36.055919109 +0300 EEST)
// original path: swagger-ui/dist/favicon-16x16.png
package swaggerFiles
import (
"os"
)
// FileFavicon16x16Png is "/favicon-16x16.png"
var FileFavicon16x16Png = []byte("\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x10\x00\x00\x00\x10\x08\x03\x00\x00\x00\x28\x2d\x0f\x53\x00\x00\x01\x35\x50\x4c\x54\x45\x62\xb1\x34\x61\xb1\x34\x5e\xab\x35\x5b\xa5\x35\x57\xa0\x37\x55\x9d\x37\x52\x97\x38\x51\x96\x38\x2f\x5e\x40\x2e\x5d\x40\x2d\x5a\x41\x2b\x57\x41\x33\x66\x3e\x34\x66\x3f\x39\x6f\x3d\x25\x4e\x43\x24\x4d\x43\x24\x4f\x43\x26\x4d\x42\x24\x4b\x42\x23\x4c\x42\x21\x49\x43\x24\x4b\x42\x24\x4c\x42\x24\x4d\x42\x25\x4d\x42\x24\x4e\x43\x25\x4e\x43\x1c\x41\x44\x1c\x3f\x45\x1f\x43\x44\x1d\x43\x44\x1f\x44\x44\x20\x45\x43\x22\x49\x43\x22\x49\x43\x23\x4a\x42\x27\x53\x41\x24\x4c\x43\x26\x50\x41\x22\x47\x42\x22\x48\x43\x29\x56\x41\x2b\x59\x3f\x24\x4d\x41\x25\x4d\x42\x14\x36\x46\x15\x34\x44\x15\x32\x47\x11\x33\x44\x12\x35\x46\x10\x31\x42\x0c\x31\x49\x15\x2b\x40\x00\x24\x49\x00\x33\x4d\x00\x33\x33\x00\x00\x00\x00\x00\x00\x85\xea\x2d\x84\xe9\x2c\x83\xe8\x2c\x82\xe6\x2d\x81\xe5\x2c\x7f\xe2\x2e\x80\xe1\x2e\x7d\xdd\x2e\x7c\xdd\x2e\x76\xd2\x30\x74\xd0\x30\x72\xca\x31\x71\xc9\x31\x70\xc8\x31\x6f\xc6\x32\x6d\xc5\x31\x6d\xc4\x31\x6c\xc3\x32\x6b\xc0\x32\x6a\xbf\x32\x69\xbe\x33\x68\xbb\x33\x68\xba\x33\x67\xb8\x33\x4b\x8d\x39\x4a\x8a\x3a\x4a\x89\x3a\x44\x7f\x3b\x43\x7f\x3c\x40\x79\x3d\x3e\x77\x3d\x39\x6e\x3e\x38\x6d\x3e\x38\x6e\x3f\x36\x6a\x3f\x35\x68\x3f\x33\x65\x3f\x1b\x3d\x45\x1b\x3e\x45\x1c\x3f\x45\x1c\x3d\x45\x1e\x43\x45\x1f\x44\x44\x20\x46\x44\x60\x25\x11\x2f\x00\x00\x00\x3b\x74\x52\x4e\x53\xf4\xf4\xf5\xf5\xf6\xf5\xf7\xf6\xee\xee\xef\xf0\xea\xea\xe7\xe1\xe1\xe0\xe0\xe3\xe3\xdf\xdc\xdb\xdb\xda\xd9\xd8\xd8\xdb\xcf\xbf\xbc\xba\xac\xab\xa9\xa9\xa1\x99\x96\x94\x8e\x89\x85\x84\x4c\x31\x24\x1e\x1d\x1f\x15\x0c\x07\x0a\x05\x01\x00\x07\x07\xae\xc9\x00\x00\x00\xd8\x49\x44\x41\x54\x78\xda\x3d\xcf\xd9\x2e\x43\x51\x18\x86\xe1\xcf\x6e\x8a\x8d\x52\x69\xa9\x22\x86\xb6\x31\xcf\x73\xd6\xbb\x5b\xb3\x84\x12\x1b\x41\x8c\x35\x94\x3b\x75\xe0\x86\xa4\x12\xc1\x5a\xcd\x4e\x9f\xa3\xff\xff\xce\x5e\x19\x6b\x2e\x97\x49\x76\x0f\x4c\x2d\xb9\x5b\xc6\xac\x0f\x77\x94\x4b\x50\x3a\x4e\x8c\xae\xba\x61\x63\x30\x4e\xa4\x69\x68\xcd\x0e\x85\x96\xe8\xdd\xdb\x24\x96\x37\x9a\xf7\xe1\xf2\x01\xeb\xf1\x1e\xda\x16\x54\x08\xe1\x7d\x0b\x6b\xe7\x0d\xc2\x49\xf5\x04\xf0\x1a\xe0\xbc\x40\xd0\xa7\x14\x5c\xdd\xec\x9f\x1f\x9c\x1e\x9e\x54\x2e\x20\xed\xfd\x49\xbf\x71\xff\xcb\xaf\xf9\xb5\xef\x98\xf4\xa3\x6c\x00\x4f\x45\x9c\xe7\x22\x41\xaf\xc6\x43\xa8\xee\x62\x6d\x57\xe1\x6c\x42\xcb\xad\x70\x5b\xc1\xba\xbb\x86\xf6\x45\x99\x31\x8f\x86\xe6\x9c\xf1\x94\xca\x7f\x28\xf2\x99\x49\x4b\x36\x70\xba\xf3\xc8\xc5\x95\x13\x23\xf5\x38\x6b\x65\x36\x9b\xec\xea\x9f\xa9\xe7\xff\x03\xcd\x4a\x39\x84\xc0\xe4\xbb\xd1\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82")
func init() {
f, err := FS.OpenFile(CTX, "/favicon-16x16.png", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
if err != nil {
panic(err)
}
_, err = f.Write(FileFavicon16x16Png)
if err != nil {
panic(err)
}
err = f.Close()
if err != nil {
panic(err)
}
}

View File

@ -1,30 +0,0 @@
// Code generaTed by fileb0x at "2021-08-11 21:11:49.069266556 +0300 EEST m=+0.369419692" from config file "b0x.yaml" DO NOT EDIT.
// modified(2021-08-11 21:10:36.055919109 +0300 EEST)
// original path: swagger-ui/dist/favicon-32x32.png
package swaggerFiles
import (
"os"
)
// FileFavicon32x32Png is "/favicon-32x32.png"
var FileFavicon32x32Png = []byte("\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x20\x00\x00\x00\x20\x08\x03\x00\x00\x00\x44\xa4\x8a\xc6\x00\x00\x00\x90\x50\x4c\x54\x45\x00\x00\x00\x10\x33\x44\x16\x35\x46\x16\x36\x46\x17\x36\x46\x00\x2e\x3a\x16\x35\x46\x18\x38\x45\x17\x37\x46\x1a\x3c\x45\x0f\x31\x40\x14\x33\x44\x15\x35\x46\x16\x36\x46\x16\x35\x46\x16\x35\x45\x16\x35\x46\x15\x34\x46\x16\x36\x46\x16\x35\x46\x16\x33\x47\x85\xea\x2d\x17\x36\x47\x21\x47\x43\x81\xe5\x2c\x33\x66\x3f\x70\xc9\x31\x2f\x5e\x40\x37\x6b\x3e\x5a\xa5\x36\x7e\xe0\x2e\x43\x80\x3b\x77\xd4\x2f\x5f\xae\x35\x39\x6f\x3e\x6e\xc5\x32\x3f\x78\x3c\x73\xce\x30\x26\x4f\x42\x2c\x59\x41\x1e\x42\x45\x65\xb7\x34\x7a\xd9\x2e\x83\xe8\x2c\x48\x87\x3a\x4a\x8a\x3a\x49\x88\x3a\x4e\x90\x39\x78\x6f\x8d\xe5\x00\x00\x00\x15\x74\x52\x4e\x53\x00\x15\xcd\xf4\xe1\x07\x99\xfe\xf8\xfe\x10\x20\x77\xc4\xa9\x46\x8a\x53\xd7\xbd\x2d\x8a\x6b\xf8\x74\x00\x00\x01\x7e\x49\x44\x41\x54\x78\xda\x85\x53\xd9\x76\x82\x30\x10\x1d\x25\x10\x22\xee\x96\x09\x6b\x64\x07\xc5\xb6\xff\xff\x77\x2d\x49\x20\x14\x3d\xf6\xbe\x4c\x72\xe6\xce\x3e\x03\x06\xf6\x69\xbf\x26\xae\x4b\xd6\xfb\x93\x0d\xcf\x58\x39\x16\xb2\xb0\xfa\x7c\x54\x21\x43\xd7\x59\x2d\xf5\x5b\x0b\x93\x3c\xf0\x25\x82\x3c\x44\x6b\xfb\xc7\xcb\x66\x87\x49\xe4\xcf\x10\x25\xb8\xdb\x18\xbd\x47\xd8\xcd\x5f\x20\x67\xc4\x9b\xec\x09\x37\xe6\xc6\x09\x27\x3a\x11\x7b\x4d\x4b\xff\x05\x4a\xba\xb6\x55\x7e\x98\x0e\xff\xbe\x5c\xba\x49\xf1\x28\x03\x58\xc9\xf0\xab\x39\xc6\xa3\xa6\xa5\x71\x36\xc8\xc4\x1d\x82\x1c\xa9\xfc\x54\x58\xa4\x93\x69\x8c\x57\x69\x44\x9d\x5f\x82\x25\xdf\x7e\x8c\x99\x71\x5e\x63\x2b\xe5\xd5\xb5\xe1\x80\xaa\xc2\x06\xc5\xa4\xef\x05\x36\xf2\x71\xc3\x03\x38\x4c\xf5\x8f\xa3\x94\x1a\x94\x4b\x11\x30\x07\x2e\xb1\x7a\x62\xe7\xcf\xd0\x50\x45\x8f\x2f\x40\x0a\xd5\x38\x4c\xe6\x84\x02\x53\x25\xcf\xa0\xf2\x0d\x91\xd7\x7d\xdb\x65\x41\xc3\x85\xe0\x4d\x5f\x73\x0c\x65\x96\x16\xb8\x23\x21\x0b\x38\xbf\x0b\xce\x83\xac\x6b\xfb\xa8\x1b\x09\x3a\x84\xf8\x36\x21\x94\xc1\x97\xd0\x21\x76\x3a\x49\xca\xe6\x04\x36\x26\xb9\x03\x87\xf5\xba\x4c\xe1\x1b\x60\x37\x95\x79\xc2\x9b\x26\xdc\x8d\x5e\x20\x9f\x1a\x65\xbb\x57\xdd\xc9\xda\x10\xee\xb3\x56\xc3\x7e\x1c\x56\x6c\x86\x55\x60\x35\xc8\x4c\x0e\xcb\xa3\xa1\x34\x2a\xd8\x20\xf5\xe0\x78\x29\x6b\x91\xe3\x86\xa3\xee\x9a\x41\x54\xf6\xb3\x85\x01\xfb\xfc\xcf\xca\x81\x67\xbd\x5f\x5a\x80\x83\xc5\xf2\xa5\x3e\xa7\xc4\x83\x09\x1f\xe4\xfd\xe1\x00\xac\x2e\xf8\xf6\xf4\x86\x30\x67\x1c\x8e\xf7\xf1\x7c\xbc\x26\xce\xf6\xd5\xf9\xff\x00\xc6\x8c\x46\x7b\xbe\xb8\x05\x67\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82")
func init() {
f, err := FS.OpenFile(CTX, "/favicon-32x32.png", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
if err != nil {
panic(err)
}
_, err = f.Write(FileFavicon32x32Png)
if err != nil {
panic(err)
}
err = f.Close()
if err != nil {
panic(err)
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -12,7 +12,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"github.com/swaggo/gin-swagger/swaggerFiles"
swaggerFiles "github.com/swaggo/files"
)
type mockedSwag struct{}