feat: add swag tool

This commit is contained in:
Rogee
2024-12-25 16:18:41 +08:00
parent 2f2feb35c2
commit 77e36d5aaf
16 changed files with 76 additions and 54 deletions

View File

@@ -3,6 +3,7 @@ package swag
import (
"errors"
"fmt"
"github.com/go-openapi/spec"
)
@@ -184,7 +185,7 @@ func IsComplexSchema(schema *spec.Schema) bool {
return true
}
//Object included, such as Object or []Object
// Object included, such as Object or []Object
for _, st := range schema.Type {
if st == OBJECT {
return true
@@ -254,7 +255,7 @@ func BuildCustomSchema(types []string) (*spec.Schema, error) {
}
// MergeSchema merge schemas
func MergeSchema(dst *spec.Schema, src *spec.Schema) *spec.Schema {
func MergeSchema(dst, src *spec.Schema) *spec.Schema {
if len(src.Type) > 0 {
dst.Type = src.Type
}