@@ -588,8 +588,8 @@ components:
588588 schema := sp .Schema ()
589589 assert .NotNil (t , schema )
590590
591- // just verify the schema was built - the important thing is coverage
592- // title may not be preserved depending on how merging works
591+ sp . idx . SetRolodex ( & index. Rolodex {}) // set a rolodex to avoid nil deref
592+ assert . Nil ( t , sp . getDocumentConfig ())
593593}
594594
595595func TestSchemaProxy_attemptPropertyMerging_MergeError (t * testing.T ) {
@@ -623,3 +623,35 @@ type: array`), &node)
623623 result := sp .attemptPropertyMerging (node .Content [0 ], config )
624624 assert .Nil (t , result ) // when merge fails, nil is returned
625625}
626+
627+ func TestSchemaProxy_NoDocumentConfig (t * testing.T ) {
628+
629+ sp := & SchemaProxy {
630+ ctx : context .Background (),
631+ }
632+
633+ specYml := `openapi: 3.1.0
634+ components:
635+ schemas:
636+ Base:
637+ type: object`
638+
639+ var specNode yaml.Node
640+ _ = yaml .Unmarshal ([]byte (specYml ), & specNode )
641+ idx := index .NewSpecIndexWithConfig (& specNode , & index.SpecIndexConfig {})
642+ sp .idx = idx
643+
644+ // create conflicting node that will cause merge to fail
645+ var node yaml.Node
646+ _ = yaml .Unmarshal ([]byte (`$ref: '#/components/schemas/Base'
647+ type: array` ), & node )
648+
649+ config := & datamodel.DocumentConfiguration {
650+ MergeReferencedProperties : true ,
651+ PropertyMergeStrategy : datamodel .RejectConflicts , // this will cause merge to fail
652+ }
653+
654+ // this should trigger lines 332-334 (error path)
655+ result := sp .attemptPropertyMerging (node .Content [0 ], config )
656+ assert .Nil (t , result ) // when merge fails, nil is returned
657+ }
0 commit comments