https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/php-laravel/ */ namespace OpenAPI\Server\Http\Controllers; use Crell\Serde\SerdeCommon; use Illuminate\Routing\Controller; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Validator; use OpenAPI\Server\Api\AnotherFakeApiInterface; class AnotherFakeController extends Controller { /** * Constructor */ public function __construct( private readonly AnotherFakeApiInterface $api, private readonly SerdeCommon $serde = new SerdeCommon(), ) { } /** * Operation call123TestSpecialTags * * To test special tags. * */ public function call123TestSpecialTags(Request $request): JsonResponse { $validator = Validator::make( array_merge( [ ], $request->all(), ), [ ], ); if ($validator->fails()) { return response()->json(['error' => 'Invalid input'], 400); } $client = $this->serde->deserialize($request->getContent(), from: 'json', to: \OpenAPI\Server\Model\Client::class); try { $apiResult = $this->api->call123TestSpecialTags($client); } catch (\Exception $exception) { // This shouldn't happen return response()->json(['error' => $exception->getMessage()], 500); } if ($apiResult instanceof \OpenAPI\Server\Model\Client) { return response()->json($this->serde->serialize($apiResult, format: 'array'), 200); } // This shouldn't happen return response()->abort(500); } }