Skip to content

Commit b156bdc

Browse files
committed
when named operation contains a description, use it, otherwise fall back to auto-gen
1 parent 8ea145f commit b156bdc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

router/pkg/schemaloader/schema_builder.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package schemaloader
22

33
import (
44
"fmt"
5-
"strings"
65

76
"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
87
"github.com/wundergraph/graphql-go-tools/v2/pkg/engine/jsonschema"
@@ -48,8 +47,12 @@ func (b *SchemaBuilder) buildSchemaForOperation(operation *Operation) error {
4847
}
4948
operation.JSONSchema = s
5049

51-
// Merge descriptions (operation takes priority)
52-
operation.Description = strings.TrimSpace(operation.Description + " " + schema.Description)
50+
// Use operation description if provided, otherwise fall back to schema description
51+
// This ensures user-provided descriptions take absolute priority
52+
if operation.Description == "" {
53+
operation.Description = schema.Description
54+
}
55+
// If operation.Description is not empty, keep it as-is (don't merge with schema description)
5356
}
5457

5558
return nil

0 commit comments

Comments
 (0)