mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-09 19:16:11 +00:00
feat (PHP LARAVEL) 8417: initial PHP-laravel codegen integration (#574)
* feat (PHP LARAVEL) 8417: initial PHP-laravel codegen integration * feat (PHP LARAVEL) 8417: code review adjustments * feat (PHP LARAVEL) 8417: fix typos; add missing files; adjust readme for those unfamilar with laravel to get started quickly * feat (PHP LARAVEL) 8417: add sample petstore server * feat (PHP LARAVEL) 8417: adjust route service provdider and model generation
This commit is contained in:
committed by
William Cheng
parent
d1fc923b66
commit
f793ac25c7
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// $schedule->command('inspire')
|
||||
// ->hourly();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* A list of the exception types that are not reported.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontReport = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of the inputs that are never flashed for validation exceptions.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontFlash = [
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* Report or log an exception.
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @return void
|
||||
*/
|
||||
public function report(Exception $exception)
|
||||
{
|
||||
parent::report($exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $exception
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function render($request, Exception $exception)
|
||||
{
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
* Source files are located at:
|
||||
*
|
||||
* > swagger-codegen/modules/swagger-codegen/src/main/resources/php-laravel/
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Request;
|
||||
|
||||
class AnotherFakeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testSpecialTags
|
||||
*
|
||||
* To test special tags.
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function testSpecialTags()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
if (!isset($input['client'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $client when calling testSpecialTags');
|
||||
}
|
||||
$client = $input['client'];
|
||||
|
||||
|
||||
return response('How about implementing testSpecialTags as a patch method ?');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
/**
|
||||
* Class Controller
|
||||
*
|
||||
* @package App\Http\Controllers
|
||||
*/
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function welcome()
|
||||
{
|
||||
return view('welcome');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
* Source files are located at:
|
||||
*
|
||||
* > swagger-codegen/modules/swagger-codegen/src/main/resources/php-laravel/
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Request;
|
||||
|
||||
class FakeClassnameTags123Controller extends Controller
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testClassname
|
||||
*
|
||||
* To test class name in snake case.
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function testClassname()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
if (!isset($input['client'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $client when calling testClassname');
|
||||
}
|
||||
$client = $input['client'];
|
||||
|
||||
|
||||
return response('How about implementing testClassname as a patch method ?');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,380 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
* Source files are located at:
|
||||
*
|
||||
* > swagger-codegen/modules/swagger-codegen/src/main/resources/php-laravel/
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Request;
|
||||
|
||||
class FakeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation testClientModel
|
||||
*
|
||||
* To test \"client\" model.
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function testClientModel()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
if (!isset($input['client'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $client when calling testClientModel');
|
||||
}
|
||||
$client = $input['client'];
|
||||
|
||||
|
||||
return response('How about implementing testClientModel as a patch method ?');
|
||||
}
|
||||
/**
|
||||
* Operation testEndpointParameters
|
||||
*
|
||||
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트.
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function testEndpointParameters()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
if (!isset($input['number'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $number when calling testEndpointParameters');
|
||||
}
|
||||
if ($input['number'] > 543.2) {
|
||||
throw new \InvalidArgumentException('invalid value for $number when calling FakeController.testEndpointParameters, must be smaller than or equal to 543.2.');
|
||||
}
|
||||
if ($input['number'] < 32.1) {
|
||||
throw new \InvalidArgumentException('invalid value for $number when calling FakeController.testEndpointParameters, must be bigger than or equal to 32.1.');
|
||||
}
|
||||
$number = $input['number'];
|
||||
|
||||
if (!isset($input['double'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $double when calling testEndpointParameters');
|
||||
}
|
||||
if ($input['double'] > 123.4) {
|
||||
throw new \InvalidArgumentException('invalid value for $double when calling FakeController.testEndpointParameters, must be smaller than or equal to 123.4.');
|
||||
}
|
||||
if ($input['double'] < 67.8) {
|
||||
throw new \InvalidArgumentException('invalid value for $double when calling FakeController.testEndpointParameters, must be bigger than or equal to 67.8.');
|
||||
}
|
||||
$double = $input['double'];
|
||||
|
||||
if (!isset($input['pattern_without_delimiter'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $pattern_without_delimiter when calling testEndpointParameters');
|
||||
}
|
||||
if (!preg_match("/^[A-Z].*/", $input['pattern_without_delimiter'])) {
|
||||
throw new \InvalidArgumentException('invalid value for $pattern_without_delimiter when calling FakeController.testEndpointParameters, must conform to the pattern /^[A-Z].*/.');
|
||||
}
|
||||
$pattern_without_delimiter = $input['pattern_without_delimiter'];
|
||||
|
||||
if (!isset($input['byte'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $byte when calling testEndpointParameters');
|
||||
}
|
||||
$byte = $input['byte'];
|
||||
|
||||
if ($input['integer'] > 100) {
|
||||
throw new \InvalidArgumentException('invalid value for $integer when calling FakeController.testEndpointParameters, must be smaller than or equal to 100.');
|
||||
}
|
||||
if ($input['integer'] < 10) {
|
||||
throw new \InvalidArgumentException('invalid value for $integer when calling FakeController.testEndpointParameters, must be bigger than or equal to 10.');
|
||||
}
|
||||
$integer = $input['integer'];
|
||||
|
||||
if ($input['int32'] > 200) {
|
||||
throw new \InvalidArgumentException('invalid value for $int32 when calling FakeController.testEndpointParameters, must be smaller than or equal to 200.');
|
||||
}
|
||||
if ($input['int32'] < 20) {
|
||||
throw new \InvalidArgumentException('invalid value for $int32 when calling FakeController.testEndpointParameters, must be bigger than or equal to 20.');
|
||||
}
|
||||
$int32 = $input['int32'];
|
||||
|
||||
$int64 = $input['int64'];
|
||||
|
||||
if ($input['float'] > 987.6) {
|
||||
throw new \InvalidArgumentException('invalid value for $float when calling FakeController.testEndpointParameters, must be smaller than or equal to 987.6.');
|
||||
}
|
||||
$float = $input['float'];
|
||||
|
||||
if (!preg_match("/[a-z]/i", $input['string'])) {
|
||||
throw new \InvalidArgumentException('invalid value for $string when calling FakeController.testEndpointParameters, must conform to the pattern /[a-z]/i.');
|
||||
}
|
||||
$string = $input['string'];
|
||||
|
||||
$binary = $input['binary'];
|
||||
|
||||
$date = $input['date'];
|
||||
|
||||
$date_time = $input['date_time'];
|
||||
|
||||
if (strlen($input['password']) > 64) {
|
||||
throw new \InvalidArgumentException('invalid length for $password when calling FakeController.testEndpointParameters, must be smaller than or equal to 64.');
|
||||
}
|
||||
if (strlen($input['password']) < 10) {
|
||||
throw new \InvalidArgumentException('invalid length for $password when calling FakeController.testEndpointParameters, must be bigger than or equal to 10.');
|
||||
}
|
||||
$password = $input['password'];
|
||||
|
||||
$callback = $input['callback'];
|
||||
|
||||
|
||||
return response('How about implementing testEndpointParameters as a post method ?');
|
||||
}
|
||||
/**
|
||||
* Operation testEnumParameters
|
||||
*
|
||||
* To test enum parameters.
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function testEnumParameters()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
$enum_header_string_array = $input['enum_header_string_array'];
|
||||
|
||||
$enum_header_string = $input['enum_header_string'];
|
||||
|
||||
$enum_query_string_array = $input['enum_query_string_array'];
|
||||
|
||||
$enum_query_string = $input['enum_query_string'];
|
||||
|
||||
$enum_query_integer = $input['enum_query_integer'];
|
||||
|
||||
$enum_query_double = $input['enum_query_double'];
|
||||
|
||||
$enum_form_string_array = $input['enum_form_string_array'];
|
||||
|
||||
$enum_form_string = $input['enum_form_string'];
|
||||
|
||||
|
||||
return response('How about implementing testEnumParameters as a get method ?');
|
||||
}
|
||||
/**
|
||||
* Operation testBodyWithFileSchema
|
||||
*
|
||||
* .
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function testBodyWithFileSchema()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
if (!isset($input['file_schema_test_class'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $file_schema_test_class when calling testBodyWithFileSchema');
|
||||
}
|
||||
$file_schema_test_class = $input['file_schema_test_class'];
|
||||
|
||||
|
||||
return response('How about implementing testBodyWithFileSchema as a put method ?');
|
||||
}
|
||||
/**
|
||||
* Operation testBodyWithQueryParams
|
||||
*
|
||||
* .
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function testBodyWithQueryParams()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
if (!isset($input['query'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $query when calling testBodyWithQueryParams');
|
||||
}
|
||||
$query = $input['query'];
|
||||
|
||||
if (!isset($input['user'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $user when calling testBodyWithQueryParams');
|
||||
}
|
||||
$user = $input['user'];
|
||||
|
||||
|
||||
return response('How about implementing testBodyWithQueryParams as a put method ?');
|
||||
}
|
||||
/**
|
||||
* Operation testInlineAdditionalProperties
|
||||
*
|
||||
* test inline additionalProperties.
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function testInlineAdditionalProperties()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
if (!isset($input['request_body'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $request_body when calling testInlineAdditionalProperties');
|
||||
}
|
||||
$request_body = $input['request_body'];
|
||||
|
||||
|
||||
return response('How about implementing testInlineAdditionalProperties as a post method ?');
|
||||
}
|
||||
/**
|
||||
* Operation testJsonFormData
|
||||
*
|
||||
* test json serialization of form data.
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function testJsonFormData()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
if (!isset($input['param'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $param when calling testJsonFormData');
|
||||
}
|
||||
$param = $input['param'];
|
||||
|
||||
if (!isset($input['param2'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $param2 when calling testJsonFormData');
|
||||
}
|
||||
$param2 = $input['param2'];
|
||||
|
||||
|
||||
return response('How about implementing testJsonFormData as a get method ?');
|
||||
}
|
||||
/**
|
||||
* Operation fakeOuterBooleanSerialize
|
||||
*
|
||||
* .
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function fakeOuterBooleanSerialize()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
$body = $input['body'];
|
||||
|
||||
|
||||
return response('How about implementing fakeOuterBooleanSerialize as a post method ?');
|
||||
}
|
||||
/**
|
||||
* Operation fakeOuterCompositeSerialize
|
||||
*
|
||||
* .
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function fakeOuterCompositeSerialize()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
$outer_composite = $input['outer_composite'];
|
||||
|
||||
|
||||
return response('How about implementing fakeOuterCompositeSerialize as a post method ?');
|
||||
}
|
||||
/**
|
||||
* Operation fakeOuterNumberSerialize
|
||||
*
|
||||
* .
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function fakeOuterNumberSerialize()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
$body = $input['body'];
|
||||
|
||||
|
||||
return response('How about implementing fakeOuterNumberSerialize as a post method ?');
|
||||
}
|
||||
/**
|
||||
* Operation fakeOuterStringSerialize
|
||||
*
|
||||
* .
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function fakeOuterStringSerialize()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
$body = $input['body'];
|
||||
|
||||
|
||||
return response('How about implementing fakeOuterStringSerialize as a post method ?');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
* Source files are located at:
|
||||
*
|
||||
* > swagger-codegen/modules/swagger-codegen/src/main/resources/php-laravel/
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Request;
|
||||
|
||||
class PetController extends Controller
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation uploadFileWithRequiredFile
|
||||
*
|
||||
* uploads an image (required).
|
||||
*
|
||||
* @param int $pet_id ID of pet to update (required)
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function uploadFileWithRequiredFile($pet_id)
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
|
||||
return response('How about implementing uploadFileWithRequiredFile as a post method ?');
|
||||
}
|
||||
/**
|
||||
* Operation addPet
|
||||
*
|
||||
* Add a new pet to the store.
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function addPet()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
if (!isset($input['pet'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $pet when calling addPet');
|
||||
}
|
||||
$pet = $input['pet'];
|
||||
|
||||
|
||||
return response('How about implementing addPet as a post method ?');
|
||||
}
|
||||
/**
|
||||
* Operation updatePet
|
||||
*
|
||||
* Update an existing pet.
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function updatePet()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
if (!isset($input['pet'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $pet when calling updatePet');
|
||||
}
|
||||
$pet = $input['pet'];
|
||||
|
||||
|
||||
return response('How about implementing updatePet as a put method ?');
|
||||
}
|
||||
/**
|
||||
* Operation findPetsByStatus
|
||||
*
|
||||
* Finds Pets by status.
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function findPetsByStatus()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
if (!isset($input['status'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $status when calling findPetsByStatus');
|
||||
}
|
||||
$status = $input['status'];
|
||||
|
||||
|
||||
return response('How about implementing findPetsByStatus as a get method ?');
|
||||
}
|
||||
/**
|
||||
* Operation findPetsByTags
|
||||
*
|
||||
* Finds Pets by tags.
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function findPetsByTags()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
if (!isset($input['tags'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $tags when calling findPetsByTags');
|
||||
}
|
||||
$tags = $input['tags'];
|
||||
|
||||
|
||||
return response('How about implementing findPetsByTags as a get method ?');
|
||||
}
|
||||
/**
|
||||
* Operation deletePet
|
||||
*
|
||||
* Deletes a pet.
|
||||
*
|
||||
* @param int $pet_id Pet id to delete (required)
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function deletePet($pet_id)
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
|
||||
return response('How about implementing deletePet as a delete method ?');
|
||||
}
|
||||
/**
|
||||
* Operation getPetById
|
||||
*
|
||||
* Find pet by ID.
|
||||
*
|
||||
* @param int $pet_id ID of pet to return (required)
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function getPetById($pet_id)
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
|
||||
return response('How about implementing getPetById as a get method ?');
|
||||
}
|
||||
/**
|
||||
* Operation updatePetWithForm
|
||||
*
|
||||
* Updates a pet in the store with form data.
|
||||
*
|
||||
* @param int $pet_id ID of pet that needs to be updated (required)
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function updatePetWithForm($pet_id)
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
|
||||
return response('How about implementing updatePetWithForm as a post method ?');
|
||||
}
|
||||
/**
|
||||
* Operation uploadFile
|
||||
*
|
||||
* uploads an image.
|
||||
*
|
||||
* @param int $pet_id ID of pet to update (required)
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function uploadFile($pet_id)
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
|
||||
return response('How about implementing uploadFile as a post method ?');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
* Source files are located at:
|
||||
*
|
||||
* > swagger-codegen/modules/swagger-codegen/src/main/resources/php-laravel/
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Request;
|
||||
|
||||
class StoreController extends Controller
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation getInventory
|
||||
*
|
||||
* Returns pet inventories by status.
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function getInventory()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
|
||||
return response('How about implementing getInventory as a get method ?');
|
||||
}
|
||||
/**
|
||||
* Operation placeOrder
|
||||
*
|
||||
* Place an order for a pet.
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function placeOrder()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
if (!isset($input['order'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $order when calling placeOrder');
|
||||
}
|
||||
$order = $input['order'];
|
||||
|
||||
|
||||
return response('How about implementing placeOrder as a post method ?');
|
||||
}
|
||||
/**
|
||||
* Operation deleteOrder
|
||||
*
|
||||
* Delete purchase order by ID.
|
||||
*
|
||||
* @param string $order_id ID of the order that needs to be deleted (required)
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function deleteOrder($order_id)
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
|
||||
return response('How about implementing deleteOrder as a delete method ?');
|
||||
}
|
||||
/**
|
||||
* Operation getOrderById
|
||||
*
|
||||
* Find purchase order by ID.
|
||||
*
|
||||
* @param int $order_id ID of pet that needs to be fetched (required)
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function getOrderById($order_id)
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
if ($order_id > 5) {
|
||||
throw new \InvalidArgumentException('invalid value for $order_id when calling StoreController.getOrderById, must be smaller than or equal to 5.');
|
||||
}
|
||||
if ($order_id < 1) {
|
||||
throw new \InvalidArgumentException('invalid value for $order_id when calling StoreController.getOrderById, must be bigger than or equal to 1.');
|
||||
}
|
||||
|
||||
|
||||
//not path params validation
|
||||
|
||||
return response('How about implementing getOrderById as a get method ?');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
* Source files are located at:
|
||||
*
|
||||
* > swagger-codegen/modules/swagger-codegen/src/main/resources/php-laravel/
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Request;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation createUser
|
||||
*
|
||||
* Create user.
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function createUser()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
if (!isset($input['user'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $user when calling createUser');
|
||||
}
|
||||
$user = $input['user'];
|
||||
|
||||
|
||||
return response('How about implementing createUser as a post method ?');
|
||||
}
|
||||
/**
|
||||
* Operation createUsersWithArrayInput
|
||||
*
|
||||
* Creates list of users with given input array.
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function createUsersWithArrayInput()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
if (!isset($input['user'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $user when calling createUsersWithArrayInput');
|
||||
}
|
||||
$user = $input['user'];
|
||||
|
||||
|
||||
return response('How about implementing createUsersWithArrayInput as a post method ?');
|
||||
}
|
||||
/**
|
||||
* Operation createUsersWithListInput
|
||||
*
|
||||
* Creates list of users with given input array.
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function createUsersWithListInput()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
if (!isset($input['user'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $user when calling createUsersWithListInput');
|
||||
}
|
||||
$user = $input['user'];
|
||||
|
||||
|
||||
return response('How about implementing createUsersWithListInput as a post method ?');
|
||||
}
|
||||
/**
|
||||
* Operation loginUser
|
||||
*
|
||||
* Logs user into the system.
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function loginUser()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
if (!isset($input['username'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $username when calling loginUser');
|
||||
}
|
||||
$username = $input['username'];
|
||||
|
||||
if (!isset($input['password'])) {
|
||||
throw new \InvalidArgumentException('Missing the required parameter $password when calling loginUser');
|
||||
}
|
||||
$password = $input['password'];
|
||||
|
||||
|
||||
return response('How about implementing loginUser as a get method ?');
|
||||
}
|
||||
/**
|
||||
* Operation logoutUser
|
||||
*
|
||||
* Logs out current logged in user session.
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function logoutUser()
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
|
||||
return response('How about implementing logoutUser as a get method ?');
|
||||
}
|
||||
/**
|
||||
* Operation deleteUser
|
||||
*
|
||||
* Delete user.
|
||||
*
|
||||
* @param string $username The name that needs to be deleted (required)
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function deleteUser($username)
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
|
||||
return response('How about implementing deleteUser as a delete method ?');
|
||||
}
|
||||
/**
|
||||
* Operation getUserByName
|
||||
*
|
||||
* Get user by user name.
|
||||
*
|
||||
* @param string $username The name that needs to be fetched. Use user1 for testing. (required)
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function getUserByName($username)
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
|
||||
return response('How about implementing getUserByName as a get method ?');
|
||||
}
|
||||
/**
|
||||
* Operation updateUser
|
||||
*
|
||||
* Updated user.
|
||||
*
|
||||
* @param string $username name that need to be deleted (required)
|
||||
*
|
||||
* @return Http response
|
||||
*/
|
||||
public function updateUser($username)
|
||||
{
|
||||
$input = Request::all();
|
||||
|
||||
//path params validation
|
||||
|
||||
|
||||
//not path params validation
|
||||
|
||||
return response('How about implementing updateUser as a put method ?');
|
||||
}
|
||||
}
|
||||
63
samples/server/petstore/php-laravel/lib/app/Http/Kernel.php
Normal file
63
samples/server/petstore/php-laravel/lib/app/Http/Kernel.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
* These middleware are run during every request to your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $middleware = [
|
||||
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
// \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
'throttle:60,1',
|
||||
'bindings',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware.
|
||||
*
|
||||
* These middleware may be assigned to groups or used individually.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
||||
|
||||
class EncryptCookies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the cookies that should not be encrypted.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string|null $guard
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next, $guard = null)
|
||||
{
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect('/home');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
||||
|
||||
class TrimStrings extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the attributes that should not be trimmed.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Fideloper\Proxy\TrustProxies as Middleware;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The trusted proxies for this application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers = Request::HEADER_X_FORWARDED_ALL;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||
|
||||
class VerifyCsrfToken extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be excluded from CSRF verification.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* AdditionalPropertiesClass
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* AdditionalPropertiesClass
|
||||
*/
|
||||
class AdditionalPropertiesClass {
|
||||
|
||||
/** @var map[string,string] $map_property */
|
||||
private $map_property;
|
||||
|
||||
/** @var map[string,map[string,string]] $map_of_map_property */
|
||||
private $map_of_map_property;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Animal
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* Animal
|
||||
*/
|
||||
class Animal {
|
||||
|
||||
/** @var string $class_name */
|
||||
private $class_name;
|
||||
|
||||
/** @var string $color */
|
||||
private $color;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* AnimalFarm
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* AnimalFarm
|
||||
*/
|
||||
class AnimalFarm {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* ApiResponse
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* ApiResponse
|
||||
*/
|
||||
class ApiResponse {
|
||||
|
||||
/** @var int $code */
|
||||
private $code;
|
||||
|
||||
/** @var string $type */
|
||||
private $type;
|
||||
|
||||
/** @var string $message */
|
||||
private $message;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* ArrayOfArrayOfNumberOnly
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* ArrayOfArrayOfNumberOnly
|
||||
*/
|
||||
class ArrayOfArrayOfNumberOnly {
|
||||
|
||||
/** @var float[][] $array_array_number */
|
||||
private $array_array_number;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* ArrayOfNumberOnly
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* ArrayOfNumberOnly
|
||||
*/
|
||||
class ArrayOfNumberOnly {
|
||||
|
||||
/** @var float[] $array_number */
|
||||
private $array_number;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* ArrayTest
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* ArrayTest
|
||||
*/
|
||||
class ArrayTest {
|
||||
|
||||
/** @var string[] $array_of_string */
|
||||
private $array_of_string;
|
||||
|
||||
/** @var int[][] $array_array_of_integer */
|
||||
private $array_array_of_integer;
|
||||
|
||||
/** @var \app.Models\ReadOnlyFirst[][] $array_array_of_model */
|
||||
private $array_array_of_model;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Capitalization
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* Capitalization
|
||||
*/
|
||||
class Capitalization {
|
||||
|
||||
/** @var string $small_camel */
|
||||
private $small_camel;
|
||||
|
||||
/** @var string $capital_camel */
|
||||
private $capital_camel;
|
||||
|
||||
/** @var string $small_snake */
|
||||
private $small_snake;
|
||||
|
||||
/** @var string $capital_snake */
|
||||
private $capital_snake;
|
||||
|
||||
/** @var string $sca_eth_flow_points */
|
||||
private $sca_eth_flow_points;
|
||||
|
||||
/** @var string $att_name Name of the pet*/
|
||||
private $att_name;
|
||||
|
||||
}
|
||||
21
samples/server/petstore/php-laravel/lib/app/Models/Cat.php
Normal file
21
samples/server/petstore/php-laravel/lib/app/Models/Cat.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Cat
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* Cat
|
||||
*/
|
||||
class Cat {
|
||||
|
||||
/** @var string $class_name */
|
||||
private $class_name;
|
||||
|
||||
/** @var string $color */
|
||||
private $color;
|
||||
|
||||
/** @var bool $declawed */
|
||||
private $declawed;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Category
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* Category
|
||||
*/
|
||||
class Category {
|
||||
|
||||
/** @var int $id */
|
||||
private $id;
|
||||
|
||||
/** @var string $name */
|
||||
private $name;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* ClassModel
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* ClassModel
|
||||
*/
|
||||
class ClassModel {
|
||||
|
||||
/** @var string $_class */
|
||||
private $_class;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* Client
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* Client
|
||||
*/
|
||||
class Client {
|
||||
|
||||
/** @var string $client */
|
||||
private $client;
|
||||
|
||||
}
|
||||
21
samples/server/petstore/php-laravel/lib/app/Models/Dog.php
Normal file
21
samples/server/petstore/php-laravel/lib/app/Models/Dog.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Dog
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* Dog
|
||||
*/
|
||||
class Dog {
|
||||
|
||||
/** @var string $class_name */
|
||||
private $class_name;
|
||||
|
||||
/** @var string $color */
|
||||
private $color;
|
||||
|
||||
/** @var string $breed */
|
||||
private $breed;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* EnumArrays
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* EnumArrays
|
||||
*/
|
||||
class EnumArrays {
|
||||
|
||||
/** @var string $just_symbol */
|
||||
private $just_symbol;
|
||||
|
||||
/** @var string[] $array_enum */
|
||||
private $array_enum;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* EnumClass
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* EnumClass
|
||||
*/
|
||||
class EnumClass {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* EnumTest
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* EnumTest
|
||||
*/
|
||||
class EnumTest {
|
||||
|
||||
/** @var string $enum_string */
|
||||
private $enum_string;
|
||||
|
||||
/** @var string $enum_string_required */
|
||||
private $enum_string_required;
|
||||
|
||||
/** @var int $enum_integer */
|
||||
private $enum_integer;
|
||||
|
||||
/** @var double $enum_number */
|
||||
private $enum_number;
|
||||
|
||||
/** @var \app.Models\OuterEnum $outer_enum */
|
||||
private $outer_enum;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* FileSchemaTestClass
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* FileSchemaTestClass
|
||||
*/
|
||||
class FileSchemaTestClass {
|
||||
|
||||
/** @var \app.Models\File $file */
|
||||
private $file;
|
||||
|
||||
/** @var \app.Models\File[] $files */
|
||||
private $files;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* FormatTest
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* FormatTest
|
||||
*/
|
||||
class FormatTest {
|
||||
|
||||
/** @var int $integer */
|
||||
private $integer;
|
||||
|
||||
/** @var int $int32 */
|
||||
private $int32;
|
||||
|
||||
/** @var int $int64 */
|
||||
private $int64;
|
||||
|
||||
/** @var float $number */
|
||||
private $number;
|
||||
|
||||
/** @var float $float */
|
||||
private $float;
|
||||
|
||||
/** @var double $double */
|
||||
private $double;
|
||||
|
||||
/** @var string $string */
|
||||
private $string;
|
||||
|
||||
/** @var string $byte */
|
||||
private $byte;
|
||||
|
||||
/** @var \SplFileObject $binary */
|
||||
private $binary;
|
||||
|
||||
/** @var \DateTime $date */
|
||||
private $date;
|
||||
|
||||
/** @var \DateTime $date_time */
|
||||
private $date_time;
|
||||
|
||||
/** @var string $uuid */
|
||||
private $uuid;
|
||||
|
||||
/** @var string $password */
|
||||
private $password;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* HasOnlyReadOnly
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* HasOnlyReadOnly
|
||||
*/
|
||||
class HasOnlyReadOnly {
|
||||
|
||||
/** @var string $bar */
|
||||
private $bar;
|
||||
|
||||
/** @var string $foo */
|
||||
private $foo;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* MapTest
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* MapTest
|
||||
*/
|
||||
class MapTest {
|
||||
|
||||
/** @var map[string,map[string,string]] $map_map_of_string */
|
||||
private $map_map_of_string;
|
||||
|
||||
/** @var map[string,string] $map_of_enum_string */
|
||||
private $map_of_enum_string;
|
||||
|
||||
/** @var map[string,bool] $direct_map */
|
||||
private $direct_map;
|
||||
|
||||
/** @var \app.Models\StringBooleanMap $indirect_map */
|
||||
private $indirect_map;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* MixedPropertiesAndAdditionalPropertiesClass
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* MixedPropertiesAndAdditionalPropertiesClass
|
||||
*/
|
||||
class MixedPropertiesAndAdditionalPropertiesClass {
|
||||
|
||||
/** @var string $uuid */
|
||||
private $uuid;
|
||||
|
||||
/** @var \DateTime $date_time */
|
||||
private $date_time;
|
||||
|
||||
/** @var map[string,\app.Models\Animal] $map */
|
||||
private $map;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Model200Response
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* Model200Response
|
||||
*/
|
||||
class Model200Response {
|
||||
|
||||
/** @var int $name */
|
||||
private $name;
|
||||
|
||||
/** @var string $class */
|
||||
private $class;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* ModelReturn
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* ModelReturn
|
||||
*/
|
||||
class ModelReturn {
|
||||
|
||||
/** @var int $return */
|
||||
private $return;
|
||||
|
||||
}
|
||||
24
samples/server/petstore/php-laravel/lib/app/Models/Name.php
Normal file
24
samples/server/petstore/php-laravel/lib/app/Models/Name.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* Name
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* Name
|
||||
*/
|
||||
class Name {
|
||||
|
||||
/** @var int $name */
|
||||
private $name;
|
||||
|
||||
/** @var int $snake_case */
|
||||
private $snake_case;
|
||||
|
||||
/** @var string $property */
|
||||
private $property;
|
||||
|
||||
/** @var int $_123_number */
|
||||
private $_123_number;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* NumberOnly
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* NumberOnly
|
||||
*/
|
||||
class NumberOnly {
|
||||
|
||||
/** @var float $just_number */
|
||||
private $just_number;
|
||||
|
||||
}
|
||||
30
samples/server/petstore/php-laravel/lib/app/Models/Order.php
Normal file
30
samples/server/petstore/php-laravel/lib/app/Models/Order.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Order
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* Order
|
||||
*/
|
||||
class Order {
|
||||
|
||||
/** @var int $id */
|
||||
private $id;
|
||||
|
||||
/** @var int $pet_id */
|
||||
private $pet_id;
|
||||
|
||||
/** @var int $quantity */
|
||||
private $quantity;
|
||||
|
||||
/** @var \DateTime $ship_date */
|
||||
private $ship_date;
|
||||
|
||||
/** @var string $status Order Status*/
|
||||
private $status;
|
||||
|
||||
/** @var bool $complete */
|
||||
private $complete;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* OuterComposite
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* OuterComposite
|
||||
*/
|
||||
class OuterComposite {
|
||||
|
||||
/** @var float $my_number */
|
||||
private $my_number;
|
||||
|
||||
/** @var string $my_string */
|
||||
private $my_string;
|
||||
|
||||
/** @var bool $my_boolean */
|
||||
private $my_boolean;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* OuterEnum
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* OuterEnum
|
||||
*/
|
||||
class OuterEnum {
|
||||
|
||||
}
|
||||
30
samples/server/petstore/php-laravel/lib/app/Models/Pet.php
Normal file
30
samples/server/petstore/php-laravel/lib/app/Models/Pet.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Pet
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* Pet
|
||||
*/
|
||||
class Pet {
|
||||
|
||||
/** @var int $id */
|
||||
private $id;
|
||||
|
||||
/** @var \app.Models\Category $category */
|
||||
private $category;
|
||||
|
||||
/** @var string $name */
|
||||
private $name;
|
||||
|
||||
/** @var string[] $photo_urls */
|
||||
private $photo_urls;
|
||||
|
||||
/** @var \app.Models\Tag[] $tags */
|
||||
private $tags;
|
||||
|
||||
/** @var string $status pet status in the store*/
|
||||
private $status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* ReadOnlyFirst
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* ReadOnlyFirst
|
||||
*/
|
||||
class ReadOnlyFirst {
|
||||
|
||||
/** @var string $bar */
|
||||
private $bar;
|
||||
|
||||
/** @var string $baz */
|
||||
private $baz;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* SpecialModelName
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* SpecialModelName
|
||||
*/
|
||||
class SpecialModelName {
|
||||
|
||||
/** @var int $special_property_name */
|
||||
private $special_property_name;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* StringBooleanMap
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* StringBooleanMap
|
||||
*/
|
||||
class StringBooleanMap {
|
||||
|
||||
}
|
||||
18
samples/server/petstore/php-laravel/lib/app/Models/Tag.php
Normal file
18
samples/server/petstore/php-laravel/lib/app/Models/Tag.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Tag
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* Tag
|
||||
*/
|
||||
class Tag {
|
||||
|
||||
/** @var int $id */
|
||||
private $id;
|
||||
|
||||
/** @var string $name */
|
||||
private $name;
|
||||
|
||||
}
|
||||
36
samples/server/petstore/php-laravel/lib/app/Models/User.php
Normal file
36
samples/server/petstore/php-laravel/lib/app/Models/User.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* User
|
||||
*/
|
||||
namespace app.Models;
|
||||
|
||||
/**
|
||||
* User
|
||||
*/
|
||||
class User {
|
||||
|
||||
/** @var int $id */
|
||||
private $id;
|
||||
|
||||
/** @var string $username */
|
||||
private $username;
|
||||
|
||||
/** @var string $first_name */
|
||||
private $first_name;
|
||||
|
||||
/** @var string $last_name */
|
||||
private $last_name;
|
||||
|
||||
/** @var string $email */
|
||||
private $email;
|
||||
|
||||
/** @var string $password */
|
||||
private $password;
|
||||
|
||||
/** @var string $phone */
|
||||
private $phone;
|
||||
|
||||
/** @var int $user_status User Status*/
|
||||
private $user_status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The policy mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $policies = [
|
||||
'App\Model' => 'App\Policies\ModelPolicy',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Broadcast::routes();
|
||||
|
||||
require base_path('routes/channels.php');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event listener mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $listen = [
|
||||
'App\Events\Event' => [
|
||||
'App\Listeners\EventListener',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any events for your application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* This namespace is applied to your controller routes.
|
||||
*
|
||||
* In addition, it is set as the URL generator's root namespace.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $namespace = 'App\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map()
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapApiRoutes()
|
||||
{
|
||||
Route::middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/api.php'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user