@@ -255,3 +255,66 @@ func TestDynamicValue_MarshalYAMLInlineWithContext_BoolValue(t *testing.T) {
255255 assert .NoError (t , err )
256256 assert .NotNil (t , result )
257257}
258+
259+ func TestDynamicValue_MarshalYAMLInline_WithSchemaProxy (t * testing.T ) {
260+ // Test MarshalYAMLInline directly (covers lines 109-112)
261+ // This tests the code path where renderCtx is explicitly set to nil
262+ const ymlComponents = `components:
263+ schemas:
264+ rice:
265+ type: string`
266+
267+ idx := func () * index.SpecIndex {
268+ var idxNode yaml.Node
269+ err := yaml .Unmarshal ([]byte (ymlComponents ), & idxNode )
270+ assert .NoError (t , err )
271+ return index .NewSpecIndexWithConfig (& idxNode , index .CreateOpenAPIIndexConfig ())
272+ }()
273+
274+ const ymlSchema = `type: string`
275+ var node yaml.Node
276+ _ = yaml .Unmarshal ([]byte (ymlSchema ), & node )
277+
278+ lowProxy := new (lowbase.SchemaProxy )
279+ err := lowProxy .Build (context .Background (), nil , node .Content [0 ], idx )
280+ assert .NoError (t , err )
281+
282+ lowRef := low.NodeReference [* lowbase.SchemaProxy ]{
283+ Value : lowProxy ,
284+ }
285+
286+ sp := NewSchemaProxy (& lowRef )
287+
288+ dv := & DynamicValue [* SchemaProxy , bool ]{N : 0 , A : sp }
289+
290+ // Call MarshalYAMLInline directly - this sets inline=true, renderCtx=nil
291+ result , err := dv .MarshalYAMLInline ()
292+ assert .NoError (t , err )
293+ assert .NotNil (t , result )
294+
295+ // Verify it rendered correctly
296+ bits , _ := yaml .Marshal (result )
297+ assert .Contains (t , string (bits ), "type: string" )
298+ }
299+
300+ func TestDynamicValue_MarshalYAMLInline_PtrNotRenderableInline (t * testing.T ) {
301+ // Test the else branch at line 78 - pointer type that does NOT implement RenderableInline
302+ // This covers the fallback path where we call n.Encode(value) directly
303+ type simpleStruct struct {
304+ Name string `yaml:"name"`
305+ Value int `yaml:"value"`
306+ }
307+
308+ dv := & DynamicValue [* simpleStruct , bool ]{N : 0 , A : & simpleStruct {Name : "test" , Value : 42 }}
309+
310+ // Call MarshalYAMLInline - simpleStruct doesn't implement RenderableInline
311+ // so it should fall through to the else branch and use n.Encode()
312+ result , err := dv .MarshalYAMLInline ()
313+ assert .NoError (t , err )
314+ assert .NotNil (t , result )
315+
316+ // Verify it rendered correctly via the fallback path
317+ bits , _ := yaml .Marshal (result )
318+ assert .Contains (t , string (bits ), "name: test" )
319+ assert .Contains (t , string (bits ), "value: 42" )
320+ }
0 commit comments