hotfix: fix flag context not works bug (#204)

This commit is contained in:
naison
2024-04-01 11:44:59 +08:00
committed by GitHub
parent aacdc8a6d0
commit d3aeae7573
479 changed files with 47506 additions and 9712 deletions

View File

@@ -16,6 +16,7 @@ package swag
import (
"encoding/json"
"errors"
"fmt"
"path/filepath"
"reflect"
@@ -50,7 +51,7 @@ func BytesToYAMLDoc(data []byte) (interface{}, error) {
return nil, err
}
if document.Kind != yaml.DocumentNode || len(document.Content) != 1 || document.Content[0].Kind != yaml.MappingNode {
return nil, fmt.Errorf("only YAML documents that are objects are supported")
return nil, errors.New("only YAML documents that are objects are supported")
}
return &document, nil
}