How to add x-localization on header? #275
Unanswered
tamacoconutlab
asked this question in
Q&A
Replies: 1 comment 1 reply
-
This should work mate <?php
namespace App\Extensions;
use Dedoc\Scramble\Extensions\OperationExtension;
use Dedoc\Scramble\Support\Generator\Operation;
use Dedoc\Scramble\Support\Generator\Parameter;
use Dedoc\Scramble\Support\Generator\Schema;
use Dedoc\Scramble\Support\Generator\Types\StringType;
use Dedoc\Scramble\Support\RouteInfo;
class AddLocalizationHeaderExtension extends OperationExtension
{
public function handle(Operation $operation, RouteInfo $routeInfo)
{
if (\count($routeInfo->phpDoc()->getTagsByName('@localizationHeader'))) {
$operation->addParameters([
Parameter::make('x-localization', 'header')
->setSchema(
Schema::fromType(new StringType())
),
]);
}
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How to add x-localization on header?
Beta Was this translation helpful? Give feedback.
All reactions