@@ -163,6 +163,26 @@ public function testSchemaJsonLdCollection(): void
163163 $ this ->assertEquals (['$ref ' => '#/definitions/BagOfTests.jsonld-read ' ], $ schema ['allOf ' ][1 ]['properties ' ]['hydra:member ' ]['items ' ]);
164164 }
165165
166+ public function testHydraCollectionBaseSchemaExample (): void
167+ {
168+ $ schema = $ this ->schemaFactory ->buildSchema (BagOfTests::class, 'jsonld ' , forceCollection: true );
169+
170+ $ this ->assertArrayHasKey ('HydraCollectionBaseSchema ' , $ schema ['definitions ' ]);
171+ $ hydraCollectionSchema = $ schema ['definitions ' ]['HydraCollectionBaseSchema ' ];
172+
173+ // Navigate to the hydra:view property example
174+ $ this ->assertArrayHasKey ('allOf ' , $ hydraCollectionSchema );
175+ $ viewProperty = $ hydraCollectionSchema ['allOf ' ][1 ]['properties ' ]['hydra:view ' ] ?? null ;
176+ $ this ->assertNotNull ($ viewProperty , 'hydra:view property should exist ' );
177+
178+ // Check that the example uses @type instead of type
179+ $ this ->assertArrayHasKey ('example ' , $ viewProperty );
180+ $ example = $ viewProperty ['example ' ];
181+ $ this ->assertArrayHasKey ('@type ' , $ example , 'Example should use @type with @ prefix ' );
182+ $ this ->assertArrayNotHasKey ('type ' , $ example , 'Example should not use type without @ prefix ' );
183+ $ this ->assertArrayHasKey ('@id ' , $ example , 'Example should have @id ' );
184+ }
185+
166186 public function testArraySchemaWithMultipleUnionTypes (): void
167187 {
168188 $ schema = $ this ->schemaFactory ->buildSchema (Nest::class, 'jsonld ' , 'output ' );
0 commit comments