Skip to content

Commit

Permalink
fix(symfony): default formats
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed Nov 6, 2024
1 parent 25aaa3f commit 51fe6a6
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Symfony/Bundle/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,19 @@ public function getConfigTreeBuilder(): TreeBuilder
$this->addFormatSection($rootNode, 'patch_formats', [
'json' => ['mime_types' => ['application/merge-patch+json']],
]);
$this->addFormatSection($rootNode, 'docs_formats', [
'jsonopenapi' => ['mime_types' => ['application/vnd.openapi+json']],
'yamlopenapi' => ['mime_types' => ['application/vnd.openapi+yaml']],

$defaultDocFormats = [
'jsonld' => ['mime_types' => ['application/ld+json']],
'jsonopenapi' => ['mime_types' => ['application/vnd.openapi+json']],
'html' => ['mime_types' => ['text/html']],
]);
];

if (class_exists(Yaml::class)) {
$defaultDocFormats['yamlopenapi'] = ['mime_types' => ['application/vnd.openapi+yaml']];
}

$this->addFormatSection($rootNode, 'docs_formats', $defaultDocFormats);

$this->addFormatSection($rootNode, 'error_formats', [
'jsonld' => ['mime_types' => ['application/ld+json']],
'jsonproblem' => ['mime_types' => ['application/problem+json']],
Expand Down

0 comments on commit 51fe6a6

Please sign in to comment.