Create publisher for remote srt stream

This commit is contained in:
Ingo Oppermann
2022-08-12 18:42:53 +03:00
parent c04ab1e82f
commit b51a38c99e
331 changed files with 18224 additions and 12383 deletions

View File

@@ -188,7 +188,6 @@ const indexTemplate = `<!-- HTML for static distribution bundle build -->
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />

12
vendor/github.com/swaggo/files/filebox.go generated vendored Normal file
View File

@@ -0,0 +1,12 @@
package swaggerFiles
import (
"golang.org/x/net/webdav"
)
func NewHandler() *webdav.Handler {
return &webdav.Handler{
FileSystem: FS,
LockSystem: webdav.NewMemLS(),
}
}

View File

@@ -99,6 +99,7 @@ OPTIONS:
--codeExampleFiles value, --cef value Parse folder containing code example files to use for the x-codeSamples extension, disabled by default
--parseInternal Parse go files in internal packages, disabled by default (default: false)
--generatedTime Generate timestamp at the top of docs.go, disabled by default (default: false)
--requiredByDefault Set validation required for all fields by default (default: false)
--parseDepth value Dependency parse depth (default: 100)
--instanceName value This parameter can be used to name different swagger document instances. It is optional.
--overridesFile value File to read global type overrides from. (default: ".swaggo")
@@ -127,8 +128,10 @@ OPTIONS:
- [echo](http://github.com/swaggo/echo-swagger)
- [buffalo](https://github.com/swaggo/buffalo-swagger)
- [net/http](https://github.com/swaggo/http-swagger)
- [gorilla/mux](https://github.com/swaggo/http-swagger)
- [go-chi/chi](https://github.com/swaggo/http-swagger)
- [flamingo](https://github.com/i-love-flamingo/swagger)
- [fiber](https://github.com/arsmn/fiber-swagger)
- [fiber](https://github.com/gofiber/swagger)
- [atreugo](https://github.com/Nerzal/atreugo-swagger)
## How to use it with Gin
@@ -488,7 +491,7 @@ type Foo struct {
Field Name | Type | Description
---|:---:|---
<a name="validate"></a>validate | `string` | Determines the validation for the parameter. Possible values are: `required`.
<a name="validate"></a>validate | `string` | Determines the validation for the parameter. Possible values are: `required,optional`.
<a name="parameterDefault"></a>default | * | Declares the value of the parameter that the server will use if none is provided, for example a "count" to control the number of results per page might default to 100 if not supplied by the client in the request. (Note: "default" has no meaning for required parameters.) See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2. Unlike JSON Schema this value MUST conform to the defined [`type`](#parameterType) for this parameter.
<a name="parameterMaximum"></a>maximum | `number` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
<a name="parameterMinimum"></a>minimum | `number` | See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.

View File

@@ -123,6 +123,12 @@ OPTIONS:
- [echo](http://github.com/swaggo/echo-swagger)
- [buffalo](https://github.com/swaggo/buffalo-swagger)
- [net/http](https://github.com/swaggo/http-swagger)
- [net/http](https://github.com/swaggo/http-swagger)
- [gorilla/mux](https://github.com/swaggo/http-swagger)
- [go-chi/chi](https://github.com/swaggo/http-swagger)
- [flamingo](https://github.com/i-love-flamingo/swagger)
- [fiber](https://github.com/gofiber/swagger)
- [atreugo](https://github.com/Nerzal/atreugo-swagger)
## 如何与Gin集成

View File

@@ -18,6 +18,7 @@ var _ FieldParser = &tagBaseFieldParser{p: nil, field: nil, tag: ""}
const (
requiredLabel = "required"
optionalLabel = "optional"
swaggerTypeTag = "swaggertype"
swaggerIgnoreTag = "swaggerignore"
)
@@ -472,8 +473,11 @@ func (ps *tagBaseFieldParser) IsRequired() (bool, error) {
bindingTag := ps.tag.Get(bindingTag)
if bindingTag != "" {
for _, val := range strings.Split(bindingTag, ",") {
if val == requiredLabel {
switch val {
case requiredLabel:
return true, nil
case optionalLabel:
return false, nil
}
}
}
@@ -481,13 +485,16 @@ func (ps *tagBaseFieldParser) IsRequired() (bool, error) {
validateTag := ps.tag.Get(validateTag)
if validateTag != "" {
for _, val := range strings.Split(validateTag, ",") {
if val == requiredLabel {
switch val {
case requiredLabel:
return true, nil
case optionalLabel:
return false, nil
}
}
}
return false, nil
return ps.p.RequiredByDefault, nil
}
func parseValidTags(validTag string, sf *structField) {

View File

@@ -78,7 +78,7 @@ func formatComments(fileName string, contents []byte, formattedComments []byte,
}
func formatFuncDoc(commentList []*ast.Comment, formattedComments io.Writer, oldCommentsMap map[string]string) {
w := tabwriter.NewWriter(formattedComments, 0, 0, 2, ' ', 0)
w := tabwriter.NewWriter(formattedComments, 0, 0, 1, ' ', 0)
for _, comment := range commentList {
text := comment.Text

View File

@@ -94,11 +94,8 @@ func (pkgDefs *PackagesDefinitions) parametrizeStruct(original *TypeSpecDef, ful
Tag: field.Tag,
Comment: field.Comment,
}
if genTypeSpec, ok := genericParamTypeDefs[field.Type.(*ast.Ident).Name]; ok {
newField.Type = genTypeSpec.TypeSpec.Type
} else {
newField.Type = field.Type
}
newField.Type = resolveType(field.Type, field, genericParamTypeDefs)
newStructTypeDef.Fields.List = append(newStructTypeDef.Fields.List, newField)
}
@@ -107,3 +104,15 @@ func (pkgDefs *PackagesDefinitions) parametrizeStruct(original *TypeSpecDef, ful
return parametrizedTypeSpec
}
func resolveType(expr ast.Expr, field *ast.Field, genericParamTypeDefs map[string]*TypeSpecDef) ast.Expr {
if asIdent, ok := expr.(*ast.Ident); ok {
if genTypeSpec, ok := genericParamTypeDefs[asIdent.Name]; ok {
return genTypeSpec.TypeSpec.Type
}
} else if asArray, ok := expr.(*ast.ArrayType); ok {
return &ast.ArrayType{Elt: resolveType(asArray.Elt, field, genericParamTypeDefs), Len: asArray.Len, Lbrack: asArray.Lbrack}
}
return field.Type
}

View File

@@ -1130,7 +1130,7 @@ func (operation *Operation) ParseEmptyResponseOnly(commentLine string) error {
return fmt.Errorf("can not parse response comment \"%s\"", commentLine)
}
operation.AddResponse(code, spec.NewResponse())
operation.AddResponse(code, spec.NewResponse().WithDescription(http.StatusText(code)))
}
return nil

View File

@@ -130,6 +130,9 @@ type Parser struct {
// Strict whether swag should error or warn when it detects cases which are most likely user errors
Strict bool
// RequiredByDefault set validation required for all fields by default
RequiredByDefault bool
// structStack stores full names of the structures that were already parsed or are being parsed now
structStack []*TypeSpecDef
@@ -868,6 +871,14 @@ func convertFromSpecificToPrimitive(typeName string) (string, error) {
}
func (parser *Parser) getTypeSchema(typeName string, file *ast.File, ref bool) (*spec.Schema, error) {
if override, ok := parser.Overrides[typeName]; ok {
parser.debug.Printf("Override detected for %s: using %s instead", typeName, override)
typeName = override
}
if IsInterfaceLike(typeName) {
return &spec.Schema{}, nil
}
if IsGolangPrimitiveType(typeName) {
return PrimitiveSchema(TransToValidSchemeType(typeName)), nil
}
@@ -1421,7 +1432,6 @@ func defineTypeOfExample(schemaType, arrayType, exampleValue string) (interface{
result[mapData[0]] = v
continue
}
return nil, fmt.Errorf("example value %s should format: key:value", exampleValue)
@@ -1556,7 +1566,7 @@ func walkWith(excludes map[string]struct{}, parseVendor bool) func(path string,
if f.IsDir() {
if !parseVendor && f.Name() == "vendor" || // ignore "vendor"
f.Name() == "docs" || // exclude docs
len(f.Name()) > 1 && f.Name()[0] == '.' { // exclude all hidden folder
len(f.Name()) > 1 && f.Name()[0] == '.' && f.Name() != ".." { // exclude all hidden folder
return filepath.SkipDir
}

View File

@@ -26,6 +26,8 @@ const (
STRING = "string"
// FUNC represent a function value.
FUNC = "func"
// ERROR represent a error value.
ERROR = "error"
// INTERFACE represent a interface value.
INTERFACE = "interface{}"
// ANY represent a any value.
@@ -63,6 +65,11 @@ func IsPrimitiveType(typeName string) bool {
return false
}
// IsInterfaceLike determines whether the swagger type name is an go named interface type like error type.
func IsInterfaceLike(typeName string) bool {
return typeName == ERROR || typeName == ANY
}
// IsNumericType determines whether the swagger type name is a numeric type.
func IsNumericType(typeName string) bool {
return typeName == INTEGER || typeName == NUMBER
@@ -106,8 +113,7 @@ func IsGolangPrimitiveType(typeName string) bool {
"float32",
"float64",
"bool",
"string",
"any":
"string":
return true
}

View File

@@ -1,4 +1,4 @@
package swag
// Version of swag.
const Version = "v1.8.3"
const Version = "v1.8.4"