diff --git a/pkg/graph/parser/parser.go b/pkg/graph/parser/parser.go index fc5d89d1..ac67f063 100644 --- a/pkg/graph/parser/parser.go +++ b/pkg/graph/parser/parser.go @@ -80,13 +80,38 @@ func getExpectedTypes(schema *spec.Schema) ([]string, error) { } // Handle OneOf schemas - if len(schema.OneOf) > 0 { - var types []string - for _, subType := range schema.OneOf { - types = append(types, subType.Type...) - } - return types, nil - } + if len(schema.OneOf) > 0 { + var types []string + hasStructuralConstraints := false + + for _, subSchema := range schema.OneOf { + // Check for structural constraints + if len(subSchema.Required) > 0 || subSchema.Not != nil { + hasStructuralConstraints = true + } + // Collect types if present + if len(subSchema.Type) > 0 { + types = append(types, subSchema.Type...) + } + } + + // If we found structural constraints, ensure "object" is included + if hasStructuralConstraints { + if !slices.Contains(types, "object") { + types = append(types, "object") + } + } + + // If we found any types, return them + if len(types) > 0 { + return types, nil + } + // If no explicit types but we have structural constraints, return object + if hasStructuralConstraints { + return []string{"object"}, nil + } + } + // Handle AnyOf schemas if len(schema.AnyOf) > 0 {