-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Expand file tree
/
Copy pathAnotherFakeController.php
More file actions
80 lines (64 loc) · 2.01 KB
/
AnotherFakeController.php
File metadata and controls
80 lines (64 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php declare(strict_types=1);
/**
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
* PHP version 8.1
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator
* https://openapi-generator.tech
* Do not edit the class manually.
*
* Source files are located at:
*
* > 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);
$apiResult = $this->api->call123TestSpecialTags($client);
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);
}
}