File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
src/Symfony/Bundle/DependencyInjection Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -169,12 +169,19 @@ public function getConfigTreeBuilder(): TreeBuilder
169169 $ this ->addFormatSection ($ rootNode , 'patch_formats ' , [
170170 'json ' => ['mime_types ' => ['application/merge-patch+json ' ]],
171171 ]);
172- $ this ->addFormatSection ($ rootNode , 'docs_formats ' , [
173- 'jsonopenapi ' => ['mime_types ' => ['application/vnd.openapi+json ' ]],
174- 'yamlopenapi ' => ['mime_types ' => ['application/vnd.openapi+yaml ' ]],
172+
173+ $ defaultDocFormats = [
175174 'jsonld ' => ['mime_types ' => ['application/ld+json ' ]],
175+ 'jsonopenapi ' => ['mime_types ' => ['application/vnd.openapi+json ' ]],
176176 'html ' => ['mime_types ' => ['text/html ' ]],
177- ]);
177+ ];
178+
179+ if (class_exists (Yaml::class)) {
180+ $ defaultDocFormats ['yamlopenapi ' ] = ['mime_types ' => ['application/vnd.openapi+yaml ' ]];
181+ }
182+
183+ $ this ->addFormatSection ($ rootNode , 'docs_formats ' , $ defaultDocFormats );
184+
178185 $ this ->addFormatSection ($ rootNode , 'error_formats ' , [
179186 'jsonld ' => ['mime_types ' => ['application/ld+json ' ]],
180187 'jsonproblem ' => ['mime_types ' => ['application/problem+json ' ]],
You can’t perform that action at this time.
0 commit comments