@@ -46,7 +46,7 @@ public static function getResources(): array
4646 * api_platform.defaults.parameters with:
4747 * HeaderParameter:
4848 * key: 'X-API-Key'
49- * required: true
49+ * required: false
5050 * description: 'API key for authentication'
5151 *
5252 * The parameter appears in ALL resources and ALL their operations in the OpenAPI output.
@@ -84,7 +84,7 @@ public function testDefaultParameterAppearsInOpenApiForAllOperations(): void
8484 $ this ->assertSame ('X-API-Key ' , $ param ['name ' ]);
8585 $ this ->assertSame ('header ' , $ param ['in ' ]);
8686 $ this ->assertSame ('API key for authentication ' , $ param ['description ' ]);
87- $ this ->assertTrue ($ param ['required ' ]);
87+ $ this ->assertFalse ($ param ['required ' ]);
8888 $ this ->assertFalse ($ param ['deprecated ' ]);
8989 $ this ->assertArrayHasKey ('schema ' , $ param );
9090 $ this ->assertSame ('string ' , $ param ['schema ' ]['type ' ]);
@@ -148,4 +148,21 @@ public function testDefaultParameterAppearsInMultipleOperationTypes(): void
148148 implode (', ' , array_keys ($ operationMethodsWithParameter )))
149149 );
150150 }
151+
152+ public function testDefaultParametersDoNotBreakJsonLdDocumentation (): void
153+ {
154+ $ response = self ::createClient ()->request ('GET ' , '/docs.jsonld ' , [
155+ 'headers ' => ['Accept ' => 'application/ld+json ' ],
156+ ]);
157+
158+ $ this ->assertResponseIsSuccessful ();
159+ $ content = $ response ->toArray ();
160+
161+ $ this ->assertArrayHasKey ('@context ' , $ content );
162+
163+ $ this ->assertTrue (
164+ isset ($ content ['entrypoint ' ]) || isset ($ content ['hydra:supportedClass ' ]),
165+ 'JSON-LD response should have either "entrypoint" or "hydra:supportedClass" key '
166+ );
167+ }
151168}
0 commit comments