Skip to content

Commit defac54

Browse files
moutonjeremyJeremy Mouton
andauthored
fix: Skip path and query parameters in schema generation (#29)
Co-authored-by: Jeremy Mouton <[email protected]>
1 parent 1fd200a commit defac54

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

fiberoapi.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,11 @@ func generateSchema(t reflect.Type) map[string]interface{} {
575575
continue
576576
}
577577

578+
// Skip fields that are path or query parameters - they are handled separately
579+
if field.Tag.Get("path") != "" || field.Tag.Get("query") != "" {
580+
continue
581+
}
582+
578583
// Get JSON tag name
579584
jsonTag := field.Tag.Get("json")
580585
if jsonTag == "-" {
@@ -602,13 +607,6 @@ func generateSchema(t reflect.Type) map[string]interface{} {
602607
}
603608
}
604609

605-
// Add description from path/query tags
606-
if pathTag := field.Tag.Get("path"); pathTag != "" {
607-
fieldSchema["description"] = "Path parameter: " + pathTag
608-
} else if queryTag := field.Tag.Get("query"); queryTag != "" {
609-
fieldSchema["description"] = "Query parameter: " + queryTag
610-
}
611-
612610
properties[fieldName] = fieldSchema
613611
}
614612

0 commit comments

Comments
 (0)