MCPcopy
hub / github.com/swaggo/swag / parseRouterAPIInfoComment

Method parseRouterAPIInfoComment

parser.go:1115–1135  ·  view source on GitHub ↗
(comments []*ast.Comment, fileInfo *AstFileInfo)

Source from the content-addressed store, hash-verified

1113}
1114
1115func (parser *Parser) parseRouterAPIInfoComment(comments []*ast.Comment, fileInfo *AstFileInfo) error {
1116 if parser.matchTags(comments) && matchExtension(parser.parseExtension, comments) {
1117 // for per 'function' comment, create a new 'Operation' object
1118 operation := NewOperation(parser, SetCodeExampleFilesDirectory(parser.codeExampleFilesDir))
1119 for _, comment := range comments {
1120 err := operation.ParseComment(comment.Text, fileInfo.File)
1121 if err != nil {
1122 return fmt.Errorf("ParseComment error in file %s for comment: '%s': %+v", fileInfo.Path, comment.Text, err)
1123 }
1124 if operation.State != "" && operation.State != parser.HostState {
1125 return nil
1126 }
1127 }
1128 err := processRouterOperation(parser, operation)
1129 if err != nil {
1130 return err
1131 }
1132 }
1133
1134 return nil
1135}
1136
1137func refRouteMethodOp(item *spec.PathItem, method string) (op **spec.Operation) {
1138 switch method {

Callers 1

ParseRouterAPIInfoMethod · 0.95

Calls 6

matchTagsMethod · 0.95
ParseCommentMethod · 0.95
matchExtensionFunction · 0.85
NewOperationFunction · 0.85
processRouterOperationFunction · 0.85

Tested by

no test coverage detected